]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
nft: fix ebtables among match when mac+ip addresses are used
authorFlorian Westphal <fw@strlen.de>
Tue, 2 Aug 2022 12:52:30 +0000 (14:52 +0200)
committerFlorian Westphal <fw@strlen.de>
Tue, 2 Aug 2022 12:55:01 +0000 (14:55 +0200)
When matching mac and ip addresses, the ip address needs to be placed
into then 2nd 32bit register, the switch to dynamic register allocation
instead re-uses reg1, this partially clobbers the mac address, so
set lookup comes up empty even though it should find a match.

Fixes: 7e38890c6b4fb ("nft: prepare for dynamic register allocation")
Reported-by: Yi Chen <yiche@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/nft.c

index ec79f2bc5e98bce04af9ab58bc38ebd8cc90811b..ee003511ab7f3117c774e91167b7bc1f7634b647 100644 (file)
@@ -1208,8 +1208,8 @@ static int __add_nft_among(struct nft_handle *h, const char *table,
        nftnl_rule_add_expr(r, e);
 
        if (ip) {
-               e = gen_payload(h, NFT_PAYLOAD_NETWORK_HEADER, ip_addr_off[dst],
-                               sizeof(struct in_addr), &reg);
+               e = __gen_payload(NFT_PAYLOAD_NETWORK_HEADER, ip_addr_off[dst],
+                               sizeof(struct in_addr), NFT_REG32_02);
                if (!e)
                        return -ENOMEM;
                nftnl_rule_add_expr(r, e);