Subject: Re: BUGs in skb_checksum_help() and skb_gso_segment() in 2.6.18-rc2

From: Patrick McHardy <[email-masked]>
Date: Wed, 26 Jul 2006 06:01:40 +0200

Herbert Xu wrote:
> Hi Patrick:
> 
> On Wed, Jul 26, 2006 at 05:38:07AM +0200, Patrick McHardy wrote:
> 
>>I have a patch which changes netfilter to do incremental checksumming.
>>The hook number is passed to all functions doing this so they know
>>how to update the checksum. Could you explain how
>>CHECKSUM_COMPLETE/CHECKSUM_PARTIAL are going to be used? I assume
>>they're meant to avoid passing hook numbers around everywhere?
> 
> 
> Yes the hook number is another way to solve the same problem.  However,
> it can only be used within netfilter.  CHECKSUM_COMPLETE/CHECKSUM_PARTIAL
> on the other hand are valid throughout the stack.  With Xen feeding Linux
> packets into the stack the netfilter hook is also no longer sufficient to
> distinguish between these two cases as partial checksum packets can now
> appear on receive.
> 
> The problem is that you need to do different incremental updates depending
> on whether the checksum is complete (i.e., CHECKSUM_HW on receive), or
> partial (i.e., CHECKSUM_HW on transmit).
> 
> With complete checksums the current update code in netfilter can be used
> as is.  With partial checksums you need to exclude bits which weren't
> used when computing the partial checksums (e.g., TCP port numbers need
> to be excluded, but the IP address needs to be included for NAT).

That does sound better than the hook number approach.

> I have a patch that adds CHECKSUM_COMPLETE/CHECKSUM_PARTIAL if you want
> something to work from.  Let me know if you want this and I'll bounce it
> to you.

Please send it, I'll update my patch based on that. Thanks.