Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Feb 1997 01:49:00 +0000
From:      Brian Somers <brian@awfulhak.demon.co.uk>
To:        "Brian Somers" <brian@utell.co.uk>
Cc:        "Charles Mott" <cmott@srv.net>, "Julian Elischer" <julian@whistle.com>, "Eivind Eklund" <eivind@dimaga.com>, "Ari Suutari" <ari.suutari@ps.carel.fi>, hackers@freebsd.org
Subject:   Re: Single socket version of natd 
Message-ID:  <199702050149.BAA29882@awfulhak.demon.co.uk>
In-Reply-To: Your message of "Tue, 04 Feb 1997 18:37:30 GMT." <199702041837.SAA02367@ui-gate.utell.co.uk> 

next in thread | previous in thread | raw e-mail | index | archive | help
> I don't know specifically without checking the code, but I recall seeing a
> comment in the -current sources (I've just checked SNAP-961014, nothing
> about it there) about using the ip_sum to differentiate between incoming
> and outgoing packets.....  It *WAS* commented as being a HACK :(
> 
> I'll check the code out this evening when I get home (-current machine)
> and tell you.
[.....]

I was lying.  There's no such comments !

Does anyone know of a reason (besides the divert(4) man page) that the
sum on incoming packets is zero'd ?
The code says:

[.....]
        if (hlen == sizeof(struct ip)) {
                ip->ip_sum = in_cksum_hdr(ip);
        } else {
                ip->ip_sum = in_cksum(m, hlen);
        }
        if (ip->ip_sum) {
                ipstat.ips_badsum++;
                goto bad;
        }
[.....]

Is there any problems with changing this to

        u_short sum;
.....
        if (hlen == sizeof(struct ip)) {
                sum = in_cksum_hdr(ip);
        } else {
                sum = in_cksum(m, hlen);
        }
        if (sum) {
                ipstat.ips_badsum++;
                goto bad;
        }

(and updating divert(4)) ?
-- 
Brian <brian@awfulhak.demon.co.uk>, <brian@freebsd.org>
      <http://www.awfulhak.demon.co.uk/>;
Don't _EVER_ lose your sense of humour....





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