diff options
author | Eric Dumazet <edumazet@google.com> | 2015-12-07 11:53:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-07 17:07:33 -0500 |
commit | bd5eb35f16a9c55afcf5eb1c920cbbaf09747369 (patch) | |
tree | 04ee2f972b0b0a04efebdb79f14f391bec142170 /net/xfrm | |
parent | 69ce6487dcd364245a3d26322fc8f4ffd1e8d947 (diff) |
xfrm: take care of request sockets
TCP SYNACK messages might now be attached to request sockets.
XFRM needs to get back to a listener socket.
Adds new helpers that might be used elsewhere :
sk_to_full_sk() and sk_const_to_full_sk()
Note: We also need to add RCU protection for xfrm lookups,
now TCP/DCCP have lockless listener processing. This will
be addressed in separate patches.
Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 09bfcbac63bb..18276f0cc32b 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2198,6 +2198,7 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, | |||
2198 | xdst = NULL; | 2198 | xdst = NULL; |
2199 | route = NULL; | 2199 | route = NULL; |
2200 | 2200 | ||
2201 | sk = sk_const_to_full_sk(sk); | ||
2201 | if (sk && sk->sk_policy[XFRM_POLICY_OUT]) { | 2202 | if (sk && sk->sk_policy[XFRM_POLICY_OUT]) { |
2202 | num_pols = 1; | 2203 | num_pols = 1; |
2203 | pols[0] = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl); | 2204 | pols[0] = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl); |
@@ -2477,6 +2478,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, | |||
2477 | } | 2478 | } |
2478 | 2479 | ||
2479 | pol = NULL; | 2480 | pol = NULL; |
2481 | sk = sk_to_full_sk(sk); | ||
2480 | if (sk && sk->sk_policy[dir]) { | 2482 | if (sk && sk->sk_policy[dir]) { |
2481 | pol = xfrm_sk_policy_lookup(sk, dir, &fl); | 2483 | pol = xfrm_sk_policy_lookup(sk, dir, &fl); |
2482 | if (IS_ERR(pol)) { | 2484 | if (IS_ERR(pol)) { |