If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below. ** If you are logged in, most ads will not be displayed. **

[root@kit temp]# ethtool --show-offload eth0
Offload parameters for eth0:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: off
udp-fragmentation-offload: off
generic-segmentation-offload: on
generic-receive-offload: on
large-receive-offload: off
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off
receive-hashing: on

it seems there is checksum offloading on my machine
when the checksum is 0, why the NIC doesn't modify the checksum of the outgoing packet?

finally, packets may get modified when they are in transmission
for example, TTL will decrease by number of hops
NAT may also modify the source ip addresses,
then the checksum will be obsolete,
in these cases, how checksum works?
the router will modify the checksum accordingly?
or the destination machine can smartly detect these and calculate the checksum accordingly?

If the checksum is entirely 0 (0x0), it is ignored on UDP packets. Checksums are optional on UDP packets according to this.

Originally Posted by esolve

the router will modify the checksum accordingly?

When NAT is active it will either recalculate the checksum or zero it. What exactly the router does probably depends on the router model and firmware. IMHO a router should recalculate the checksum if the checksum is not 0 or ignore the checksum if it is 0. Maybe someone else can quote a specification here that I am not aware of.

EDIT: according to this RFC, NAT modifies the checksums on TCP packets. But I was unable to find any reference to how it should behave with UDP packets.

Originally Posted by esolve

the destination machine can smartly detect these and calculate the checksum accordingly?

Absolutely not. The destination cannot "guess" if the checksum has been modified. Either the checksum or the packet itself was somehow obstructed during transfer. The receiver cannot distinguish which one (or both) are obstructed.