Skip to contentSkip to conversation

Bug in pskb_trim_rcsum()

PATCH Wei Yongjun 1 participant 1 message Jul 18, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Quoted 2 lines · Herbert Xu
Quoted 1 line · Wei Yongjun

So if I want to trim a skb, I think I must do a checksum even if

the

Quoted 5 lines
Quoted 1 line

skb->ip_summed is CHECKSUM_UNNECESSARY.

Nope. CHECKSUM_UNNECESSARY means that the hardware has already verified the checksum to be correct for the given protocol. Trimming a packet does not affect it.

Yes, you are right. hardware has already verified the checksum to be correct.
But I think hardware do this:
1) calculate a checksum for the given protocol.(as the same as the
hardware which does not support verified the checksum)
2) verified the checksum.(compare protocol checksum of packet with
calculated checksum)
If that is true, Trimming a packet also affect CHECKSUM_UNNECESSARY.

And in my test, UDP under IPv4 maybe do that.
My UDP packet is:

packet1:
___________________________________

| Source Port     | Dest Port       |
|_________________|_________________|
| Length = 16     | Checksum(*1)    |
|_________________|_________________|
|             payload24             |
|___________________________________|

correct is :
___________________________________

| Source Port     | Dest Port       |
|_________________|_________________|
| Length = 32     | Checksum        |
|_________________|_________________|
|             payload24             |
|___________________________________|

Checksum(*1) is the checksum of payload24, not only the first 8 byte
of payload24.

When I send packet1 to echo-udp(target used e1000 inferface), echo-
reply can be reply. When I send packet1 to echo-udp(target used e100 inferface), echo-reply can not be reply.

In e1000, when packet1 with checksum(*1) , skb->ip_summed is set to
CHECKSUM_UNNECESSARY. And when other, skb->ip_summed is set to CHECKSUM_HW. So I think my guess is correct. Patch is necessary.

Regards