Commit 5efec5c6 authored by Yossi Kuperman's avatar Yossi Kuperman Committed by Steffen Klassert

xfrm: Fix eth_hdr(skb)->h_proto to reflect inner IP version

IPSec tunnel mode supports encapsulation of IPv4 over IPv6 and vice-versa.

The outer IP header is stripped and the inner IP inherits the original
Ethernet header. Tcpdump fails to properly decode the inner packet in
case that h_proto is different than the inner IP version.

Fix h_proto to reflect the inner IP version.
Signed-off-by: default avatarYossi Kuperman <yossiku@mellanox.com>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent aa5dd6fa
...@@ -92,6 +92,7 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -92,6 +92,7 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
skb_reset_network_header(skb); skb_reset_network_header(skb);
skb_mac_header_rebuild(skb); skb_mac_header_rebuild(skb);
eth_hdr(skb)->h_proto = skb->protocol;
err = 0; err = 0;
......
...@@ -92,6 +92,7 @@ static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -92,6 +92,7 @@ static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
skb_reset_network_header(skb); skb_reset_network_header(skb);
skb_mac_header_rebuild(skb); skb_mac_header_rebuild(skb);
eth_hdr(skb)->h_proto = skb->protocol;
err = 0; err = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment