From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 14:47:46 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 DE0DAAFA; Wed, 10 Oct 2012 14:47:46 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Received: from mail-ia0-f182.google.com (mail-ia0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 90D248FC0A; Wed, 10 Oct 2012 14:47:46 +0000 (UTC) Received: by mail-ia0-f182.google.com with SMTP id k10so554002iag.13 for ; Wed, 10 Oct 2012 07:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=/pPuoLTxt8JlwTc1q3gkJywF91vcJsuhSKjr+UpUx3A=; b=sTM6cnjISYnZ27VJ/KI8qXIGkO+Q234Wn6tdDNTUtYmJNOZ3B6zixX7RCWhumModfa k52rNkRhhzrGvqTNm7f/0r/ASHaSUYrJvDKJ0yopUmKcfzIGuJe3bzM2UqMdxU8owlFE ANtFWLyqM52im+22v/KnH9YkY1YLostXInQhBLK+H9U8OzuNKbVkveYxu3KezjyVNh+E 4NErpBM+4UOr9pbQzFy0YBZLeynOPjo4U0lk+MI6rL9iIS6y+aK7vsECUV2TKCptLdFf v2YkgMpBYc1gOX5O2R9Xu+gWvFFQEaEiVHri3IpsKY2VNjK2qEBm/1zaD6FSfNm6gtfK ksIQ== Received: by 10.43.97.8 with SMTP id ci8mr18957027icc.28.1349880465922; Wed, 10 Oct 2012 07:47:45 -0700 (PDT) Received: from guysmbp.dyn.palisadesys.com ([216.81.189.9]) by mx.google.com with ESMTPS id bo7sm1288776igb.2.2012.10.10.07.47.44 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 10 Oct 2012 07:47:45 -0700 (PDT) Content-Type: text/plain; charset=koi8-r Mime-Version: 1.0 (Mac OS X Mail 6.1 \(1498\)) Subject: Re: [CFT/Review] net byte order for AF_INET From: Guy Helmer In-Reply-To: <20121009154128.GU34622@FreeBSD.org> Date: Wed, 10 Oct 2012 09:47:46 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20121009154128.GU34622@FreeBSD.org> To: Gleb Smirnoff X-Mailer: Apple Mail (2.1498) 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:47:46 -0000 On Oct 9, 2012, at 10:41 AM, Gleb Smirnoff wrote: > Hello, >=20 > this is a patch that switches entire IPv4 stack to network > byte order. That means, that at any layer any module should > expect IP header in network byte order. Any host byte order > values can be stored in local variables only and are never stored > into a packet itself. >=20 > The new code brings clarity, since a developer doesn't need to > know which byte order should he/she switch a packet to when > passing it to a particular function in stack. Also, any new > function introduced should expect net byte order for a packet > supplied. >=20 > The patch has been tested by me on amd64 and ray@ on mips. > TCP, UDP, ICMP, fragment reassembly and basic packet filtering > works okay. >=20 > More testing is desired, especially on boxes using some extensions > as packet filters with policy routing, running gre(4), ipsec(4), > divert(4), gif(4), multicast routing, stf(4), ng_ipfw(4), SCTP, etc. >=20 > Code reviewing also appreciated. It's not obvious to me, so does this change the byte order expected in = packets sent from userland via raw IP sockets? Guy