new bug in iproute.c
- To: email@example.com
- Subject: new bug in iproute.c
- From: firstname.lastname@example.org (Phil R. Karn)
- Date: Tue, 19 Feb 91 21:18:13 EST
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...