netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] udp: document udp_rcv_segment special case for looped packets
@ 2020-01-29 20:20 Willem de Bruijn
  2020-01-30  9:00 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Willem de Bruijn @ 2020-01-29 20:20 UTC (permalink / raw)
  To: netdev; +Cc: davem, pabeni, Willem de Bruijn

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

Commit 6cd021a58c18a ("udp: segment looped gso packets correctly")
fixes an issue with rare udp gso multicast packets looped onto the
receive path.

The stable backport makes the narrowest change to target only these
packets, when needed. As opposed to, say, expanding __udp_gso_segment,
which is harder to reason to be free from unintended side-effects.

But the resulting code is hardly self-describing.
Document its purpose and rationale.

Signed-off-by: Willem de Bruijn <willemb@google.com>

---

Let me know if you'd prefer net-next.
---
 include/net/udp.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/net/udp.h b/include/net/udp.h
index 4a180f2a13e32..e55d5f7658075 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -476,6 +476,13 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
 	if (!inet_get_convert_csum(sk))
 		features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
 
+	/* UDP segmentation expects packets of type CHECKSUM_PARTIAL or
+	 * CHECKSUM_NONE in __udp_gso_segment. UDP GRO indeed builds partial
+	 * packets in udp_gro_complete_segment. As does UDP GSO, verified by
+	 * udp_send_skb. But when those packets are looped in dev_loopback_xmit
+	 * their ip_summed is set to CHECKSUM_UNNECESSARY. Reset in this
+	 * specific case, where PARTIAL is both correct and required.
+	 */
 	if (skb->pkt_type == PACKET_LOOPBACK)
 		skb->ip_summed = CHECKSUM_PARTIAL;
 
-- 
2.25.0.341.g760bfbb309-goog


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

* Re: [PATCH net] udp: document udp_rcv_segment special case for looped packets
  2020-01-29 20:20 [PATCH net] udp: document udp_rcv_segment special case for looped packets Willem de Bruijn
@ 2020-01-30  9:00 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-01-30  9:00 UTC (permalink / raw)
  To: willemdebruijn.kernel; +Cc: netdev, pabeni, willemb

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Wed, 29 Jan 2020 15:20:17 -0500

> From: Willem de Bruijn <willemb@google.com>
> 
> Commit 6cd021a58c18a ("udp: segment looped gso packets correctly")
> fixes an issue with rare udp gso multicast packets looped onto the
> receive path.
> 
> The stable backport makes the narrowest change to target only these
> packets, when needed. As opposed to, say, expanding __udp_gso_segment,
> which is harder to reason to be free from unintended side-effects.
> 
> But the resulting code is hardly self-describing.
> Document its purpose and rationale.
> 
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Applied, thanks for following up on this Willem.

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

end of thread, other threads:[~2020-01-30  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-29 20:20 [PATCH net] udp: document udp_rcv_segment special case for looped packets Willem de Bruijn
2020-01-30  9:00 ` 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).