Re: [nft PATCH 3/4] netlink: Keep going after set element parsing failures

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

 



On Wed, May 21, 2025 at 03:12:41PM +0200, Phil Sutter wrote:
> Print an error message and try to deserialize the remaining elements
> instead of calling BUG().
> 
> Signed-off-by: Phil Sutter <phil@xxxxxx>
> ---
>  src/netlink.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/netlink.c b/src/netlink.c
> index 1222919458bae..3221d9f8ffc93 100644
> --- a/src/netlink.c
> +++ b/src/netlink.c
> @@ -1475,7 +1475,9 @@ int netlink_delinearize_setelem(struct netlink_ctx *ctx,
>  		key->byteorder = set->key->byteorder;
>  		key->len = set->key->len;
>  	} else {
> -		BUG("Unexpected set element with no key\n");
> +		netlink_io_error(ctx, NULL,
> +			         "Unexpected set element with no key\n");
> +		return 0;

If set element has no key, then something is very wrong. There is
already one exception that is the catch-all element (which has no
key).

This is enqueuing an error record, but 0 is returned, I am not sure if
this is ever going to be printed.

I am not sure this patch works.

>  	}
>  
>  	expr = set_elem_expr_alloc(&netlink_location, key);
> -- 
> 2.49.0
> 




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux