Skip to contentSkip to conversation

evaluate: fix inet nat with no layer 3 info

PATCH New Pablo Neira Ayuso 1 participant 1 message Jul 20, 2021 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 evaluate: fix inet nat with no layer 3 info

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.

---
 src/evaluate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
src/evaluate.c +3 -2
index 0ea57b0cd8fb..98309ea83ac0 100644
@@ -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;
 
Signature · 1 line
2.30.2