Skip to content

Commit a9b28c2

Browse files
Yossi Kupermanklassert
authored andcommitted
esp6: Fix RX checksum after header pull
Both ip6_input_finish (non-GRO) and esp6_gro_receive (GRO) strip the IPv6 header without adjusting skb->csum accordingly. As a result CHECKSUM_COMPLETE breaks and "hw csum failure" is written to the kernel log by netdev_rx_csum_fault (dev.c). Fix skb->csum by substracting the checksum value of the pulled IPv6 header using a call to skb_postpull_rcsum. This affects both transport and tunnel modes. Note that the fix occurs far from the place that the header was pulled. This is based on existing code, see: ipv6_srh_rcv() in exthdrs.c and rawv6_rcv() in raw.c Signed-off-by: Yossi Kuperman <yossiku@mellanox.com> Signed-off-by: Ilan Tayari <ilant@mellanox.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
1 parent e9cba69 commit a9b28c2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv6/esp6.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,8 @@ int esp6_input_done2(struct sk_buff *skb, int err)
495495

496496
trimlen = alen + padlen + 2;
497497
if (skb->ip_summed == CHECKSUM_COMPLETE) {
498+
skb_postpull_rcsum(skb, skb_network_header(skb),
499+
skb_network_header_len(skb));
498500
csumdiff = skb_checksum(skb, skb->len - trimlen, trimlen, 0);
499501
skb->csum = csum_block_sub(skb->csum, csumdiff,
500502
skb->len - trimlen);

0 commit comments

Comments
 (0)