netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 1/3] ipv4: Set skb->protocol properly for local output
@ 2016-12-01  2:05 Eli Cooper
  2016-12-01  2:05 ` [PATCH net v2 2/3] ipv6: " Eli Cooper
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Eli Cooper @ 2016-12-01  2:05 UTC (permalink / raw)
  To: netdev, David S . Miller; +Cc: Eric Dumazet

When xfrm is applied to TSO/GSO packets, it follows this path:

    xfrm_output() -> xfrm_output_gso() -> skb_gso_segment()

where skb_gso_segment() relies on skb->protocol to function properly.

This patch sets skb->protocol to ETH_P_IP before dst_output() is called,
fixing a bug where GSO packets sent through a sit tunnel are dropped
when xfrm is involved.

Cc: stable@vger.kernel.org
Signed-off-by: Eli Cooper <elicooper@gmx.com>
---
v2: place the assignment before the netfilter hook

 net/ipv4/ip_output.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 105908d..877bdb0 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -107,6 +107,8 @@ int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
 	if (unlikely(!skb))
 		return 0;
 
+	skb->protocol = htons(ETH_P_IP);
+
 	return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT,
 		       net, sk, skb, NULL, skb_dst(skb)->dev,
 		       dst_output);
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net v2 2/3] ipv6: Set skb->protocol properly for local output
  2016-12-01  2:05 [PATCH net v2 1/3] ipv4: Set skb->protocol properly for local output Eli Cooper
@ 2016-12-01  2:05 ` Eli Cooper
  2016-12-02 17:34   ` David Miller
  2016-12-01  2:05 ` [PATCH net v2 3/3] Revert: "ip6_tunnel: Update skb->protocol to ETH_P_IPV6 in ip6_tnl_xmit()" Eli Cooper
  2016-12-02 17:34 ` [PATCH net v2 1/3] ipv4: Set skb->protocol properly for local output David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Eli Cooper @ 2016-12-01  2:05 UTC (permalink / raw)
  To: netdev, David S . Miller; +Cc: Eric Dumazet

When xfrm is applied to TSO/GSO packets, it follows this path:

    xfrm_output() -> xfrm_output_gso() -> skb_gso_segment()

where skb_gso_segment() relies on skb->protocol to function properly.

This patch sets skb->protocol to ETH_P_IPV6 before dst_output() is called,
fixing a bug where GSO packets sent through an ipip6 tunnel are dropped
when xfrm is involved.

Cc: stable@vger.kernel.org
Signed-off-by: Eli Cooper <elicooper@gmx.com>
---
v2: place the assignment before the netfilter hook

 net/ipv6/output_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c
index 7cca8ac..cd42523 100644
--- a/net/ipv6/output_core.c
+++ b/net/ipv6/output_core.c
@@ -155,6 +155,8 @@ int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
 	if (unlikely(!skb))
 		return 0;
 
+	skb->protocol = htons(ETH_P_IPV6);
+
 	return nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
 		       net, sk, skb, NULL, skb_dst(skb)->dev,
 		       dst_output);
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net v2 3/3] Revert: "ip6_tunnel: Update skb->protocol to ETH_P_IPV6 in ip6_tnl_xmit()"
  2016-12-01  2:05 [PATCH net v2 1/3] ipv4: Set skb->protocol properly for local output Eli Cooper
  2016-12-01  2:05 ` [PATCH net v2 2/3] ipv6: " Eli Cooper
