Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19830
b: refs/heads/master
c: 0047c65
h: refs/heads/master
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Feb 5, 2006
1 parent 769b3f7 commit 4bf1a8d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 878c41ce5747e1b417bdd92a694c33dc4bd6ec02
refs/heads/master: 0047c65a60fa3b6607b55e058ea6a89f39cb3f28
22 changes: 14 additions & 8 deletions trunk/include/linux/netfilter_ipv4/ipt_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ struct ipt_policy_spec
reqid:1;
};

union ipt_policy_addr
{
struct in_addr a4;
struct in6_addr a6;
};

struct ipt_policy_elem
{
u_int32_t saddr;
u_int32_t smask;
u_int32_t daddr;
u_int32_t dmask;
u_int32_t spi;
u_int32_t reqid;
u_int8_t proto;
u_int8_t mode;
union ipt_policy_addr saddr;
union ipt_policy_addr smask;
union ipt_policy_addr daddr;
union ipt_policy_addr dmask;
u_int32_t spi;
u_int32_t reqid;
u_int8_t proto;
u_int8_t mode;

struct ipt_policy_spec match;
struct ipt_policy_spec invert;
Expand Down
22 changes: 14 additions & 8 deletions trunk/include/linux/netfilter_ipv6/ip6t_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ struct ip6t_policy_spec
reqid:1;
};

union ip6t_policy_addr
{
struct in_addr a4;
struct in6_addr a6;
};

struct ip6t_policy_elem
{
struct in6_addr saddr;
struct in6_addr smask;
struct in6_addr daddr;
struct in6_addr dmask;
u_int32_t spi;
u_int32_t reqid;
u_int8_t proto;
u_int8_t mode;
union ip6t_policy_addr saddr;
union ip6t_policy_addr smask;
union ip6t_policy_addr daddr;
union ip6t_policy_addr dmask;
u_int32_t spi;
u_int32_t reqid;
u_int8_t proto;
u_int8_t mode;

struct ip6t_policy_spec match;
struct ip6t_policy_spec invert;
Expand Down
9 changes: 6 additions & 3 deletions trunk/net/ipv4/netfilter/ipt_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ MODULE_LICENSE("GPL");
static inline int
match_xfrm_state(struct xfrm_state *x, const struct ipt_policy_elem *e)
{
#define MATCH(x,y) (!e->match.x || ((e->x == (y)) ^ e->invert.x))
#define MATCH_ADDR(x,y,z) (!e->match.x || \
((e->x.a4.s_addr == (e->y.a4.s_addr & (z))) \
^ e->invert.x))
#define MATCH(x,y) (!e->match.x || ((e->x == (y)) ^ e->invert.x))

return MATCH(saddr, x->props.saddr.a4 & e->smask) &&
MATCH(daddr, x->id.daddr.a4 & e->dmask) &&
return MATCH_ADDR(saddr, smask, x->props.saddr.a4) &&
MATCH_ADDR(daddr, dmask, x->id.daddr.a4) &&
MATCH(proto, x->id.proto) &&
MATCH(mode, x->props.mode) &&
MATCH(spi, x->id.spi) &&
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/ipv6/netfilter/ip6t_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ MODULE_LICENSE("GPL");
static inline int
match_xfrm_state(struct xfrm_state *x, const struct ip6t_policy_elem *e)
{
#define MATCH_ADDR(x,y,z) (!e->match.x || \
((!ip6_masked_addrcmp(&e->x, &e->y, z)) \
#define MATCH_ADDR(x,y,z) (!e->match.x || \
((!ip6_masked_addrcmp(&e->x.a6, &e->y.a6, z)) \
^ e->invert.x))
#define MATCH(x,y) (!e->match.x || ((e->x == (y)) ^ e->invert.x))

Expand Down

0 comments on commit 4bf1a8d

Please sign in to comment.