]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
xt: don't BUG if we can't find an extensions
authorFlorian Westphal <fw@strlen.de>
Tue, 8 May 2018 14:22:21 +0000 (16:22 +0200)
committerFlorian Westphal <fw@strlen.de>
Tue, 8 May 2018 14:22:59 +0000 (16:22 +0200)
it seems a bit harsh to just exit.

Signed-off-by: Florian Westphal <fw@strlen.de>
src/xt.c

index 9680f8ec4b0399cb4bb66186ea4f925fbaa4dfc6..4a954dc9a9c34cfd00f7eaa95396bcd5ae0e5018 100644 (file)
--- a/src/xt.c
+++ b/src/xt.c
@@ -204,9 +204,10 @@ void netlink_parse_match(struct netlink_parse_ctx *ctx,
        name = nftnl_expr_get_str(nle, NFTNL_EXPR_MT_NAME);
 
        mt = xtables_find_match(name, XTF_TRY_LOAD, NULL);
-       if (!mt)
-               BUG("XT match %s not found\n", name);
-
+       if (!mt) {
+               fprintf(stderr, "XT match %s not found\n", name);
+               return;
+       }
        mtinfo = nftnl_expr_get(nle, NFTNL_EXPR_MT_INFO, &mt_len);
 
        m = xzalloc(sizeof(struct xt_entry_match) + mt_len);
@@ -240,9 +241,10 @@ void netlink_parse_target(struct netlink_parse_ctx *ctx,
 
        name = nftnl_expr_get_str(nle, NFTNL_EXPR_TG_NAME);
        tg = xtables_find_target(name, XTF_TRY_LOAD);
-       if (!tg)
-               BUG("XT target %s not found\n", name);
-
+       if (!tg) {
+               fprintf(stderr, "XT target %s not found\n", name);
+               return;
+       }
        tginfo = nftnl_expr_get(nle, NFTNL_EXPR_TG_INFO, &tg_len);
 
        size = XT_ALIGN(sizeof(struct xt_entry_target)) + tg_len;