From: Eric Dumazet <eric.dumazet@gmail.com>
To: Zhong Hongbo <hongbo.zhong@windriver.com>
Cc: Andy Cress <andy.cress@us.kontron.com>, netdev@vger.kernel.org
Subject: Re: [PATCH 1/4] pch_gbe: Fix the checksum fill to the error location
Date: Tue, 17 Jul 2012 10:48:33 +0200 [thread overview]
Message-ID: <1342514913.2626.277.camel@edumazet-glaptop> (raw)
In-Reply-To: <50051C83.7020504@windriver.com>
On Tue, 2012-07-17 at 16:04 +0800, Zhong Hongbo wrote:
> Hi Eric,
>
> When forwarding network packages at the network layer, the variable
> value of skb->transport_header is unknown. In my test, the variable
> value of skb->transport_header is equal to skb->network_header. So
> When you count the checksum as following:
>
> offset = skb_transport_offset(skb);
>
> skb->csum = skb_checksum(skb, offset, skb->len - offset, 0);
> We should only count the TCP checksum, But it maybe include IP part.
>
> tcp_hdr(skb)->check = csum_tcpudp_magic(iph->saddr, iph->daddr,
> skb->len - offset, IPPROTO_TCP, skb->csum);
> We should fill the checksum in TCP package, But maybe fill it in other
> location and cover the useful information, such as source ip.
>
> So We should count the TCP checksum and fill it in the correct
> location. Or else the forwarding network package will be drop for the
> error checksum.
>
So maybe you should instead test
if (skb->ip_summed == CHECKSUM_PARTIAL) {
...
skb_checksum_start_offset(skb); /* is valid */
}
next prev parent reply other threads:[~2012-07-17 8:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-16 20:03 [PATCH 1/4] pch_gbe: Fix the checksum fill to the error location Andy Cress
2012-07-17 0:59 ` Paul Gortmaker
2012-07-17 7:09 ` Eric Dumazet
2012-07-17 7:33 ` Eric Dumazet
2012-07-17 14:20 ` Andy Cress
2012-07-25 20:10 ` Andy Cress
2012-08-06 14:19 ` pch_gbe: dont-copy-payload (was [PATCH 1/4] ...) Andy Cress
2012-08-06 14:52 ` Eric Dumazet
2012-07-17 8:04 ` [PATCH 1/4] pch_gbe: Fix the checksum fill to the error location Zhong Hongbo
2012-07-17 8:48 ` Eric Dumazet [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-07-09 13:30 [PATCH 1/4] pch_gbe: fix " Andy Cress
2012-07-09 20:16 ` Ben Hutchings
2012-07-10 15:28 ` Andy Cress
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=1342514913.2626.277.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=andy.cress@us.kontron.com \
--cc=hongbo.zhong@windriver.com \
--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