Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Oct 2012 23:17:00 +0200
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        net@FreeBSD.org
Subject:   Re: [CFT/Review] net byte order for AF_INET
Message-ID:  <20121010211700.GA20319@onelab2.iet.unipi.it>
In-Reply-To: <20121010183143.GF34622@glebius.int.ru>
References:  <20121009154128.GU34622@FreeBSD.org> <20121010124637.GA15522@onelab2.iet.unipi.it> <20121010183143.GF34622@glebius.int.ru>

index | next in thread | previous in thread | raw e-mail

On Wed, Oct 10, 2012 at 10:31:43PM +0400, Gleb Smirnoff wrote:
>   Luigi,
> 
> On Wed, Oct 10, 2012 at 02:46:37PM +0200, Luigi Rizzo wrote:
> L> I am really grataful you are doing this. A few comments:
...
> L> > Index: sys/netinet/raw_ip.c
> L> > ===================================================================
> L> > --- sys/netinet/raw_ip.c	(revision 241370)
> L> > +++ sys/netinet/raw_ip.c	(working copy)
> L> > @@ -292,6 +292,7 @@
> L> >  	 * not modify the packet except for some
> L> >  	 * byte order swaps.
> L> >  	 */
> L> > +	ip->ip_len = ntohs(ip->ip_len);
> L> >  	ip->ip_len += off;
> L> >  
> L> >  	hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr,
> L> 
> L> this seems wrong, perhaps you want
> L> 
> L> -  	ip->ip_len += off;
> L> +	ip->ip_len = htons(ntohs(ip->ip_len) + off);
> 
> Maxim Dounin also noticed this. This was done intentionally, but since two
> people are in doubt, I will look closer here. Historically BSD had supplied
> host byte order in raw sockets, but I suppose, for head/ this is no longer
> true for about a year.

I was not aware of that. Then please add a comment either mentioning
that the behaviour differs from historical, or that the packet format
differs from the (new) standard kernel format in this particular case.


cheers
luigi


home | help

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