From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 14:48:55 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 541CFD35 for ; Wed, 10 Oct 2012 14:48:55 +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 C10B58FC0A for ; Wed, 10 Oct 2012 14:48:54 +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 q9AEmqNY085331; Wed, 10 Oct 2012 18:48:52 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9AEmqvD085330; Wed, 10 Oct 2012 18:48:52 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 10 Oct 2012 18:48:52 +0400 From: Gleb Smirnoff To: Guy Helmer Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121010144852.GD34622@glebius.int.ru> References: <20121009154128.GU34622@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: net@FreeBSD.org 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 14:48:55 -0000 On Wed, Oct 10, 2012 at 09:47:46AM -0500, Guy Helmer wrote: G> > this is a patch that switches entire IPv4 stack to network G> > byte order. That means, that at any layer any module should G> > expect IP header in network byte order. Any host byte order G> > values can be stored in local variables only and are never stored G> > into a packet itself. G> > G> > The new code brings clarity, since a developer doesn't need to G> > know which byte order should he/she switch a packet to when G> > passing it to a particular function in stack. Also, any new G> > function introduced should expect net byte order for a packet G> > supplied. G> > G> > The patch has been tested by me on amd64 and ray@ on mips. G> > TCP, UDP, ICMP, fragment reassembly and basic packet filtering G> > works okay. G> > G> > More testing is desired, especially on boxes using some extensions G> > as packet filters with policy routing, running gre(4), ipsec(4), G> > divert(4), gif(4), multicast routing, stf(4), ng_ipfw(4), SCTP, etc. G> > G> > Code reviewing also appreciated. G> G> It's not obvious to me, so does this change the byte order expected in packets sent from userland via raw IP sockets? This should not change. -- Totus tuus, Glebius.