From: Vladimir Oltean
Sent: 02 December 2021 21:40
...
quoted
Try replacing both ~ with -.
So replace:
skb->csum = ~csum_partial(start, len, ~skb->csum);
with:
skb->csum = -csum_partial(start, len, -skb->csum);
That should geneate ~0u instead 0 (if I've got my maths right).
Indeed, replacing both one's complement operations with two's complement
seems to produce correct results (consistent with old code) in all cases
that I am testing with (ICMP, TCP, UDP). Thanks!
You need to generate (or persuade Eric to generate) a patch.
I don't have the right source tree.
Any code that does ~csum_partial() is 'dubious' unless followed
by a check for 0.
The two's compliment negate save the conditional - provided the
offset of 1 can be added in earlier.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)