diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-12 02:42:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-12 18:08:52 -0500 |
commit | 7e1dc7b6f709dfc1a9ab4b320dbe723f45992693 (patch) | |
tree | db3a0ae07fb469c7f809a448bc39563f98edfec5 /net/xfrm | |
parent | 2032656e76b5355151effdff14de4a1a58643915 (diff) |
net: Use flowi4 and flowi6 in xfrm layer.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 2ecd18a106cf..1ba0258b49c7 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -59,23 +59,27 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol, | |||
59 | static inline int | 59 | static inline int |
60 | __xfrm4_selector_match(const struct xfrm_selector *sel, const struct flowi *fl) | 60 | __xfrm4_selector_match(const struct xfrm_selector *sel, const struct flowi *fl) |
61 | { | 61 | { |
62 | return addr_match(&fl->fl4_dst, &sel->daddr, sel->prefixlen_d) && | 62 | const struct flowi4 *fl4 = &fl->u.ip4; |
63 | addr_match(&fl->fl4_src, &sel->saddr, sel->prefixlen_s) && | 63 | |
64 | !((xfrm_flowi_dport(fl, &fl->u.ip4.uli) ^ sel->dport) & sel->dport_mask) && | 64 | return addr_match(&fl4->daddr, &sel->daddr, sel->prefixlen_d) && |
65 | !((xfrm_flowi_sport(fl, &fl->u.ip4.uli) ^ sel->sport) & sel->sport_mask) && | 65 | addr_match(&fl4->saddr, &sel->saddr, sel->prefixlen_s) && |
66 | (fl->flowi_proto == sel->proto || !sel->proto) && | 66 | !((xfrm_flowi_dport(fl, &fl4->uli) ^ sel->dport) & sel->dport_mask) && |
67 | (fl->flowi_oif == sel->ifindex || !sel->ifindex); | 67 | !((xfrm_flowi_sport(fl, &fl4->uli) ^ sel->sport) & sel->sport_mask) && |
68 | (fl4->flowi4_proto == sel->proto || !sel->proto) && | ||
69 | (fl4->flowi4_oif == sel->ifindex || !sel->ifindex); | ||
68 | } | 70 | } |
69 | 71 | ||
70 | static inline int | 72 | static inline int |
71 | __xfrm6_selector_match(const struct xfrm_selector *sel, const struct flowi *fl) | 73 | __xfrm6_selector_match(const struct xfrm_selector *sel, const struct flowi *fl) |
72 | { | 74 | { |
73 | return addr_match(&fl->fl6_dst, &sel->daddr, sel->prefixlen_d) && | 75 | const struct flowi6 *fl6 = &fl->u.ip6; |
74 | addr_match(&fl->fl6_src, &sel->saddr, sel->prefixlen_s) && | 76 | |
75 | !((xfrm_flowi_dport(fl, &fl->u.ip6.uli) ^ sel->dport) & sel->dport_mask) && | 77 | return addr_match(&fl6->daddr, &sel->daddr, sel->prefixlen_d) && |
76 | !((xfrm_flowi_sport(fl, &fl->u.ip6.uli) ^ sel->sport) & sel->sport_mask) && | 78 | addr_match(&fl6->saddr, &sel->saddr, sel->prefixlen_s) && |
77 | (fl->flowi_proto == sel->proto || !sel->proto) && | 79 | !((xfrm_flowi_dport(fl, &fl6->uli) ^ sel->dport) & sel->dport_mask) && |
78 | (fl->flowi_oif == sel->ifindex || !sel->ifindex); | 80 | !((xfrm_flowi_sport(fl, &fl6->uli) ^ sel->sport) & sel->sport_mask) && |
81 | (fl6->flowi6_proto == sel->proto || !sel->proto) && | ||
82 | (fl6->flowi6_oif == sel->ifindex || !sel->ifindex); | ||
79 | } | 83 | } |
80 | 84 | ||
81 | int xfrm_selector_match(const struct xfrm_selector *sel, const struct flowi *fl, | 85 | int xfrm_selector_match(const struct xfrm_selector *sel, const struct flowi *fl, |