aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHannes Frederic Sowa <hannes@stressinduktion.org>2013-08-18 07:47:01 -0400
committerSteffen Klassert <steffen.klassert@secunet.com>2013-08-19 03:39:04 -0400
commit844d48746e4b281a933aedc0428048a1219b42f4 (patch)
treed456114029573629bada5ee6882e89f18c42cb18 /net
parent5d0ff542d0264f61dc4bdb34eba39ffb4ea3bc23 (diff)
xfrm: choose protocol family by skb protocol
We need to choose the protocol family by skb->protocol. Otherwise we call the wrong xfrm{4,6}_local_error handler in case an ipv6 sockets is used in ipv4 mode, in which case we should call down to xfrm4_local_error (ip6 sockets are a superset of ip4 ones). We are called before before ip_output functions, so skb->protocol is not reset. Cc: Steffen Klassert <steffen.klassert@secunet.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_output.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 6f5fc612b162..3bb2cdc13b46 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -216,9 +216,17 @@ int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb)
216 216
217void xfrm_local_error(struct sk_buff *skb, int mtu) 217void xfrm_local_error(struct sk_buff *skb, int mtu)
218{ 218{
219 unsigned int proto;
219 struct xfrm_state_afinfo *afinfo; 220 struct xfrm_state_afinfo *afinfo;
220 221
221 afinfo = xfrm_state_get_afinfo(skb->sk->sk_family); 222 if (skb->protocol == htons(ETH_P_IP))
223 proto = AF_INET;
224 else if (skb->protocol == htons(ETH_P_IPV6))
225 proto = AF_INET6;
226 else
227 return;
228
229 afinfo = xfrm_state_get_afinfo(proto);
222 if (!afinfo) 230 if (!afinfo)
223 return; 231 return;
224 232