]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
xfrm: Fix eth_hdr(skb)->h_proto to reflect inner IP version
authorYossi Kuperman <yossiku@mellanox.com>
Mon, 22 Jan 2018 22:16:21 +0000 (00:16 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Tue, 23 Jan 2018 09:56:36 +0000 (10:56 +0100)
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 <yossiku@mellanox.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/ipv4/xfrm4_mode_tunnel.c
net/ipv6/xfrm6_mode_tunnel.c

index e6265e2c274e48a54cfc08afb9fee6c9fc2ad194..20ca486b3cadf34c2e4fa6df17d44a178fbe3ddc 100644 (file)
@@ -92,6 +92,7 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
 
        skb_reset_network_header(skb);
        skb_mac_header_rebuild(skb);
+       eth_hdr(skb)->h_proto = skb->protocol;
 
        err = 0;
 
index 02556e356f87e94830e76bb6f4f519e4cf1eb4d7..dc93002ff9d1b88a9ac4ec750ae38f89c25dca73 100644 (file)
@@ -92,6 +92,7 @@ static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
 
        skb_reset_network_header(skb);
        skb_mac_header_rebuild(skb);
+       eth_hdr(skb)->h_proto = skb->protocol;
 
        err = 0;