Skip to content
Snippets Groups Projects
Commit 0dcf0c0a authored by Markus Carlstedt's avatar Markus Carlstedt Committed by Jason Wang
Browse files

net: checksum: Skip fragmented IP packets


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: default avatarMarkus Carlstedt <markus.carlstedt@windriver.com>
Signed-off-by: default avatarBin Meng <bin.meng@windriver.com>
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
parent 831734cc
No related branches found
No related tags found
No related merge requests found
......@@ -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 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment