Skip to content

Commit 5efec5c

Browse files
Yossi Kupermanklassert
Yossi Kuperman
authored andcommitted
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: Yossi Kuperman <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent aa5dd6f commit 5efec5c

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

net/ipv4/xfrm4_mode_tunnel.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
9292

9393
skb_reset_network_header(skb);
9494
skb_mac_header_rebuild(skb);
95+
eth_hdr(skb)->h_proto = skb->protocol;
9596

9697
err = 0;
9798

net/ipv6/xfrm6_mode_tunnel.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
9292

9393
skb_reset_network_header(skb);
9494
skb_mac_header_rebuild(skb);
95+
eth_hdr(skb)->h_proto = skb->protocol;
9596

9697
err = 0;
9798

0 commit comments

Comments
 (0)