netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: avoid skb_warn_bad_offload false positives on UFO
@ 2017-08-08 18:22 Willem de Bruijn
  2017-08-09  4:39 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Willem de Bruijn @ 2017-08-08 18:22 UTC (permalink / raw)
  To: netdev; +Cc: davem, eric.dumazet, xiangxia.m.yue, Willem de Bruijn

From: Willem de Bruijn <willemb@google.com>

skb_warn_bad_offload triggers a warning when an skb enters the GSO
stack at __skb_gso_segment that does not have CHECKSUM_PARTIAL
checksum offload set.

Commit b2504a5dbef3 ("net: reduce skb_warn_bad_offload() noise")
observed that SKB_GSO_DODGY producers can trigger the check and
that passing those packets through the GSO handlers will fix it
up. But, the software UFO handler will set ip_summed to
CHECKSUM_NONE.

When __skb_gso_segment is called from the receive path, this
triggers the warning again.

Make UFO set CHECKSUM_UNNECESSARY instead of CHECKSUM_NONE. On
Tx these two are equivalent. On Rx, this better matches the
skb state (checksum computed), as CHECKSUM_NONE here means no
checksum computed.

See also this thread for context:
http://patchwork.ozlabs.org/patch/799015/

Fixes: b2504a5dbef3 ("net: reduce skb_warn_bad_offload() noise")
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
 net/core/dev.c         | 2 +-
 net/ipv4/udp_offload.c | 2 +-
 net/ipv6/udp_offload.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 8515f8fe0460..ce15a06d5558 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2739,7 +2739,7 @@ static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
 {
 	if (tx_path)
 		return skb->ip_summed != CHECKSUM_PARTIAL &&
-		       skb->ip_summed != CHECKSUM_NONE;
+		       skb->ip_summed != CHECKSUM_UNNECESSARY;
 
 	return skb->ip_summed == CHECKSUM_NONE;
 }
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 781250151d40..0932c85b42af 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -235,7 +235,7 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
 	if (uh->check == 0)
 		uh->check = CSUM_MANGLED_0;
 
-	skb->ip_summed = CHECKSUM_NONE;
+	skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 	/* If there is no outer header we can fake a checksum offload
 	 * due to the fact that we have already done the checksum in
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c
index a2267f80febb..e7d378c032cb 100644
--- a/net/ipv6/udp_offload.c
+++ b/net/ipv6/udp_offload.c
@@ -72,7 +72,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
 		if (uh->check == 0)
 			uh->check = CSUM_MANGLED_0;
 
-		skb->ip_summed = CHECKSUM_NONE;
+		skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 		/* If there is no outer header we can fake a checksum offload
 		 * due to the fact that we have already done the checksum in
-- 
2.14.0.rc1.383.gd1ce394fe2-goog

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

* Re: [PATCH net] net: avoid skb_warn_bad_offload false positives on UFO
  2017-08-08 18:22 [PATCH net] net: avoid skb_warn_bad_offload false positives on UFO Willem de Bruijn
@ 2017-08-09  4:39 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-08-09  4:39 UTC (permalink / raw)
  To: willemdebruijn.kernel; +Cc: netdev, eric.dumazet, xiangxia.m.yue, willemb

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Tue,  8 Aug 2017 14:22:55 -0400

> From: Willem de Bruijn <willemb@google.com>
> 
> skb_warn_bad_offload triggers a warning when an skb enters the GSO
> stack at __skb_gso_segment that does not have CHECKSUM_PARTIAL
> checksum offload set.
> 
> Commit b2504a5dbef3 ("net: reduce skb_warn_bad_offload() noise")
> observed that SKB_GSO_DODGY producers can trigger the check and
> that passing those packets through the GSO handlers will fix it
> up. But, the software UFO handler will set ip_summed to
> CHECKSUM_NONE.
> 
> When __skb_gso_segment is called from the receive path, this
> triggers the warning again.
> 
> Make UFO set CHECKSUM_UNNECESSARY instead of CHECKSUM_NONE. On
> Tx these two are equivalent. On Rx, this better matches the
> skb state (checksum computed), as CHECKSUM_NONE here means no
> checksum computed.
> 
> See also this thread for context:
> http://patchwork.ozlabs.org/patch/799015/
> 
> Fixes: b2504a5dbef3 ("net: reduce skb_warn_bad_offload() noise")
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Applied and queued up for -stable, thank you.

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

end of thread, other threads:[~2017-08-09  4:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-08 18:22 [PATCH net] net: avoid skb_warn_bad_offload false positives on UFO Willem de Bruijn
2017-08-09  4:39 ` 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).