Results 1 to 3 of 3
Thread: how is tcp/udp checksum working?
|
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
-
03-18-2013 #1
- Join Date
- May 2012
- Posts
- 98
how is tcp/udp checksum working?
and then send them to a udp server
I notice that when I put a wrong udp checksum number
the udp server doesn't accept it
but if I put all 0 on the checksum, the udp server accept it?
why?
besides, I notice a pheonomenum: checksum offloading
I checked my machine:
Code:[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
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?
thanks!!Last edited by esolve; 03-18-2013 at 11:44 PM.
-
03-20-2013 #2
- Join Date
- Sep 2012
- Location
- Nashville, TN
- Posts
- 100
I don't think UDP uses a checksum. It is a connectionless oriented protocol. TCP uses the checksum so that it can provided retransmission of packets. You will see faults as CRC errors normally.
*** NOTE ***
I actually stand corrected. After looking through cisco documentation it does use checksum but only for packet validity and to let the other host know wether or not to discard the packet.
-
03-25-2013 #3
If the checksum is entirely 0 (0x0), it is ignored on UDP packets. Checksums are optional on UDP packets according to this.
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.
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.