All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netfilter-devel@lists.netfilter.org, Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 07/09]: Fix xt_policy address matching
Date: Tue, 21 Mar 2006 02:55:59 +0100 (MET)	[thread overview]
Message-ID: <20060321015559.11977.82507.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060321015549.11977.45799.sendpatchset@localhost.localdomain>

[NETFILTER]: Fix xt_policy address matching

Fix missing inversion in address matching, it was broken during the
conversion to x_tables.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit d64ab19c8c265eb3defd20d3fa993df52542ad00
tree 2724b6ba5c06a490a1fdfa8fef7b55f05a9240d1
parent 9f037d96029cc5aad5c61969eeb52ebcb71957d5
author Patrick McHardy <kaber@trash.net> Mon, 20 Mar 2006 14:06:22 +0100
committer Patrick McHardy <kaber@trash.net> Mon, 20 Mar 2006 14:06:22 +0100

 net/netfilter/xt_policy.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/xt_policy.c b/net/netfilter/xt_policy.c
index d57a611..1099cb0 100644
--- a/net/netfilter/xt_policy.c
+++ b/net/netfilter/xt_policy.c
@@ -27,9 +27,9 @@ xt_addr_cmp(const union xt_policy_addr *
 {
 	switch (family) {
 	case AF_INET:
-		return (a1->a4.s_addr ^ a2->a4.s_addr) & m->a4.s_addr;
+		return !((a1->a4.s_addr ^ a2->a4.s_addr) & m->a4.s_addr);
 	case AF_INET6:
-		return ipv6_masked_addr_cmp(&a1->a6, &m->a6, &a2->a6);
+		return !ipv6_masked_addr_cmp(&a1->a6, &m->a6, &a2->a6);
 	}
 	return 0;
 }
@@ -44,7 +44,7 @@ match_xfrm_state(struct xfrm_state *x, c
 #define MATCH(x,y)		(!e->match.x || ((e->x == (y)) ^ e->invert.x))
 
 	return MATCH_ADDR(saddr, smask, (union xt_policy_addr *)&x->props.saddr) &&
-	       MATCH_ADDR(daddr, dmask, (union xt_policy_addr *)&x->id.daddr.a4) &&
+	       MATCH_ADDR(daddr, dmask, (union xt_policy_addr *)&x->id.daddr) &&
 	       MATCH(proto, x->id.proto) &&
 	       MATCH(mode, x->props.mode) &&
 	       MATCH(spi, x->id.spi) &&

  parent reply	other threads:[~2006-03-21  1:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-21  1:55 [NETFILTER 00/09]: Netfilter update Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 01/09]: Fix Kconfig typos Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 02/09]: ctnetlink: Fix expectaction mask dumping Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 03/09]: nfnetlink_queue: fix nfnetlink message size Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 04/09]: conntrack: cleanup the conntrack ID initialization Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 05/09]: x_tables: set the protocol family in x_tables targets/matches Patrick McHardy
2006-03-21  1:55 ` [NETFILTER 06/09]: nf_conntrack: support for layer 3 protocol load on demand Patrick McHardy
2006-03-21  1:55 ` Patrick McHardy [this message]
2006-03-21  1:56 ` [NETFILTER 08/09]: Add H.323 conntrack/NAT helper Patrick McHardy
2006-03-21  2:03   ` Patrick McHardy
2006-03-21  1:56 ` [NETFILTER 09/09]: futher {ip,ip6,arp}_tables unification Patrick McHardy
2006-03-21  2:11   ` Patrick McHardy
     [not found]     ` <200603211056.02339.dim@sw.ru>
2006-03-21  8:59       ` Patrick McHardy
2006-03-21  9:21         ` Dmitry Mishin
2006-03-21 13:12           ` Patrick McHardy
2006-03-21  2:18 ` [NETFILTER 00/09]: Netfilter update Patrick McHardy
2006-03-21  7:42   ` David S. Miller
2006-03-21  8:56     ` Patrick McHardy

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=20060321015559.11977.82507.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.