From: Arvid Brodin <arvid.brodin@alten.se>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: TCP checksum problem
Date: Sat, 12 Apr 2014 02:25:53 +0200 [thread overview]
Message-ID: <53488811.2080602@alten.se> (raw)
Hi,
I'm trying to insert a 6-byte HSR header into a newly copied skb, between the ethernet header and the IP header. The skb comes from my virtual device's ndo_start_xmit() function and is to be sent on to a physical interface after modification. Essentially, this is what I'm doing:
skb = skb_copy_expand(skb, skb_headroom(skb) + HSR_HLEN, 0, GFP_ATOMIC);
/* Move ethernet header to make room for the HSR header */
src = skb_mac_header(skb);
WARN_ON_ONCE(src != skb->data);
dst = skb_push(skb, HSR_HLEN);
memmove(dst, src, ETH_HLEN);
skb_reset_mac_header(skb);
/* Fill in the 6-byte header */
hsr_fill_tag(skb, frame, port);
/* Point the skb to the physical interface */
skb->dev = port->dev;
dev_queue_xmit(skb);
But something goes wrong with the TCP checksum on the way out. Arp, ping etc works fine, but anything using TCP is discarded by the receiver due to incorrect TCP checksums.
Using wireshark and some printks, I've managed to decide that the updated TCP checksum is written offset by -6 bytes from where it should be (into what wireshark calls the TCP header "acknowledgement number" field).
Any idea why this happens? I've spent a few days on this now and I'm running out of ideas...
This is run on the cadence/macb ethernet device. Before the call to skb_copy_expand(), skb->ip_summed is CHECKSUM_PARTIAL, skb->csum_start is 120, and skb->csum_offset is 16. The total frame length is 80 bytes (on the wire as reported by wireshark - I think this is excluding the FCS).
--
Arvid Brodin | Consultant (Linux)
ALTEN | Knarrarnäsgatan 7 | SE-164 40 Kista | Sweden
arvid.brodin@alten.se | www.alten.se/en/
next reply other threads:[~2014-04-12 0:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-12 0:25 Arvid Brodin [this message]
2014-04-12 0:49 ` TCP checksum problem Eric Dumazet
2014-04-14 16:34 ` Arvid Brodin
2014-04-15 11:44 ` Jianhua Xie
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=53488811.2080602@alten.se \
--to=arvid.brodin@alten.se \
--cc=netdev@vger.kernel.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