netfilter: ebt_ip6: fix source and destination matching

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Nov 22 17:59:06 EST 2013


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=acab78b99633f12aa2b697474562e19c5718a1ca
Commit:     acab78b99633f12aa2b697474562e19c5718a1ca
Parent:     0c3c6c00c69649f4749642b3e5d82125fde1600c
Author:     Luís Fernando Cornachioni Estrozi <lestrozi at uolinc.com>
AuthorDate: Wed Nov 6 21:39:32 2013 +0000
Committer:  Pablo Neira Ayuso <pablo at netfilter.org>
CommitDate: Tue Nov 19 15:33:29 2013 +0100

    netfilter: ebt_ip6: fix source and destination matching
    
    This bug was introduced on commit 0898f99a2. This just recovers two
    checks that existed before as suggested by Bart De Schuymer.
    
    Signed-off-by: Luís Fernando Cornachioni Estrozi <lestrozi at uolinc.com>
    Signed-off-by: Bart De Schuymer <bdschuym at pandora.be>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
---
 net/bridge/netfilter/ebt_ip6.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/bridge/netfilter/ebt_ip6.c b/net/bridge/netfilter/ebt_ip6.c
index 99c8566..17fd5f2 100644
--- a/net/bridge/netfilter/ebt_ip6.c
+++ b/net/bridge/netfilter/ebt_ip6.c
@@ -48,10 +48,12 @@ ebt_ip6_mt(const struct sk_buff *skb, struct xt_action_param *par)
 	if (info->bitmask & EBT_IP6_TCLASS &&
 	   FWINV(info->tclass != ipv6_get_dsfield(ih6), EBT_IP6_TCLASS))
 		return false;
-	if (FWINV(ipv6_masked_addr_cmp(&ih6->saddr, &info->smsk,
-				       &info->saddr), EBT_IP6_SOURCE) ||
+	if ((info->bitmask & EBT_IP6_SOURCE &&
+	    FWINV(ipv6_masked_addr_cmp(&ih6->saddr, &info->smsk,
+				       &info->saddr), EBT_IP6_SOURCE)) ||
+	    (info->bitmask & EBT_IP6_DEST &&
 	    FWINV(ipv6_masked_addr_cmp(&ih6->daddr, &info->dmsk,
-				       &info->daddr), EBT_IP6_DEST))
+				       &info->daddr), EBT_IP6_DEST)))
 		return false;
 	if (info->bitmask & EBT_IP6_PROTO) {
 		uint8_t nexthdr = ih6->nexthdr;



More information about the linux-mtd-cvs mailing list