Re: [PATCH nft] netlink: Print value sizes on Relational expression size mismatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 30, 2018 at 04:01:12PM +0200, Máté Eckl wrote:
> Not all of the ocurances are covered as this information is not
> available in the scope where the error message is printed.
> 
> Signed-off-by: Máté Eckl <ecklm94@xxxxxxxxx>
> ---
>  src/netlink_delinearize.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
> index 52706b7..460ef7b 100644
> --- a/src/netlink_delinearize.c
> +++ b/src/netlink_delinearize.c
> @@ -272,14 +272,22 @@ static void netlink_parse_cmp(struct netlink_parse_ctx *ctx,
>  
>  	if (left->len > right->len &&
>  	    expr_basetype(left) != &string_type) {
> -		return netlink_error(ctx, loc, "Relational expression size mismatch");
> +		return netlink_error(ctx, loc, "Relational expression size mismatch."
> +				     "Left value size: %d, right value size: %d",
> +				     left->len, right->len);
>  	} else if (left->len > 0 && left->len < right->len) {
> +		int llen = left->len,
> +		    rlen = right->len;
>  		left = netlink_parse_concat_expr(ctx, loc, sreg, right->len);
> -		if (left == NULL)
> -			return;
> -		right = netlink_parse_concat_data(ctx, loc, sreg, right->len, right);
> -		if (right == NULL)
> +		if (left != NULL)
> +			right = netlink_parse_concat_data(ctx, loc, sreg,
> +							  right->len, right);
> +		if (!left || !right) {
> +			netlink_error(ctx, loc,
> +				      "Left value size: %d, right value size: %d",
> +				      llen, rlen);
>  			return;
> +		}
>  	}

I suspect you're missing some code in the evaluation phase?

So you get left->len 1 and right->len 4?
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux