[En-Nut-Discussion] IP Checksum calculation broken. Reenabled old algorithm for the meantime.

Harald Kipp harald.kipp at egnite.de
Mon Jun 18 09:24:58 CEST 2012


H Ole,

On 17.06.2012 22:56, Ole Reinhardt wrote: 
> I just discovered that the new IP checksum calculation which was
> introduced a few month ago is broken for some situations. I could not
> find a concrete reason so far, but I think it's an alignment question.

Grrrr! This had been my third attempt to get it right. Schei__e!

Ole, which CPU did you use?

Regarding alignment: In r4028 I added a 2 byte offset to the network buffer, which aligns them to (32 + 16)-bit addresses. Due to the 14 byte Ethernet header, this aligns the IP part to a 32-bit address.


> For the meantime I defined NUT_LEGACY_IPCSUM in nut/net/ipcsum.c which
> enables the old algorithm again. With this implementation all problems
> are gone at my side...

The checksum calculation should work on any alignment. I agree, that switching back to the legacy calculation is the right way for now.


> @Harald: Do you have any ideas what I could do for better testing and
> evaluating the problem?

Testing it with network traffic is cumbersome. For testing I add the legacy and the new code to the application and call them directly with a prepared buffer.

Regards,

Harald




More information about the En-Nut-Discussion mailing list