Date: Thu, 11 Oct 2012 02:06:11 +0200 From: Luigi Rizzo <rizzo@iet.unipi.it> To: Gleb Smirnoff <glebius@freebsd.org> Cc: net@freebsd.org, Maxim Dounin <mdounin@mdounin.ru> Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121011000611.GA22083@onelab2.iet.unipi.it> In-Reply-To: <20121010233404.GI34622@glebius.int.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121010195842.GH34622@FreeBSD.org> <20121010222651.GR40452@mdounin.ru> <20121010233404.GI34622@glebius.int.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Oct 11, 2012 at 03:34:04AM +0400, Gleb Smirnoff wrote: > Maxim, ... > M> > @@ -504,6 +504,9 @@ > M> > if (ip->ip_id == 0) > M> > ip->ip_id = ip_newid(); > M> > > M> > + ip->ip_len = htons(ip->ip_len); > M> > + ip->ip_off = htons(ip->ip_off); > M> > + > M> > M> So the packet is expected to come into rip_output() from caller > M> with ip_len/ip_off in host byte order, right? As already > M> suggested - it would be good to add a comment explaining this. > > This is de facto standard for raw sockets in most OS-es. Byte order > in raw socket is host. And this is the same behavior we had before > the patch. So no reason for extra comments. ??? just the fact that there was a debate on this item is sufficient ground for commenting it. The fact that this is (presumably) one of the only two places (in and out on raw IP sockets ?) where ip_len and ip_off are in host format is another good reason to comment both instances. cheers luigi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121011000611.GA22083>