Netdev List
 help / color / mirror / Atom feed
From: ilant@mellanox.com
To: Steffen Klassert <steffen.klassert@secunet.com>, netdev@vger.kernel.org
Cc: Yossi Kuperman <yossiku@mellanox.com>, Ilan Tayari <ilant@mellanox.com>
Subject: [PATCH net-next 4/7] esp6: Fix RX checksum after header pull
Date: Tue,  1 Aug 2017 12:49:07 +0300	[thread overview]
Message-ID: <20170801094910.14895-5-ilant@mellanox.com> (raw)
In-Reply-To: <20170801094910.14895-1-ilant@mellanox.com>

From: Yossi Kuperman <yossiku@mellanox.com>

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>
---
 net/ipv6/esp6.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 0ca1db62e381..74bde202eb9a 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -495,6 +495,8 @@ int esp6_input_done2(struct sk_buff *skb, int err)
 
 	trimlen = alen + padlen + 2;
 	if (skb->ip_summed == CHECKSUM_COMPLETE) {
+		skb_postpull_rcsum(skb, skb_network_header(skb),
+				   skb_network_header_len(skb));
 		csumdiff = skb_checksum(skb, skb->len - trimlen, trimlen, 0);
 		skb->csum = csum_block_sub(skb->csum, csumdiff,
 					   skb->len - trimlen);
-- 
2.11.0

  parent reply	other threads:[~2017-08-01  9:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01  9:49 [PATCH net-next 0/7] IPSec offload improvements ilant
2017-08-01  9:49 ` [PATCH net-next 1/7] esp4: Support RX checksum with crypto offload ilant
2017-08-01  9:49 ` [PATCH net-next 2/7] esp6: " ilant
2017-08-01  9:49 ` [PATCH net-next 3/7] xfrm6: Fix CHECKSUM_COMPLETE after IPv6 header push ilant
2017-08-01  9:49 ` ilant [this message]
2017-08-01  9:49 ` [PATCH net-next 5/7] xfrm: Auto-load xfrm offload modules ilant
2017-08-01  9:49 ` [PATCH net-next 6/7] xfrm: Clear RX SKB secpath xfrm_offload ilant
2017-08-01  9:49 ` [PATCH net-next 7/7] net: Allow IPsec GSO for local sockets ilant
2017-08-03 11:02 ` [PATCH net-next 0/7] IPSec offload improvements Steffen Klassert

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=20170801094910.14895-5-ilant@mellanox.com \
    --to=ilant@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=yossiku@mellanox.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