Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jan 2014 22:43:09 +0100
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        "current@freebsd.org" <current@freebsd.org>, "net@freebsd.org" <net@freebsd.org>
Subject:   Re: unused in_cksum_update() ?
Message-ID:  <20140109214309.GA51309@onelab2.iet.unipi.it>
In-Reply-To: <CAJ-VmokVngHsZLQUwkDqjHe0Waeb=5S8g1MfZ0A62HCqfTowzw@mail.gmail.com>
References:  <20140109192114.GA49934@onelab2.iet.unipi.it> <CAJ-VmokVngHsZLQUwkDqjHe0Waeb=5S8g1MfZ0A62HCqfTowzw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140109214309.GA51309>