From: Bin Meng <bmeng.cn@gmail.com>
To: qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>,
Bin Meng <bin.meng@windriver.com>,
Markus Carlstedt <markus.carlstedt@windriver.com>
Subject: [PATCH v2 1/3] net: checksum: Skip fragmented IP packets
Date: Fri, 11 Dec 2020 17:35:10 +0800 [thread overview]
Message-ID: <1607679312-51325-1-git-send-email-bmeng.cn@gmail.com> (raw)
From: Markus Carlstedt <markus.carlstedt@windriver.com>
To calculate the TCP/UDP checksum we need the whole datagram. Unless
the hardware has some logic to collect all fragments before sending
the whole datagram first, it can only be done by the network stack,
which is normally the case for the NICs we have seen so far.
Skip these fragmented IP packets to avoid checksum corruption.
Signed-off-by: Markus Carlstedt <markus.carlstedt@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
(no changes since v1)
net/checksum.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/checksum.c b/net/checksum.c
index aaa4000..5cb8b2c 100644
--- a/net/checksum.c
+++ b/net/checksum.c
@@ -106,6 +106,10 @@ void net_checksum_calculate(uint8_t *data, int length)
return; /* not IPv4 */
}
+ if (IP4_IS_FRAGMENT(ip)) {
+ return; /* a fragmented IP packet */
+ }
+
ip_len = lduw_be_p(&ip->ip_len);
/* Last, check that we have enough data for the all IP frame */
--
2.7.4
next reply other threads:[~2020-12-11 9:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 9:35 Bin Meng [this message]
2020-12-11 9:35 ` [PATCH v2 2/3] net: checksum: Add IP header checksum calculation Bin Meng
2020-12-11 9:35 ` [PATCH v2 3/3] net: checksum: Introduce fine control over checksum type Bin Meng
2020-12-11 12:19 ` Cédric Le Goater
2020-12-17 5:41 ` [PATCH v2 1/3] net: checksum: Skip fragmented IP packets Bin Meng
2020-12-17 7:25 ` Jason Wang
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=1607679312-51325-1-git-send-email-bmeng.cn@gmail.com \
--to=bmeng.cn@gmail.com \
--cc=bin.meng@windriver.com \
--cc=jasowang@redhat.com \
--cc=markus.carlstedt@windriver.com \
--cc=qemu-devel@nongnu.org \
/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).