From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 23:46:59 2012 Return-Path: Delivered-To: net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AA1B468B for ; Wed, 10 Oct 2012 23:46:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 1D58A8FC0A for ; Wed, 10 Oct 2012 23:46:58 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q9ANkvBF089202; Thu, 11 Oct 2012 03:46:57 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9ANkvAT089201; Thu, 11 Oct 2012 03:46:57 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 11 Oct 2012 03:46:57 +0400 From: Gleb Smirnoff To: Luigi Rizzo Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121010234657.GK34622@glebius.int.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121010195842.GH34622@FreeBSD.org> <20121010222651.GR40452@mdounin.ru> <20121010233404.GI34622@glebius.int.ru> <20121011000611.GA22083@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20121011000611.GA22083@onelab2.iet.unipi.it> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: net@FreeBSD.org, Maxim Dounin X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2012 23:46:59 -0000 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.