21 Jun
2004
21 Jun
'04
11:26 a.m.
On Mon, 21 Jun 2004, Øyvind Hvamstad wrote:
As I'm aware, there are ways to optimize this calculation for routers, as they usually only lower the ttl field, but I'm altering the ip addresses. So I guess I'll have to recalculate the whole thing?
No. The properties of the IP checksum are such that if you modify a 16-bit value in the packet the new checksum is: newsum = ~(~oldsum + ~oldvalue + newvalue) see RFC 1624. Also, if you can precompute the difference you can eliminate an addition. Zuki -- Yitzchak Gottlieb zuki@CS.Princeton.EDU