Re: [PATCH 1/4] pch_gbe: Fix the checksum fill to the error location
From: Eric Dumazet <hidden>
Date: 2012-07-17 08:48:40
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 */
}