@ 2016-12-01  2:05 ` Eli Cooper
  2016-12-02 17:35   ` David Miller
  2016-12-02 17:34 ` [PATCH net v2 1/3] ipv4: Set skb->protocol properly for local output David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Eli Cooper @ 2016-12-01  2:05 UTC (permalink / raw)
  To: netdev, David S . Miller; +Cc: Eric Dumazet

This reverts commit ae148b085876fa771d9ef2c05f85d4b4bf09ce0d
("ip6_tunnel: Update skb->protocol to ETH_P_IPV6 in ip6_tnl_xmit()").

skb->protocol is now set in __ip_local_out() and __ip6_local_out() before
dst_output() is called. It is no longer necessary to do it for each tunnel.

Cc: stable@vger.kernel.org
Signed-off-by: Eli Cooper <elicooper@gmx.com>
---
 net/ipv6/ip6_tunnel.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 0a4759b..d76674e 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1181,7 +1181,6 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
 	if (err)
 		return err;
 
-	skb->protocol = htons(ETH_P_IPV6);
 	skb_push(skb, sizeof(struct ipv6hdr));
 	skb_reset_network_header(skb);
 	ipv6h = ipv6_hdr(skb);
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2 1/3] ipv4: Set skb->protocol properly for local output
  2016-12-01  2:05 [PATCH net v2 1/3] ipv4: Set skb->protocol properly for local output Eli Cooper
  2016-12-01  2:05 ` [PATCH net v2 2/3] ipv6: " Eli Cooper
  2016-12-01  2:05 ` [PATCH net v2 3/3] Revert: "ip6_tunnel: Update skb->protocol to ETH_P_IPV6 in ip6_tnl_xmit()" Eli Cooper
@ 2016-12-02 17:34 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-12-02 17:34 UTC (permalink / raw)
  To: elicooper; +Cc: netdev, eric.dumazet

From: Eli Cooper <elicooper@gmx.com>
Date: Thu,  1 Dec 2016 10:05:10 +0800

> When xfrm is applied to TSO/GSO packets, it follows this path:
> 
>     xfrm_output() -> xfrm_output_gso() -> skb_gso_segment()
> 
> where skb_gso_segment() relies on skb->protocol to function properly.
> 
> This patch sets skb->protocol to ETH_P_IP before dst_output() is called,
> fixing a bug where GSO packets sent through a sit tunnel are dropped
> when xfrm is involved.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Eli Cooper <elicooper@gmx.com>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2 2/3] ipv6: Set skb->protocol properly for local output
  2016-12-01  2:05 ` [PATCH net v2 2/3] ipv6: " Eli Cooper
@ 2016-12-02 17:34   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-12-02 17:34 UTC (permalink / raw)
  To: elicooper; +Cc: netdev, eric.dumazet

From: Eli Cooper <elicooper@gmx.com>
Date: Thu,  1 Dec 2016 10:05:11 +0800

> When xfrm is applied to TSO/GSO packets, it follows this path:
> 
>     xfrm_output() -> xfrm_output_gso() -> skb_gso_segment()
> 
> where skb_gso_segment() relies on skb->protocol to function properly.
> 
> This patch sets skb->protocol to ETH_P_IPV6 before dst_output() is called,
> fixing a bug where GSO packets sent through an ipip6 tunnel are dropped
> when xfrm is involved.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Eli Cooper <elicooper@gmx.com>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2 3/3] Revert: "ip6_tunnel: Update skb->protocol to ETH_P_IPV6 in ip6_tnl_xmit()"
  2016-12-01  2:05 ` [PATCH net v2 3/3] Revert: "ip6_tunnel: Update skb->protocol to ETH_P_IPV6 in ip6_tnl_xmit()" Eli Cooper
@ 2016-12-02 17:35   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-12-02 17:35 UTC (permalink / raw)
  To: elicooper; +Cc: netdev, eric.dumazet

From: Eli Cooper <elicooper@gmx.com>
Date: Thu,  1 Dec 2016 10:05:12 +0800

> This reverts commit ae148b085876fa771d9ef2c05f85d4b4bf09ce0d
> ("ip6_tunnel: Update skb->protocol to ETH_P_IPV6 in ip6_tnl_xmit()").
> 
> skb->protocol is now set in __ip_local_out() and __ip6_local_out() before
> dst_output() is called. It is no longer necessary to do it for each tunnel.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Eli Cooper <elicooper@gmx.com>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-02 17:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-01  2:05 [PATCH net v2 1/3] ipv4: Set skb->protocol properly for local output Eli Cooper
2016-12-01  2:05 ` [PATCH net v2 2/3] ipv6: " Eli Cooper
2016-12-02 17:34   ` David Miller
2016-12-01  2:05 ` [PATCH net v2 3/3] Revert: "ip6_tunnel: Update skb->protocol to ETH_P_IPV6 in ip6_tnl_xmit()" Eli Cooper
2016-12-02 17:35   ` David Miller
2016-12-02 17:34 ` [PATCH net v2 1/3] ipv4: Set skb->protocol properly for local output David Miller

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).