[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>
This commit is contained in:

committed by
David S. Miller

parent
1ef9696c90
commit
a1e59abf82
@@ -222,6 +222,7 @@ struct xfrm_policy_afinfo {
|
||||
struct dst_ops *dst_ops;
|
||||
void (*garbage_collect)(void);
|
||||
int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl);
|
||||
int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr);
|
||||
struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy);
|
||||
int (*bundle_create)(struct xfrm_policy *policy,
|
||||
struct xfrm_state **xfrm,
|
||||
@@ -630,6 +631,18 @@ secpath_reset(struct sk_buff *skb)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int
|
||||
xfrm_addr_any(xfrm_address_t *addr, unsigned short family)
|
||||
{
|
||||
switch (family) {
|
||||
case AF_INET:
|
||||
return addr->a4 == 0;
|
||||
case AF_INET6:
|
||||
return ipv6_addr_any((struct in6_addr *)&addr->a6);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x)
|
||||
{
|
||||
|
Reference in New Issue
Block a user