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