Altera_Forum
Honored Contributor
13 years agoInterNiche stack drops packets when ip_chksum field is set to 0xFFFF
For our embedded products we use the iNiche stack. We have several systems running and we see occasionally network packets being dropped by the iNiche stack. We have the impression that it is somehow related to Windows 7 machines, as we have never seen a drop of packets if an XP PC is controlling our embedded devices.
I tracked down the actual packet which is dropped. It appears in this case that the checksum of the IP header has a value of 0xffff. The standard definition of the IP header is not entirely clear to me how to handle this case. In fact the standard describes a 1-complement sum and for the end result the complement should be taken. Now for the case shown in the WireShark window below the checksum is different from the calculation of the Inter Niche stack. In file ipdemux,c function ip_rcv() the following is coded: csum = pip->ip_chksum; pip->ip_chksum = 0; hdrlen = ip_hlen(pip); tempsum = ~cksum(pip, hdrlen >> 1); iNiche stack calculates the checksum with the ip_chksum field set to zero: 4500 01e8 7304 0000 8011 0000 This word is set to zero by iNiche (see code snapshot above) C0A8 2201 C0A8 22AF ------- 1-complement sum FFFF ~FFFF = 0000 <=== This is used to compare against the checksum send in the packet which is 0xFFFF and thus fails. I found a note (see below) telling that -0 (i.e. 0xFFFF) should be used in case the checksum is +0. This is exactly what windows 7 does. This packet is dropped by InterNiche stack. Is this an error in the stack?