]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
netlink: Keep going after set element parsing failures
authorPhil Sutter <phil@nwl.cc>
Fri, 16 May 2025 17:33:25 +0000 (19:33 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 13 Aug 2025 17:24:26 +0000 (19:24 +0200)
commit 31732dea34a2a4c484df13c4003728eca396e573 upstream.

Print an error message and try to deserialize the remaining elements
instead of calling BUG().

Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/netlink.c

index ea83ab814830f19e2a74ed0626dc118614c15aea..d30721cce02ebaded69b4ac4c3895b931afe0126 100644 (file)
@@ -1441,7 +1441,9 @@ key_end:
                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");
+               return 0;
        }
 
        expr = set_elem_expr_alloc(&netlink_location, key);