From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Steffen Klassert <steffen.klassert@secunet.com>,
Willem de Bruijn <willemb@google.com>,
Miaohe Lin <linmiaohe@huawei.com>
Subject: [PATCH net 3/4] udp: fix outer header csum for SKB_GSO_FRAGLIST over UDP tunnel
Date: Wed, 5 May 2021 17:35:03 +0200 [thread overview]
Message-ID: <82e982530f74f7b736071f041918c22919b734d8.1620223174.git.pabeni@redhat.com> (raw)
In-Reply-To: <cover.1620223174.git.pabeni@redhat.com>
In the following scenario:
GRO -> SKB_GSO_FRAGLIST aggregation -> forward ->
xmit over UDP tunnel
SKB_GSO_FRAGLIST packet traverse an UDP tunnel in the xmit path.
The tunnel code sets up the outer header csum via udp_set_csum()
and the latter assumes that each GSO packet is CHECKSUM_PARTIAL.
Since the introduction of SKB_GSO_FRAGLIST and veth GRO, the above
assumption is not true anymore as SKB_GSO_FRAGLIST are
CHECKSUM_UNNECESSARY, and the csum for the outer header will be
left uninitialized.
All the above will cause wrong outer UDP header checksum when the
mentioned packet will be xmitted on some real NIC.
This change addresses the issue explicitly checking for both gso and
CHECKSUM_PARTIAL in udp_set_csum(), so that the mentioned packet will
be processed correctly.
Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
net/ipv4/udp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 15f5504adf5b..055fceb18bea 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -857,7 +857,7 @@ void udp_set_csum(bool nocheck, struct sk_buff *skb,
if (nocheck) {
uh->check = 0;
- } else if (skb_is_gso(skb)) {
+ } else if (skb_is_gso(skb) && skb->ip_summed == CHECKSUM_PARTIAL) {
uh->check = ~udp_v4_check(len, saddr, daddr, 0);
} else if (skb->ip_summed == CHECKSUM_PARTIAL) {
uh->check = 0;
--
2.26.2
next prev parent reply other threads:[~2021-05-05 15:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 15:35 [PATCH net 0/4] udp: more FRAGLIST fixes Paolo Abeni
2021-05-05 15:35 ` [PATCH net 1/4] net: fix double-free on fraglist GSO skbs Paolo Abeni
2021-05-05 16:13 ` Willem de Bruijn
2021-05-05 17:28 ` Paolo Abeni
2021-05-05 17:30 ` Willem de Bruijn
2021-05-06 11:06 ` Paolo Abeni
2021-05-06 14:32 ` Willem de Bruijn
2021-05-06 15:55 ` Paolo Abeni
2021-05-06 21:17 ` Jakub Kicinski
2021-05-07 8:46 ` Paolo Abeni
2021-05-10 15:37 ` Paolo Abeni
2021-05-11 9:39 ` Steffen Klassert
2021-05-05 15:35 ` [PATCH net 2/4] udp: fix out-of-bound at segmentation time Paolo Abeni
2021-05-05 15:35 ` Paolo Abeni [this message]
2021-05-05 15:35 ` [PATCH net 4/4] selftests: more UDP GRO tests Paolo Abeni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82e982530f74f7b736071f041918c22919b734d8.1620223174.git.pabeni@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linmiaohe@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).