aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/xfrm.h
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-09-19 15:57:34 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 18:19:06 -0400
commita1e59abf824969554b90facd44a4ab16e265afa4 (patch)
treeb981536bbf7dde2c55e9a5223a5e31bea2c356a2 /include/net/xfrm.h
parent1ef9696c909060ccdae3ade245ca88692b49285b (diff)
[XFRM]: Fix wildcard as tunnel source
Hashing SAs by source address breaks templates with wildcards as tunnel source since the source address used for hashing/lookup is still 0/0. Move source address lookup to xfrm_tmpl_resolve_one() so we can use the real address in the lookup. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r--include/net/xfrm.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 4d6dc627df9b..11e0b1d6bd47 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -222,6 +222,7 @@ struct xfrm_policy_afinfo {
222 struct dst_ops *dst_ops; 222 struct dst_ops *dst_ops;
223 void (*garbage_collect)(void); 223 void (*garbage_collect)(void);
224 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); 224 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl);
225 int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr);
225 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); 226 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy);
226 int (*bundle_create)(struct xfrm_policy *policy, 227 int (*bundle_create)(struct xfrm_policy *policy,
227 struct xfrm_state **xfrm, 228 struct xfrm_state **xfrm,
@@ -631,6 +632,18 @@ secpath_reset(struct sk_buff *skb)
631} 632}
632 633
633static inline int 634static inline int
635xfrm_addr_any(xfrm_address_t *addr, unsigned short family)
636{
637 switch (family) {
638 case AF_INET:
639 return addr->a4 == 0;
640 case AF_INET6:
641 return ipv6_addr_any((struct in6_addr *)&addr->a6);
642 }
643 return 0;
644}
645
646static inline int
634__xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) 647__xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x)
635{ 648{
636 return (tmpl->saddr.a4 && 649 return (tmpl->saddr.a4 &&