Re: unused in_cksum_update() ?

From: Luigi Rizzo <rizzo_at_iet.unipi.it>
Date: Thu, 9 Jan 2014 22:43:09 +0100
On Thu, Jan 09, 2014 at 01:27:52PM -0800, Adrian Chadd wrote:
> It's likely used elsewhere; it's the kind of thing you abuse when
> doing header rewriting and reinjection. So, what's the NAT and such
> code using?

natd/libalias has its own code with a DifferentialChecksum() function
in sys/netinet/libalias/alias_util.c which adds and subtracts
the chunks in the old and new packet.

ip_fastfwd.c does it inline:

        /*
         * Decrement the TTL and incrementally change the IP header checksum.
         * Don't bother doing this with hw checksum offloading, it's faster
         * doing it right here.
         */
        ip->ip_ttl -= IPTTLDEC;
        if (ip->ip_sum >= (u_int16_t) ~htons(IPTTLDEC << 8))
                ip->ip_sum -= ~htons(IPTTLDEC << 8);
        else
                ip->ip_sum += htons(IPTTLDEC << 8);


ip_forward() relies on the recomputation done in ip_output().

And there is no trace of in_cksum_update() in the entire source
tree apart from its definition.

cheers
luigi
Received on Thu Jan 09 2014 - 20:40:55 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:46 UTC