Skip to contentSkip to conversation

nft-shared: set correc register value

PATCH In review Florian Westphal 2 participants 2 messages Dec 18, 2021 – Dec 22, 2021 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 nft-shared: set correc register value

reg is populated based off the payload base:

NFTNL_EXPR_META_KEY = NFTNL_EXPR_BASE,
NFTNL_EXPR_META_DREG,
NFTNL_EXPR_PAYLOAD_DREG = NFTNL_EXPR_BASE,

Fix this. It worked because the simple nft rules currently generated via ipables-nft have base == register-number but this is a coincidence.

---
 iptables/nft-shared.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
iptables/nft-shared.c +1 -1
index b281ba2987cc..4394e8b7c4e8 100644
@@ -443,7 +443,7 @@ static void nft_parse_payload(struct nft_xt_ctx *ctx, struct nftnl_expr *e)
 		ctx->flags |= NFT_XT_CTX_PREV_PAYLOAD;
 	}
 
-	ctx->reg = nftnl_expr_get_u32(e, NFTNL_EXPR_META_DREG);
+	ctx->reg = nftnl_expr_get_u32(e, NFTNL_EXPR_PAYLOAD_DREG);
 	ctx->payload.base = nftnl_expr_get_u32(e, NFTNL_EXPR_PAYLOAD_BASE);
 	ctx->payload.offset = nftnl_expr_get_u32(e, NFTNL_EXPR_PAYLOAD_OFFSET);
 	ctx->payload.len = nftnl_expr_get_u32(e, NFTNL_EXPR_PAYLOAD_LEN);
Signature · 1 line
2.33.1
#1 lore raw
Quoted 9 lines · Florian Westphal

reg is populated based off the payload base:

NFTNL_EXPR_META_KEY = NFTNL_EXPR_BASE,
NFTNL_EXPR_META_DREG,
NFTNL_EXPR_PAYLOAD_DREG = NFTNL_EXPR_BASE,

Fix this. It worked because the simple nft rules currently generated via ipables-nft have base == register-number but this is a coincidence.

s/correc/correct/

other than that, LGTM, thanks