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);
                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.

freebsd-current@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to