[ixp1200] Ip checksum?

Yitzchak M. Gottlieb zuki at CS.Princeton.EDU
Mon Jun 21 11:26:57 EDT 2004


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 at CS.Princeton.EDU


More information about the ixp1200 mailing list