* [PATCH net] xfrm: Fix eth_hdr(skb)->h_proto to reflect inner IP version
@ 2018-01-22 22:16 yossiku
2018-01-24 6:11 ` Steffen Klassert
0 siblings, 1 reply; 2+ messages in thread
From: yossiku @ 2018-01-22 22:16 UTC (permalink / raw)
To: Steffen Klassert, Herbert Xu, David S. Miller, Alexey Kuznetsov,
Hideaki YOSHIFUJI, netdev, linux-kernel
Cc: Yossi Kuperman
From: Yossi Kuperman <yossiku@mellanox.com>
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>
---
net/ipv4/xfrm4_mode_tunnel.c | 1 +
net/ipv6/xfrm6_mode_tunnel.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index e6265e2..20ca486 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -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;
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index 02556e3..dc93002 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -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;
--
2.8.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] xfrm: Fix eth_hdr(skb)->h_proto to reflect inner IP version
2018-01-22 22:16 [PATCH net] xfrm: Fix eth_hdr(skb)->h_proto to reflect inner IP version yossiku
@ 2018-01-24 6:11 ` Steffen Klassert
0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2018-01-24 6:11 UTC (permalink / raw)
To: yossiku
Cc: Herbert Xu, David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI,
netdev, linux-kernel
On Tue, Jan 23, 2018 at 12:16:21AM +0200, yossiku@mellanox.com wrote:
> From: Yossi Kuperman <yossiku@mellanox.com>
>
> 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>
Applied, thanks Yossi!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-24 6:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 22:16 [PATCH net] xfrm: Fix eth_hdr(skb)->h_proto to reflect inner IP version yossiku
2018-01-24 6:11 ` Steffen Klassert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).