]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: fix inet nat with no layer 3 info
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 20 Jul 2021 16:59:44 +0000 (18:59 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 20 Jul 2021 17:05:15 +0000 (19:05 +0200)
nft currently reports:

 Error: Could not process rule: Protocol error
 add rule inet x y meta l4proto tcp dnat to :80
                                    ^^^^

default to NFPROTO_INET family, otherwise kernel bails out EPROTO when
trying to load the conntrack helper.

Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1428
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c

index 0ea57b0cd8fb4d9352a357aa8da790621685ee0f..98309ea83ac05ef9e0ba0a10299c40e30f679d31 100644 (file)
@@ -2997,9 +2997,10 @@ static int nat_evaluate_family(struct eval_ctx *ctx, struct stmt *stmt)
                        stmt->nat.family = ctx->pctx.family;
                return 0;
        case NFPROTO_INET:
-               if (!stmt->nat.addr)
+               if (!stmt->nat.addr) {
+                       stmt->nat.family = NFPROTO_INET;
                        return 0;
-
+               }
                if (stmt->nat.family != NFPROTO_UNSPEC)
                        return 0;