Skip to content

Commit f920dc0

Browse files
committed
netfilter: nft_nat: correct length for loading protocol registers
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2189550 Upstream Status: commit 068d82e commit 068d82e Author: Jeremy Sowden <[email protected]> Date: Tue Mar 7 23:22:56 2023 +0000 netfilter: nft_nat: correct length for loading protocol registers The values in the protocol registers are two bytes wide. However, when parsing the register loads, the code currently uses the larger 16-byte size of a `union nf_inet_addr`. Change it to use the (correct) size of a `union nf_conntrack_man_proto` instead. Fixes: d07db98 ("netfilter: nf_tables: introduce nft_validate_register_load()") Signed-off-by: Jeremy Sowden <[email protected]> Reviewed-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: Florian Westphal <[email protected]>
1 parent eef5069 commit f920dc0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nft_nat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
226226
priv->flags |= NF_NAT_RANGE_MAP_IPS;
227227
}
228228

229-
plen = sizeof_field(struct nf_nat_range, min_addr.all);
229+
plen = sizeof_field(struct nf_nat_range, min_proto.all);
230230
if (tb[NFTA_NAT_REG_PROTO_MIN]) {
231231
err = nft_parse_register_load(tb[NFTA_NAT_REG_PROTO_MIN],
232232
&priv->sreg_proto_min, plen);

0 commit comments

Comments
 (0)