From: Giuseppe Longo <giuseppelng@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Giuseppe Longo <giuseppelng@gmail.com>
Subject: [PATCH] nft-arp: fix is_same_interfaces arguments
Date: Fri, 7 Mar 2014 11:43:13 +0100 [thread overview]
Message-ID: <1394188993-4752-1-git-send-email-giuseppelng@gmail.com> (raw)
Wrong arguments are passed to is_same_interfaces
that causes sometimes to delete a wrong rule.
See the example below:
arptables-compat -A INPUT -i eth0 -j ACCEPT
arptables-compat -A INPUT -i eth1 -j ACCEPT
arptables-compat -A INPUT -i eth2 -j ACCEPT
arptables-compat -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
-j ACCEPT -i eth0
-j ACCEPT -i eth1
-j ACCEPT -i eth2
arptables-compat -D INPUT -i eth2 -j ACCEPT
arptables-compat -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
-j ACCEPT -i eth1
-j ACCEPT -i eth2
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
---
iptables/nft-arp.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/iptables/nft-arp.c b/iptables/nft-arp.c
index a494ee6..1af7202 100644
--- a/iptables/nft-arp.c
+++ b/iptables/nft-arp.c
@@ -631,14 +631,14 @@ static bool nft_arp_is_same(const void *data_a,
return false;
}
- return is_same_interfaces(a->arp.src_devaddr.addr,
- a->arp.tgt_devaddr.addr,
- (unsigned char*)a->arp.src_devaddr.mask,
- (unsigned char*)a->arp.tgt_devaddr.mask,
- b->arp.src_devaddr.addr,
- a->arp.tgt_devaddr.addr,
- (unsigned char*)b->arp.src_devaddr.mask,
- (unsigned char*)b->arp.tgt_devaddr.mask);
+ return is_same_interfaces(a->arp.iniface,
+ a->arp.outiface,
+ (unsigned char *)a->arp.iniface_mask,
+ (unsigned char *)a->arp.outiface_mask,
+ b->arp.iniface,
+ b->arp.outiface,
+ (unsigned char *)b->arp.iniface_mask,
+ (unsigned char *)b->arp.outiface_mask);
}
static bool nft_arp_rule_find(struct nft_family_ops *ops, struct nft_rule *r,
--
1.8.3.2
next reply other threads:[~2014-03-07 10:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 10:43 Giuseppe Longo [this message]
2014-03-07 17:32 ` [PATCH] nft-arp: fix is_same_interfaces arguments Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394188993-4752-1-git-send-email-giuseppelng@gmail.com \
--to=giuseppelng@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).