www.a00.de > tcpgroup > 1991 > msg00206

TCP-group 1991

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

new bug in iproute.c

I inadvertently introduced a bug into iproute.c a few weeks ago when I
added a performance enhancement. Instead of recalculating the IP
header checksum after decrementing the TTL field, I simply added 0x100
to the checksum. Unfortunately, this doesn't account for the
end-around carry that occurs when the high byte of the checksum is
incremented from FF to 00 hex.

The symptom is that a long burst of packets is generated with incorrect
IP checksums; the residual as displayed by the trace command is 1.
As the IP ID counter increments, the problem will seem to go away
for a while only to return later.

The fix is straightforward. In iproute.c, function ip_route(),
change the line

        ip.checksum += 0x100;


        if(((ip.checksum += 0x100) & 0xff00) == 0)
                ip.checksum++;  /* End-around carry */

I've tested this code by pinging a nearby machine over 60,000 times
without fail, so I think I've got it right now...


Document URL : http://www.a00.de/tcpgroup/1991/msg00206.php
Ralf D. Kloth, Ludwigsburg, DE (QRQ.software). < hostmaster at a00.de > [don't send spam]
Created 2004-12-21. Last modified 2004-12-21. Your visit 2021-10-24 06:38.39. Page created in 0.0138 sec.
[Go to the top of this page]   [... to the index page]