]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
ip6tables: Fix checking existence of rule
authorMarkus Boehme <markubo@amazon.com>
Mon, 3 Apr 2023 21:13:47 +0000 (23:13 +0200)
committerPhil Sutter <phil@nwl.cc>
Tue, 4 Apr 2023 11:26:43 +0000 (13:26 +0200)
Pass the proper entry size when creating a match mask for checking the
existence of a rule. Failing to do so causes wrong results.

Reported-by: Jonathan Caicedo <jonathan@jcaicedo.com>
Fixes: eb2546a846776 ("xshared: Share make_delete_mask() between ip{,6}tables")
Signed-off-by: Markus Boehme <markubo@amazon.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/ip6tables.c

index 345af4519bfe7ab15fd96ce780bf34ae2a011df9..9afc32c1a21ed1f3e06bcdefd5413073fdf19c54 100644 (file)
@@ -331,7 +331,7 @@ check_entry(const xt_chainlabel chain, struct ip6t_entry *fw,
        int ret = 1;
        unsigned char *mask;
 
-       mask = make_delete_mask(matches, target, sizeof(fw));
+       mask = make_delete_mask(matches, target, sizeof(*fw));
        for (i = 0; i < nsaddrs; i++) {
                fw->ipv6.src = saddrs[i];
                fw->ipv6.smsk = smasks[i];