diff options
author | Patrick McHardy <kaber@trash.net> | 2006-03-22 16:56:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-22 16:56:33 -0500 |
commit | 81fbfd6925c064b764cb0536aed9232c7b48f6df (patch) | |
tree | 213acf4e98cde24c1899ea9b384970f3e999a9c9 | |
parent | b9f78f9fca626875af8adc0f7366a38b8e625a0e (diff) |
[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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | 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 d57a611ae0d3..1099cb005fcc 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 *a1, const union xt_policy_addr *m, | |||
27 | { | 27 | { |
28 | switch (family) { | 28 | switch (family) { |
29 | case AF_INET: | 29 | case AF_INET: |
30 | return (a1->a4.s_addr ^ a2->a4.s_addr) & m->a4.s_addr; | 30 | return !((a1->a4.s_addr ^ a2->a4.s_addr) & m->a4.s_addr); |
31 | case AF_INET6: | 31 | case AF_INET6: |
32 | return ipv6_masked_addr_cmp(&a1->a6, &m->a6, &a2->a6); | 32 | return !ipv6_masked_addr_cmp(&a1->a6, &m->a6, &a2->a6); |
33 | } | 33 | } |
34 | return 0; | 34 | return 0; |
35 | } | 35 | } |
@@ -44,7 +44,7 @@ match_xfrm_state(struct xfrm_state *x, const struct xt_policy_elem *e, | |||
44 | #define MATCH(x,y) (!e->match.x || ((e->x == (y)) ^ e->invert.x)) | 44 | #define MATCH(x,y) (!e->match.x || ((e->x == (y)) ^ e->invert.x)) |
45 | 45 | ||
46 | return MATCH_ADDR(saddr, smask, (union xt_policy_addr *)&x->props.saddr) && | 46 | return MATCH_ADDR(saddr, smask, (union xt_policy_addr *)&x->props.saddr) && |
47 | MATCH_ADDR(daddr, dmask, (union xt_policy_addr *)&x->id.daddr.a4) && | 47 | MATCH_ADDR(daddr, dmask, (union xt_policy_addr *)&x->id.daddr) && |
48 | MATCH(proto, x->id.proto) && | 48 | MATCH(proto, x->id.proto) && |
49 | MATCH(mode, x->props.mode) && | 49 | MATCH(mode, x->props.mode) && |
50 | MATCH(spi, x->id.spi) && | 50 | MATCH(spi, x->id.spi) && |