From owner-freebsd-net@FreeBSD.ORG Sun Oct 7 04:36:56 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BECDE106564A; Sun, 7 Oct 2012 04:36:56 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from outgoing.tristatelogic.com (segfault.tristatelogic.com [69.62.255.118]) by mx1.freebsd.org (Postfix) with ESMTP id 9F0AC8FC0A; Sun, 7 Oct 2012 04:36:55 +0000 (UTC) Received: from segfault-nmh-helo.tristatelogic.com (localhost [127.0.0.1]) by segfault.tristatelogic.com (Postfix) with ESMTP id 15C8A5081F; Sat, 6 Oct 2012 21:36:49 -0700 (PDT) To: rpaulo@FreeBSD.org, freebsd-net@FreeBSD.org Date: Sat, 06 Oct 2012 21:36:49 -0700 Message-ID: <8299.1349584609@tristatelogic.com> From: "Ronald F. Guilmette" Cc: Subject: Support for Intel 5100 WiFi ? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 04:36:56 -0000 Greetings, Could anybody tell me what the current status is of kernel support for Intel 5100 Wifi? It appears to have been undergoing testing in 2009, but... I have a not-too-terribly-old 8.2-release system installed on my laptop, which I am pretty sure has an Intel 5100 WifI chip, but nothing whatsoever is showing up in the dmesg output that would indicate that the kernel has noticed the presence of the 5100. Also, the man page for iwn(4) is a bit cryptic. It says: This driver requires the firmware built with the iwnfw module to work. OK, so where exactly do I get THAT? I looked in ports and I didn't see anything with that name. From owner-freebsd-net@FreeBSD.ORG Sun Oct 7 05:08:59 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33DE5106566C; Sun, 7 Oct 2012 05:08:59 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from outgoing.tristatelogic.com (segfault.tristatelogic.com [69.62.255.118]) by mx1.freebsd.org (Postfix) with ESMTP id 11E0B8FC08; Sun, 7 Oct 2012 05:08:58 +0000 (UTC) Received: from segfault-nmh-helo.tristatelogic.com (localhost [127.0.0.1]) by segfault.tristatelogic.com (Postfix) with ESMTP id 6FAB25081F; Sat, 6 Oct 2012 22:08:58 -0700 (PDT) To: rpaulo@FreeBSD.org, freebsd-net@FreeBSD.org In-Reply-To: <8299.1349584609@tristatelogic.com> Date: Sat, 06 Oct 2012 22:08:58 -0700 Message-ID: <8608.1349586538@tristatelogic.com> From: "Ronald F. Guilmette" Cc: Subject: Oops! (was: Support for Intel 5100 WiFi ?) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 05:08:59 -0000 Regarding my immediately prior mesage... NEVERMIND! I did: kldload if_iwn (based on a suggestion I found on the next) and now, of course, the thing is properly showing up as iwn0. I do still have a couple of questions though... After the kldload, I got message showing me the various data rates available for 801.11a, 802.11b, and 802.11g... up to 54Mbps on that last one, of course. However as I understand it, the Intel 5100 chip is also capable of 802.11n, and furthermore and additionally, it is allegedly dual-band, having the capability to operate in either the 2.4GHz range or in the 5Ghz range. So I'd just like to know if the driver for this chip, either in 8.2-RELEASE or in anything later, supports either 802.11n and/or the 5GHz band. Of course, I'd also like to know if there is support for 40MHz channels, and how one would go about making use of any or all of these enhanced features, if in fact they are supported by the (recent or current) driver. Thanks in advance for any info. From owner-freebsd-net@FreeBSD.ORG Sun Oct 7 08:39:55 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 748D5106564A; Sun, 7 Oct 2012 08:39:55 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mx.techwires.net (mx.techwires.net [IPv6:2001:4d88:100f:1::3]) by mx1.freebsd.org (Postfix) with ESMTP id 0E5BD8FC08; Sun, 7 Oct 2012 08:39:54 +0000 (UTC) Received: from amy.lab.techwires.net (dslb-088-067-201-095.pools.arcor-ip.net [88.67.201.95]) by mx.techwires.net (Postfix) with ESMTPSA id 6602B2942E5; Sun, 7 Oct 2012 10:39:53 +0200 (CEST) From: Bernhard Schmidt To: "Ronald F. Guilmette" Date: Sun, 7 Oct 2012 10:40:01 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.1-PRERELEASE; KDE/4.7.4; amd64; ; ) References: <8608.1349586538@tristatelogic.com> In-Reply-To: <8608.1349586538@tristatelogic.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201210071040.01104.bschmidt@techwires.net> Cc: freebsd-net@freebsd.org, rpaulo@freebsd.org Subject: Re: Oops! (was: Support for Intel 5100 WiFi ?) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 08:39:55 -0000 On Sunday 07 October 2012 07:08:58 Ronald F. Guilmette wrote: > > Regarding my immediately prior mesage... NEVERMIND! > > I did: > > kldload if_iwn > > (based on a suggestion I found on the next) and now, of course, the thing > is properly showing up as iwn0. > > I do still have a couple of questions though... > > After the kldload, I got message showing me the various data rates > available for 801.11a, 802.11b, and 802.11g... up to 54Mbps on that > last one, of course. > > However as I understand it, the Intel 5100 chip is also capable of > 802.11n, and furthermore and additionally, it is allegedly dual-band, > having the capability to operate in either the 2.4GHz range or in the > 5Ghz range. > > So I'd just like to know if the driver for this chip, either in 8.2-RELEASE > or in anything later, supports either 802.11n and/or the 5GHz band. > > Of course, I'd also like to know if there is support for 40MHz channels, > and how one would go about making use of any or all of these enhanced > features, if in fact they are supported by the (recent or current) > driver. > > Thanks in advance for any info. iwn(4) does support 11n, 5GHz and 40MHz channels. Though, it might be better to switch to 9.x as it has received many many enhancements. Using those features is rather easy, it does so by default ;) -- Bernhard From owner-freebsd-net@FreeBSD.ORG Sun Oct 7 10:38:24 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AECFA106564A for ; Sun, 7 Oct 2012 10:38:24 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay02.ispgateway.de (smtprelay02.ispgateway.de [80.67.18.14]) by mx1.freebsd.org (Postfix) with ESMTP id 399068FC0A for ; Sun, 7 Oct 2012 10:38:23 +0000 (UTC) Received: from [78.35.158.73] (helo=fabiankeil.de) by smtprelay02.ispgateway.de with esmtpsa (SSLv3:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1TKoFT-00072L-0h; Sun, 07 Oct 2012 12:38:15 +0200 Date: Sun, 7 Oct 2012 12:38:09 +0200 From: Fabian Keil To: "Ronald F. Guilmette" Message-ID: <20121007123809.4c6ab2d8@fabiankeil.de> In-Reply-To: <8608.1349586538@tristatelogic.com> References: <8299.1349584609@tristatelogic.com> <8608.1349586538@tristatelogic.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/OGsBBBqoUaGwY1W4xDkq/LJ"; protocol="application/pgp-signature" X-Df-Sender: Nzc1MDY3 Cc: freebsd-net@FreeBSD.org Subject: Re: Oops! (was: Support for Intel 5100 WiFi ?) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 10:38:25 -0000 --Sig_/OGsBBBqoUaGwY1W4xDkq/LJ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable "Ronald F. Guilmette" wrote: > After the kldload, I got message showing me the various data rates > available for 801.11a, 802.11b, and 802.11g... up to 54Mbps on that > last one, of course. >=20 > However as I understand it, the Intel 5100 chip is also capable of > 802.11n, and furthermore and additionally, it is allegedly dual-band, > having the capability to operate in either the 2.4GHz range or in the > 5Ghz range. Maybe the 11n rates are behind boot_verbose (which I have enabled), but at least on CURRENT they are included in the system messages: fk@r500 ~ $dmesg | grep iwn0: iwn0: mem 0xf4300000-0xf4301fff irq 17 at device 0.0= on pci3 iwn0: attempting to allocate 1 MSI vectors (1 supported) iwn0: using IRQ 257 for MSI iwn0: MIMO 1T2R, MoW, address 00:1e:65:25:5d:3a iwn0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps iwn0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps iwn0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbp= s 36Mbps 48Mbps 54Mbps iwn0: 1T2R iwn0: 11na MCS 20MHz iwn0: MCS 0-7: 6.5Mbps - 65Mbps iwn0: 11na MCS 20MHz SGI iwn0: MCS 0-7: 7Mbps - 72Mbps iwn0: 11na MCS 40MHz: iwn0: MCS 0-7: 13.5Mbps - 135Mbps iwn0: 11na MCS 40MHz SGI: iwn0: MCS 0-7: 15Mbps - 150Mbps iwn0: 11ng MCS 20MHz iwn0: MCS 0-7: 6.5Mbps - 65Mbps iwn0: 11ng MCS 20MHz SGI iwn0: MCS 0-7: 7Mbps - 72Mbps iwn0: 11ng MCS 40MHz: iwn0: MCS 0-7: 13.5Mbps - 135Mbps iwn0: 11ng MCS 40MHz SGI: iwn0: MCS 0-7: 15Mbps - 150Mbps Fabian --Sig_/OGsBBBqoUaGwY1W4xDkq/LJ Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlBxW5cACgkQBYqIVf93VJ0jwwCeK/T+8wii8pNmqNa/83tutGpm fsgAn1Lq5CoP/CbOAjmCMJWIdAaWAeP/ =3jfX -----END PGP SIGNATURE----- --Sig_/OGsBBBqoUaGwY1W4xDkq/LJ-- From owner-freebsd-net@FreeBSD.ORG Sun Oct 7 21:28:25 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0B6551065670 for ; Sun, 7 Oct 2012 21:28:25 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from outgoing.tristatelogic.com (segfault.tristatelogic.com [69.62.255.118]) by mx1.freebsd.org (Postfix) with ESMTP id DAD898FC14 for ; Sun, 7 Oct 2012 21:28:23 +0000 (UTC) Received: from segfault-nmh-helo.tristatelogic.com (localhost [127.0.0.1]) by segfault.tristatelogic.com (Postfix) with ESMTP id 63E555081F for ; Sun, 7 Oct 2012 14:28:23 -0700 (PDT) To: freebsd-net@freebsd.org In-Reply-To: <201210071040.01104.bschmidt@techwires.net> Date: Sun, 07 Oct 2012 14:28:23 -0700 Message-ID: <14851.1349645303@tristatelogic.com> From: "Ronald F. Guilmette" Subject: Re: Oops! (was: Support for Intel 5100 WiFi ?) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 21:28:25 -0000 In message <201210071040.01104.bschmidt@techwires.net>, Bernhard Schmidt wrote: >iwn(4) does support 11n, 5GHz and 40MHz channels. Though, it might >be better to switch to 9.x as it has received many many enhancements. OK. I suspected that might be the case. I'm glad that I asked! Is the iwn(4) driver in 9.0 pretty good. Or are there some things in 9.1-RC1 (relating to iwn) that I might possibly want/need? (I prefer to stick with official releases, if possible.) >Using those features is rather easy, it does so by default ;) OK. I want to make sure that I understand what you just said. (Please note that I was almost entirely ignorant about the standards and the current state of technology with respect to ALL of this wireless stuff up until about three weeks ago, but I have tried my best to learn since then, so bear with me here.) If I have understood you correctly, then you are saying that, with respect to the decision of whether to use or, alternatively, to not use 11n (falling back to 11g if necessary), *and* with respect to the decision to use or not use 5GHz (falling back to 2.4Ghz if necessary), *and* with respect to the decision of whether to use or not use 40GHz channels (falling back to 20MHz if necessary), the client does not get to make any of its own decisions about any of these things, and it must instead just follow the lead of whatever AP it is trying to connect to. Is that correct? Have I understood you correctly? (Forgive me. I'me really just still feeling my way through all of this stuff.) From owner-freebsd-net@FreeBSD.ORG Mon Oct 8 01:49:52 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C2524106564A; Mon, 8 Oct 2012 01:49:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 366BF8FC0A; Mon, 8 Oct 2012 01:49:52 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so3880293pad.13 for ; Sun, 07 Oct 2012 18:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=hvB0t057ve8Zpj5lebf9GxEvCAItRxw0vWhg8kGOylI=; b=K112Fpl9ODsdshXa1uIa4HvzxBMKexz3k1zuFODttrvS5JerWZbI6rckwDbuDa7ZCa /mlhdgXmNedsgleiROGxvHeLlecnsOtvwhMy6nqgm0EHSZqkCkJbQUOu0tCBELqaDi6e 8gJCq5hIKDkREy8jPJlOmipi8Hf09j84HJRXtYSpz+hvIUWiiPE9JMOGhY+5FfQMUIap Yb9HvvSg/yBPSer+Rw/0A/iO89N8y0sTWBOQ5q1Ma8B+G48Zzf/wo0hOK/1fRZrrOKO6 Ue89Ass00azTP1Xi/a0KFMLfFtzivDsPjyDoi5TeXMc0CR41ID8A9MurpQPVF9o2UyQK lBgA== MIME-Version: 1.0 Received: by 10.68.202.6 with SMTP id ke6mr48811633pbc.82.1349660991740; Sun, 07 Oct 2012 18:49:51 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.223.136 with HTTP; Sun, 7 Oct 2012 18:49:51 -0700 (PDT) In-Reply-To: <201210061002.q96A2BFf039772@svn.freebsd.org> References: <201210061002.q96A2BFf039772@svn.freebsd.org> Date: Sun, 7 Oct 2012 18:49:51 -0700 X-Google-Sender-Auth: cKyJ-P70C3x8vV0ApnymQTSXxE8 Message-ID: From: Adrian Chadd To: Gleb Smirnoff , FreeBSD Net Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r241245 - in head: . share/man/man9 sys/contrib/ipfilter/netinet sys/net sys/netinet sys/netpfil/ipfw sys/netpfil/pf sys/sys X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 01:49:52 -0000 Hi, People have been reporting this: Oct 7 18:35:19 alix kernel: in_cksum_skip: out of data by 53295 Oct 7 18:35:19 alix kernel: in_cksum_skip: out of data by 55335 Would you please investigate this, or back the patch out? Also, if this is actually due to this patch - why is it that you didn't pick it up in testing? Thanks, Adrian On 6 October 2012 03:02, Gleb Smirnoff wrote: > Author: glebius > Date: Sat Oct 6 10:02:11 2012 > New Revision: 241245 > URL: http://svn.freebsd.org/changeset/base/241245 > > Log: > A step in resolving mess with byte ordering for AF_INET. After this change: > > - All packets in NETISR_IP queue are in net byte order. > - ip_input() is entered in net byte order and converts packet > to host byte order right _after_ processing pfil(9) hooks. > - ip_output() is entered in host byte order and converts packet > to net byte order right _before_ processing pfil(9) hooks. > - ip_fragment() accepts and emits packet in net byte order. > - ip_forward(), ip_mloopback() use host byte order (untouched actually). > - ip_fastforward() no longer modifies packet at all (except ip_ttl). > - Swapping of byte order there and back removed from the following modules: > pf(4), ipfw(4), enc(4), if_bridge(4). > - Swapping of byte order added to ipfilter(4), based on __FreeBSD_version > - __FreeBSD_version bumped. > - pfil(9) manual page updated. > > Reviewed by: ray, luigi, eri, melifaro > Tested by: glebius (LE), ray (BE) > > Modified: > head/UPDATING > head/share/man/man9/pfil.9 > head/sys/contrib/ipfilter/netinet/fil.c > head/sys/net/if_bridge.c > head/sys/net/if_enc.c > head/sys/netinet/ip_fastfwd.c > head/sys/netinet/ip_input.c > head/sys/netinet/ip_output.c > head/sys/netpfil/ipfw/ip_fw_pfil.c > head/sys/netpfil/pf/pf_ioctl.c > head/sys/sys/param.h > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Sat Oct 6 07:06:57 2012 (r241244) > +++ head/UPDATING Sat Oct 6 10:02:11 2012 (r241245) > @@ -24,6 +24,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20121006: > + The pfil(9) API/ABI for AF_INET family has been changed. Packet > + filtering modules: pf(4), ipfw(4), ipfilter(4) need to be recompiled > + with new kernel. > + > 20121001: > The net80211(4) ABI has been changed to allow for improved driver > PS-POLL and power-save support. All wireless drivers need to be > > Modified: head/share/man/man9/pfil.9 > ============================================================================== > --- head/share/man/man9/pfil.9 Sat Oct 6 07:06:57 2012 (r241244) > +++ head/share/man/man9/pfil.9 Sat Oct 6 10:02:11 2012 (r241245) > @@ -28,7 +28,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd September 16, 2012 > +.Dd October 6, 2012 > .Dt PFIL 9 > .Os > .Sh NAME > @@ -127,10 +127,9 @@ Currently, filtering points are implemen > .Pp > .Bl -tag -width "AF_INET6" -offset XXX -compact > .It AF_INET > +IPv4 packets. > .It AF_INET6 > -IPv4 and IPv6 packets. Note that packet header is already > -.Cm converted to host format. > -Host format has to be preserved in case of header modifications. > +IPv6 packets. > .It AF_LINK > Link-layer packets. > .El > > Modified: head/sys/contrib/ipfilter/netinet/fil.c > ============================================================================== > --- head/sys/contrib/ipfilter/netinet/fil.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/contrib/ipfilter/netinet/fil.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -2513,7 +2513,7 @@ int out; > } else > #endif > { > -#if (defined(OpenBSD) && (OpenBSD >= 200311)) && defined(_KERNEL) > +#if ((defined(OpenBSD) && (OpenBSD >= 200311)) || (defined(FreeBSD) && (__FreeBSD_version >= 1000019))) && defined(_KERNEL) > ip->ip_len = ntohs(ip->ip_len); > ip->ip_off = ntohs(ip->ip_off); > #endif > @@ -2777,7 +2777,7 @@ finished: > RWLOCK_EXIT(&ipf_global); > > #ifdef _KERNEL > -# if (defined(OpenBSD) && (OpenBSD >= 200311)) > +# if (defined(OpenBSD) && (OpenBSD >= 200311)) || (defined(FreeBSD) && (__FreeBSD_version >= 1000019)) > if (FR_ISPASS(pass) && (v == 4)) { > ip = fin->fin_ip; > ip->ip_len = ntohs(ip->ip_len); > > Modified: head/sys/net/if_bridge.c > ============================================================================== > --- head/sys/net/if_bridge.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/net/if_bridge.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -3093,15 +3093,6 @@ bridge_pfil(struct mbuf **mp, struct ifn > switch (ether_type) { > case ETHERTYPE_IP: > /* > - * before calling the firewall, swap fields the same as > - * IP does. here we assume the header is contiguous > - */ > - ip = mtod(*mp, struct ip *); > - > - ip->ip_len = ntohs(ip->ip_len); > - ip->ip_off = ntohs(ip->ip_off); > - > - /* > * Run pfil on the member interface and the bridge, both can > * be skipped by clearing pfil_member or pfil_bridge. > * > @@ -3139,7 +3130,7 @@ bridge_pfil(struct mbuf **mp, struct ifn > } > } > > - /* Recalculate the ip checksum and restore byte ordering */ > + /* Recalculate the ip checksum. */ > ip = mtod(*mp, struct ip *); > hlen = ip->ip_hl << 2; > if (hlen < sizeof(struct ip)) > @@ -3151,8 +3142,6 @@ bridge_pfil(struct mbuf **mp, struct ifn > if (ip == NULL) > goto bad; > } > - ip->ip_len = htons(ip->ip_len); > - ip->ip_off = htons(ip->ip_off); > ip->ip_sum = 0; > if (hlen == sizeof(struct ip)) > ip->ip_sum = in_cksum_hdr(ip); > > Modified: head/sys/net/if_enc.c > ============================================================================== > --- head/sys/net/if_enc.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/net/if_enc.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -270,23 +270,8 @@ ipsec_filter(struct mbuf **mp, int dir, > switch (ip->ip_v) { > #ifdef INET > case 4: > - /* > - * before calling the firewall, swap fields the same as > - * IP does. here we assume the header is contiguous > - */ > - ip->ip_len = ntohs(ip->ip_len); > - ip->ip_off = ntohs(ip->ip_off); > - > error = pfil_run_hooks(&V_inet_pfil_hook, mp, > encif, dir, NULL); > - > - if (*mp == NULL || error != 0) > - break; > - > - /* restore byte ordering */ > - ip = mtod(*mp, struct ip *); > - ip->ip_len = htons(ip->ip_len); > - ip->ip_off = htons(ip->ip_off); > break; > #endif > #ifdef INET6 > > Modified: head/sys/netinet/ip_fastfwd.c > ============================================================================== > --- head/sys/netinet/ip_fastfwd.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/netinet/ip_fastfwd.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -164,7 +164,7 @@ ip_fastforward(struct mbuf *m) > struct sockaddr_in *dst = NULL; > struct ifnet *ifp; > struct in_addr odest, dest; > - u_short sum, ip_len; > + uint16_t sum, ip_len, ip_off; > int error = 0; > int hlen, mtu; > #ifdef IPFIREWALL_FORWARD > @@ -340,12 +340,6 @@ ip_fastforward(struct mbuf *m) > * Step 3: incoming packet firewall processing > */ > > - /* > - * Convert to host representation > - */ > - ip->ip_len = ntohs(ip->ip_len); > - ip->ip_off = ntohs(ip->ip_off); > - > odest.s_addr = dest.s_addr = ip->ip_dst.s_addr; > > /* > @@ -472,8 +466,6 @@ passin: > forwardlocal: > /* > * Return packet for processing by ip_input(). > - * Keep host byte order as expected at ip_input's > - * "ours"-label. > */ > m->m_flags |= M_FASTFWD_OURS; > if (ro.ro_rt) > @@ -500,6 +492,8 @@ passout: > /* > * Step 6: send off the packet > */ > + ip_len = ntohs(ip->ip_len); > + ip_off = ntohs(ip->ip_off); > > /* > * Check if route is dampned (when ARP is unable to resolve) > @@ -515,7 +509,7 @@ passout: > /* > * Check if there is enough space in the interface queue > */ > - if ((ifp->if_snd.ifq_len + ip->ip_len / ifp->if_mtu + 1) >= > + if ((ifp->if_snd.ifq_len + ip_len / ifp->if_mtu + 1) >= > ifp->if_snd.ifq_maxlen) { > IPSTAT_INC(ips_odropped); > /* would send source quench here but that is depreciated */ > @@ -539,13 +533,8 @@ passout: > else > mtu = ifp->if_mtu; > > - if (ip->ip_len <= mtu || > - (ifp->if_hwassist & CSUM_FRAGMENT && (ip->ip_off & IP_DF) == 0)) { > - /* > - * Restore packet header fields to original values > - */ > - ip->ip_len = htons(ip->ip_len); > - ip->ip_off = htons(ip->ip_off); > + if (ip_len <= mtu || > + (ifp->if_hwassist & CSUM_FRAGMENT && (ip_off & IP_DF) == 0)) { > /* > * Send off the packet via outgoing interface > */ > @@ -555,7 +544,7 @@ passout: > /* > * Handle EMSGSIZE with icmp reply needfrag for TCP MTU discovery > */ > - if (ip->ip_off & IP_DF) { > + if (ip_off & IP_DF) { > IPSTAT_INC(ips_cantfrag); > icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, > 0, mtu); > @@ -565,10 +554,6 @@ passout: > * We have to fragment the packet > */ > m->m_pkthdr.csum_flags |= CSUM_IP; > - /* > - * ip_fragment expects ip_len and ip_off in host byte > - * order but returns all packets in network byte order > - */ > if (ip_fragment(ip, &m, mtu, ifp->if_hwassist, > (~ifp->if_hwassist & CSUM_DELAY_IP))) { > goto drop; > > Modified: head/sys/netinet/ip_input.c > ============================================================================== > --- head/sys/netinet/ip_input.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/netinet/ip_input.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -380,20 +380,18 @@ ip_input(struct mbuf *m) > struct ifaddr *ifa; > struct ifnet *ifp; > int checkif, hlen = 0; > - u_short sum; > + uint16_t sum, ip_len; > int dchg = 0; /* dest changed after fw */ > struct in_addr odst; /* original dst address */ > > M_ASSERTPKTHDR(m); > > if (m->m_flags & M_FASTFWD_OURS) { > - /* > - * Firewall or NAT changed destination to local. > - * We expect ip_len and ip_off to be in host byte order. > - */ > m->m_flags &= ~M_FASTFWD_OURS; > /* Set up some basics that will be used later. */ > ip = mtod(m, struct ip *); > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > hlen = ip->ip_hl << 2; > goto ours; > } > @@ -458,15 +456,11 @@ ip_input(struct mbuf *m) > return; > #endif > > - /* > - * Convert fields to host representation. > - */ > - ip->ip_len = ntohs(ip->ip_len); > - if (ip->ip_len < hlen) { > + ip_len = ntohs(ip->ip_len); > + if (ip_len < hlen) { > IPSTAT_INC(ips_badlen); > goto bad; > } > - ip->ip_off = ntohs(ip->ip_off); > > /* > * Check that the amount of data in the buffers > @@ -474,17 +468,17 @@ ip_input(struct mbuf *m) > * Trim mbufs if longer than we expect. > * Drop packet if shorter than we expect. > */ > - if (m->m_pkthdr.len < ip->ip_len) { > + if (m->m_pkthdr.len < ip_len) { > tooshort: > IPSTAT_INC(ips_tooshort); > goto bad; > } > - if (m->m_pkthdr.len > ip->ip_len) { > + if (m->m_pkthdr.len > ip_len) { > if (m->m_len == m->m_pkthdr.len) { > - m->m_len = ip->ip_len; > - m->m_pkthdr.len = ip->ip_len; > + m->m_len = ip_len; > + m->m_pkthdr.len = ip_len; > } else > - m_adj(m, ip->ip_len - m->m_pkthdr.len); > + m_adj(m, ip_len - m->m_pkthdr.len); > } > #ifdef IPSEC > /* > @@ -519,6 +513,8 @@ tooshort: > #ifdef IPFIREWALL_FORWARD > if (m->m_flags & M_FASTFWD_OURS) { > m->m_flags &= ~M_FASTFWD_OURS; > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > goto ours; > } > if ((dchg = (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL)) != 0) { > @@ -527,6 +523,8 @@ tooshort: > * packets originally destined to us to some other directly > * connected host. > */ > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > ip_forward(m, dchg); > return; > } > @@ -534,6 +532,13 @@ tooshort: > > passin: > /* > + * From now and up to output pfil(9) processing in ip_output() > + * the header is in host byte order. > + */ > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > + > + /* > * Process options and, if not destined for us, > * ship it on. ip_dooptions returns 1 when an > * error was detected (causing an icmp message > @@ -1360,6 +1365,8 @@ u_char inetctlerrmap[PRC_NCMDS] = { > * > * The srcrt parameter indicates whether the packet is being forwarded > * via a source route. > + * > + * IP header in host byte order. > */ > void > ip_forward(struct mbuf *m, int srcrt) > > Modified: head/sys/netinet/ip_output.c > ============================================================================== > --- head/sys/netinet/ip_output.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/netinet/ip_output.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -125,7 +125,8 @@ ip_output(struct mbuf *m, struct mbuf *o > int error = 0; > struct sockaddr_in *dst; > struct in_ifaddr *ia; > - int isbroadcast, sw_csum; > + int isbroadcast; > + uint16_t ip_len, ip_off, sw_csum; > struct route iproute; > struct rtentry *rte; /* cache for ro->ro_rt */ > struct in_addr odst; > @@ -501,6 +502,12 @@ sendit: > hlen = ip->ip_hl << 2; > #endif /* IPSEC */ > > + /* > + * To network byte order. pfil(9) hooks and ip_fragment() expect this. > + */ > + ip->ip_len = htons(ip->ip_len); > + ip->ip_off = htons(ip->ip_off); > + > /* Jump over all PFIL processing if hooks are not active. */ > if (!PFIL_HOOKED(&V_inet_pfil_hook)) > goto passout; > @@ -537,6 +544,8 @@ sendit: > } else { > if (ia != NULL) > ifa_free(&ia->ia_ifa); > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > goto again; /* Redo the routing table lookup. */ > } > } > @@ -570,11 +579,16 @@ sendit: > m_tag_delete(m, fwd_tag); > if (ia != NULL) > ifa_free(&ia->ia_ifa); > + ip->ip_len = ntohs(ip->ip_len); > + ip->ip_off = ntohs(ip->ip_off); > goto again; > } > #endif /* IPFIREWALL_FORWARD */ > > passout: > + ip_len = ntohs(ip->ip_len); > + ip_off = ntohs(ip->ip_off); > + > /* 127/8 must not appear on wire - RFC1122. */ > if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || > (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { > @@ -603,11 +617,9 @@ passout: > * If small enough for interface, or the interface will take > * care of the fragmentation for us, we can just send directly. > */ > - if (ip->ip_len <= mtu || > + if (ip_len <= mtu || > (m->m_pkthdr.csum_flags & ifp->if_hwassist & CSUM_TSO) != 0 || > - ((ip->ip_off & IP_DF) == 0 && (ifp->if_hwassist & CSUM_FRAGMENT))) { > - ip->ip_len = htons(ip->ip_len); > - ip->ip_off = htons(ip->ip_off); > + ((ip_off & IP_DF) == 0 && (ifp->if_hwassist & CSUM_FRAGMENT))) { > ip->ip_sum = 0; > if (sw_csum & CSUM_DELAY_IP) > ip->ip_sum = in_cksum(m, hlen); > @@ -641,7 +653,7 @@ passout: > } > > /* Balk when DF bit is set or the interface didn't support TSO. */ > - if ((ip->ip_off & IP_DF) || (m->m_pkthdr.csum_flags & CSUM_TSO)) { > + if ((ip_off & IP_DF) || (m->m_pkthdr.csum_flags & CSUM_TSO)) { > error = EMSGSIZE; > IPSTAT_INC(ips_cantfrag); > goto bad; > @@ -710,8 +722,12 @@ ip_fragment(struct ip *ip, struct mbuf * > int firstlen; > struct mbuf **mnext; > int nfrags; > + uint16_t ip_len, ip_off; > + > + ip_len = ntohs(ip->ip_len); > + ip_off = ntohs(ip->ip_off); > > - if (ip->ip_off & IP_DF) { /* Fragmentation not allowed */ > + if (ip_off & IP_DF) { /* Fragmentation not allowed */ > IPSTAT_INC(ips_cantfrag); > return EMSGSIZE; > } > @@ -785,7 +801,7 @@ smart_frag_failure: > * The fragments are linked off the m_nextpkt of the original > * packet, which after processing serves as the first fragment. > */ > - for (nfrags = 1; off < ip->ip_len; off += len, nfrags++) { > + for (nfrags = 1; off < ip_len; off += len, nfrags++) { > struct ip *mhip; /* ip header on the fragment */ > struct mbuf *m; > int mhlen = sizeof (struct ip); > @@ -811,10 +827,10 @@ smart_frag_failure: > mhip->ip_hl = mhlen >> 2; > } > m->m_len = mhlen; > - /* XXX do we need to add ip->ip_off below ? */ > - mhip->ip_off = ((off - hlen) >> 3) + ip->ip_off; > - if (off + len >= ip->ip_len) { /* last fragment */ > - len = ip->ip_len - off; > + /* XXX do we need to add ip_off below ? */ > + mhip->ip_off = ((off - hlen) >> 3) + ip_off; > + if (off + len >= ip_len) { /* last fragment */ > + len = ip_len - off; > m->m_flags |= M_LASTFRAG; > } else > mhip->ip_off |= IP_MF; > @@ -849,11 +865,10 @@ smart_frag_failure: > * Update first fragment by trimming what's been copied out > * and updating header. > */ > - m_adj(m0, hlen + firstlen - ip->ip_len); > + m_adj(m0, hlen + firstlen - ip_len); > m0->m_pkthdr.len = hlen + firstlen; > ip->ip_len = htons((u_short)m0->m_pkthdr.len); > - ip->ip_off |= IP_MF; > - ip->ip_off = htons(ip->ip_off); > + ip->ip_off = htons(ip_off | IP_MF); > ip->ip_sum = 0; > if (sw_csum & CSUM_DELAY_IP) > ip->ip_sum = in_cksum(m0, hlen); > @@ -1279,6 +1294,8 @@ ip_ctloutput(struct socket *so, struct s > * calls the output routine of the loopback "driver", but with an interface > * pointer that might NOT be a loopback interface -- evil, but easier than > * replicating that code here. > + * > + * IP header in host byte order. > */ > static void > ip_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in *dst, > > Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c > ============================================================================== > --- head/sys/netpfil/ipfw/ip_fw_pfil.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/netpfil/ipfw/ip_fw_pfil.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -125,10 +125,6 @@ ipfw_check_packet(void *arg, struct mbuf > int ipfw; > int ret; > > - /* all the processing now uses ip_len in net format */ > - if (mtod(*m0, struct ip *)->ip_v == 4) > - SET_NET_IPLEN(mtod(*m0, struct ip *)); > - > /* convert dir to IPFW values */ > dir = (dir == PFIL_IN) ? DIR_IN : DIR_OUT; > bzero(&args, sizeof(args)); > @@ -288,8 +284,7 @@ again: > FREE_PKT(*m0); > *m0 = NULL; > } > - if (*m0 && mtod(*m0, struct ip *)->ip_v == 4) > - SET_HOST_IPLEN(mtod(*m0, struct ip *)); > + > return ret; > } > > > Modified: head/sys/netpfil/pf/pf_ioctl.c > ============================================================================== > --- head/sys/netpfil/pf/pf_ioctl.c Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/netpfil/pf/pf_ioctl.c Sat Oct 6 10:02:11 2012 (r241245) > @@ -3473,23 +3473,8 @@ static int > pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > struct inpcb *inp) > { > - /* > - * XXX Wed Jul 9 22:03:16 2003 UTC > - * OpenBSD has changed its byte ordering convention on ip_len/ip_off > - * in network stack. OpenBSD's network stack have converted > - * ip_len/ip_off to host byte order frist as FreeBSD. > - * Now this is not true anymore , so we should convert back to network > - * byte order. > - */ > - struct ip *h = NULL; > int chk; > > - if ((*m)->m_pkthdr.len >= (int)sizeof(struct ip)) { > - /* if m_pkthdr.len is less than ip header, pf will handle. */ > - h = mtod(*m, struct ip *); > - HTONS(h->ip_len); > - HTONS(h->ip_off); > - } > CURVNET_SET(ifp->if_vnet); > chk = pf_test(PF_IN, ifp, m, inp); > CURVNET_RESTORE(); > @@ -3497,28 +3482,14 @@ pf_check_in(void *arg, struct mbuf **m, > m_freem(*m); > *m = NULL; > } > - if (*m != NULL) { > - /* pf_test can change ip header location */ > - h = mtod(*m, struct ip *); > - NTOHS(h->ip_len); > - NTOHS(h->ip_off); > - } > - return chk; > + > + return (chk); > } > > static int > pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > struct inpcb *inp) > { > - /* > - * XXX Wed Jul 9 22:03:16 2003 UTC > - * OpenBSD has changed its byte ordering convention on ip_len/ip_off > - * in network stack. OpenBSD's network stack have converted > - * ip_len/ip_off to host byte order frist as FreeBSD. > - * Now this is not true anymore , so we should convert back to network > - * byte order. > - */ > - struct ip *h = NULL; > int chk; > > /* We need a proper CSUM befor we start (s. OpenBSD ip_output) */ > @@ -3526,12 +3497,7 @@ pf_check_out(void *arg, struct mbuf **m, > in_delayed_cksum(*m); > (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; > } > - if ((*m)->m_pkthdr.len >= (int)sizeof(*h)) { > - /* if m_pkthdr.len is less than ip header, pf will handle. */ > - h = mtod(*m, struct ip *); > - HTONS(h->ip_len); > - HTONS(h->ip_off); > - } > + > CURVNET_SET(ifp->if_vnet); > chk = pf_test(PF_OUT, ifp, m, inp); > CURVNET_RESTORE(); > @@ -3539,13 +3505,8 @@ pf_check_out(void *arg, struct mbuf **m, > m_freem(*m); > *m = NULL; > } > - if (*m != NULL) { > - /* pf_test can change ip header location */ > - h = mtod(*m, struct ip *); > - NTOHS(h->ip_len); > - NTOHS(h->ip_off); > - } > - return chk; > + > + return (chk); > } > #endif > > @@ -3554,10 +3515,6 @@ static int > pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > struct inpcb *inp) > { > - > - /* > - * IPv6 is not affected by ip_len/ip_off byte order changes. > - */ > int chk; > > /* > @@ -3579,9 +3536,6 @@ static int > pf_check6_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, > struct inpcb *inp) > { > - /* > - * IPv6 does not affected ip_len/ip_off byte order changes. > - */ > int chk; > > /* We need a proper CSUM before we start (s. OpenBSD ip_output) */ > > Modified: head/sys/sys/param.h > ============================================================================== > --- head/sys/sys/param.h Sat Oct 6 07:06:57 2012 (r241244) > +++ head/sys/sys/param.h Sat Oct 6 10:02:11 2012 (r241245) > @@ -58,7 +58,7 @@ > * in the range 5 to 9. > */ > #undef __FreeBSD_version > -#define __FreeBSD_version 1000018 /* Master, propagated to newvers */ > +#define __FreeBSD_version 1000019 /* Master, propagated to newvers */ > > /* > * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-freebsd-net@FreeBSD.ORG Mon Oct 8 03:20:17 2012 Return-Path: Delivered-To: freebsd-net@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE898106566B; Mon, 8 Oct 2012 03:20:17 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 822A08FC14; Mon, 8 Oct 2012 03:20:17 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q983KHUw055053; Mon, 8 Oct 2012 03:20:17 GMT (envelope-from linimon@freefall.freebsd.org) Received: (from linimon@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q983KHc2055049; Mon, 8 Oct 2012 03:20:17 GMT (envelope-from linimon) Date: Mon, 8 Oct 2012 03:20:17 GMT Message-Id: <201210080320.q983KHc2055049@freefall.freebsd.org> To: linimon@FreeBSD.org, freebsd-i386@FreeBSD.org, freebsd-net@FreeBSD.org From: linimon@FreeBSD.org Cc: Subject: Re: kern/171531: [ndis] undocumented dependency for ndis(4) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 03:20:17 -0000 Old Synopsis: undocumented depencecy for ndi(4) New Synopsis: [ndis] undocumented dependency for ndis(4) Responsible-Changed-From-To: freebsd-i386->freebsd-net Responsible-Changed-By: linimon Responsible-Changed-When: Mon Oct 8 03:18:58 UTC 2012 Responsible-Changed-Why: Over to maintainer(s). http://www.freebsd.org/cgi/query-pr.cgi?pr=171531 From owner-freebsd-net@FreeBSD.ORG Mon Oct 8 05:04:22 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33973106575A; Mon, 8 Oct 2012 05:04:22 +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 9E6F58FC14; Mon, 8 Oct 2012 05:04:21 +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 q9854K6I066739; Mon, 8 Oct 2012 09:04:20 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9854Kv6066738; Mon, 8 Oct 2012 09:04:20 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 8 Oct 2012 09:04:20 +0400 From: Gleb Smirnoff To: Adrian Chadd Message-ID: <20121008050420.GO34622@FreeBSD.org> References: <201210061002.q96A2BFf039772@svn.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: svn-src-head@FreeBSD.org, FreeBSD Net , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r241245 - in head: . share/man/man9 sys/contrib/ipfilter/netinet sys/net sys/netinet sys/netpfil/ipfw sys/netpfil/pf sys/sys X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 05:04:22 -0000 On Sun, Oct 07, 2012 at 06:49:51PM -0700, Adrian Chadd wrote: A> Hi, A> A> People have been reporting this: A> A> A> Oct 7 18:35:19 alix kernel: in_cksum_skip: out of data by 53295 A> Oct 7 18:35:19 alix kernel: in_cksum_skip: out of data by 55335 A> A> Would you please investigate this, or back the patch out? I'm working on it. A> Also, if this is actually due to this patch - why is it that you A> didn't pick it up in testing? Because this debugging printf is only on i386, not on amd64. -- Totus tuus, Glebius. From owner-freebsd-net@FreeBSD.ORG Mon Oct 8 06:56:53 2012 Return-Path: Delivered-To: freebsd-net@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 51597106564A; Mon, 8 Oct 2012 06:56:53 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 242B68FC14; Mon, 8 Oct 2012 06:56:53 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q986urxG087503; Mon, 8 Oct 2012 06:56:53 GMT (envelope-from yongari@freefall.freebsd.org) Received: (from yongari@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q986urJE087499; Mon, 8 Oct 2012 06:56:53 GMT (envelope-from yongari) Date: Mon, 8 Oct 2012 06:56:53 GMT Message-Id: <201210080656.q986urJE087499@freefall.freebsd.org> To: yongari@FreeBSD.org, freebsd-net@FreeBSD.org, yongari@FreeBSD.org From: yongari@FreeBSD.org Cc: Subject: Re: kern/171825: [ale] [patch] ale driver msix setup typo X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 06:56:53 -0000 Synopsis: [ale] [patch] ale driver msix setup typo Responsible-Changed-From-To: freebsd-net->yongari Responsible-Changed-By: yongari Responsible-Changed-When: Mon Oct 8 06:56:31 UTC 2012 Responsible-Changed-Why: Grab. http://www.freebsd.org/cgi/query-pr.cgi?pr=171825 From owner-freebsd-net@FreeBSD.ORG Mon Oct 8 11:07:24 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7895106566B for ; Mon, 8 Oct 2012 11:07:24 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id BF6CD8FC1C for ; Mon, 8 Oct 2012 11:07:24 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q98B7O8k029406 for ; Mon, 8 Oct 2012 11:07:24 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q98B7Ol9029404 for freebsd-net@FreeBSD.org; Mon, 8 Oct 2012 11:07:24 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 8 Oct 2012 11:07:24 GMT Message-Id: <201210081107.q98B7Ol9029404@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-net@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-net@FreeBSD.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 11:07:24 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/172364 net [cxbge] cxbge_vlan_config() Fatal trap 12: page fault o kern/172113 net [panic] [e1000] [patch] 9.1-RC1/amd64 panices in igb(4 o kern/171840 net [ip6] IPv6 packets transmitting only on queue 0 o kern/171739 net [bce] [panic] bce related kernel panic o kern/171728 net [arp] arp issue o kern/171711 net [dummynet] [panic] Kernel panic in dummynet o kern/171697 net [ip6] [ndp] panic when changing routes o kern/171532 net [ndis] ndis(4) driver includes 'pccard'-specific code, o kern/171531 net [ndis] undocumented dependency for ndis(4) o kern/171524 net [ipmi] ipmi driver crashes kernel by reboot or shutdow o kern/171520 net [alc] alc network driver + tso + vlan does not work. s kern/171508 net [epair] [request] Add the ability to name epair device o kern/171228 net [re] [patch] if_re - eeprom write issues o kern/170701 net [ppp] killl ppp or reboot with active ppp connection c o kern/170267 net [ixgbe] IXGBE_LE32_TO_CPUS is probably an unintentiona o kern/170081 net [fxp] pf/nat/jails not working if checksum offloading o kern/169898 net ifconfig(8) fails to set MTU on multiple interfaces. o kern/169676 net [bge] [hang] system hangs, fully or partially after re o kern/169664 net [bgp] Wrongful replacement of interface connected net o kern/169620 net [ng] [pf] ng_l2tp incoming packet bypass pf firewall o kern/169459 net [ppp] umodem/ppp/3g stopped working after update from o kern/169438 net [ipsec] ipv4-in-ipv6 tunnel mode IPsec does not work o kern/169399 net [re] RealTek RTL8168/8111/8111c network interface not p kern/168294 net [ixgbe] [patch] ixgbe driver compiled in kernel has no o kern/168246 net [em] Multiple em(4) not working with qemu o kern/168245 net [arp] [regression] Permanent ARP entry not deleted on o kern/168244 net [arp] [regression] Unable to manually remove permanent o kern/168183 net [bce] bce driver hang system o kern/168152 net [xl] Periodically, the network card xl0 stops working o kern/167947 net [setfib] [patch] arpresolve checks only the default FI o kern/167603 net [ip] IP fragment reassembly's broken: file transfer ov o kern/167500 net [em] [panic] Kernel panics in em driver o kern/167325 net [netinet] [patch] sosend sometimes return EINVAL with o kern/167202 net [igmp]: Sending multiple IGMP packets crashes kernel o kern/167059 net [tcp] [panic] System does panic in in_pcbbind() and ha o kern/166940 net [ipfilter] [panic] Double fault in kern 8.2 o kern/166462 net [gre] gre(4) when using a tunnel source address from c o kern/166372 net [patch] ipfilter drops UDP packets with zero checksum o kern/166285 net [arp] FreeBSD v8.1 REL p8 arp: unknown hardware addres o kern/166255 net [net] [patch] It should be possible to disable "promis o kern/165963 net [panic] [ipf] ipfilter/nat NULL pointer deference o kern/165903 net mbuf leak o kern/165643 net [net] [patch] Missing vnet restores in net/if_ethersub o kern/165622 net [ndis][panic][patch] Unregistered use of FPU in kernel s kern/165562 net [request] add support for Intel i350 in FreeBSD 7.4 o kern/165526 net [bxe] UDP packets checksum calculation whithin if_bxe o kern/165488 net [ppp] [panic] Fatal trap 12 jails and ppp , kernel wit o kern/165305 net [ip6] [request] Feature parity between IP_TOS and IPV6 o kern/165296 net [vlan] [patch] Fix EVL_APPLY_VLID, update EVL_APPLY_PR o kern/165181 net [igb] igb freezes after about 2 weeks of uptime o kern/165174 net [patch] [tap] allow tap(4) to keep its address on clos o kern/165152 net [ip6] Does not work through the issue of ipv6 addresse o kern/164495 net [igb] connect double head igb to switch cause system t o kern/164490 net [pfil] Incorrect IP checksum on pfil pass from ip_outp o kern/164475 net [gre] gre misses RUNNING flag after a reboot o kern/164265 net [netinet] [patch] tcp_lro_rx computes wrong checksum i o kern/163903 net [igb] "igb0:tx(0)","bpf interface lock" v2.2.5 9-STABL o kern/163481 net freebsd do not add itself to ping route packet o kern/162927 net [tun] Modem-PPP error ppp[1538]: tun0: Phase: Clearing o kern/162926 net [ipfilter] Infinite loop in ipfilter with fragmented I o kern/162558 net [dummynet] [panic] seldom dummynet panics o kern/162153 net [em] intel em driver 7.2.4 don't compile o kern/162110 net [igb] [panic] RELENG_9 panics on boot in IGB driver - o kern/162028 net [ixgbe] [patch] misplaced #endif in ixgbe.c o kern/161381 net [re] RTL8169SC - re0: PHY write failed o kern/161277 net [em] [patch] BMC cannot receive IPMI traffic after loa o kern/160873 net [igb] igb(4) from HEAD fails to build on 7-STABLE o kern/160750 net Intel PRO/1000 connection breaks under load until rebo o kern/160693 net [gif] [em] Multicast packet are not passed from GIF0 t o kern/160293 net [ieee80211] ppanic] kernel panic during network setup o kern/160206 net [gif] gifX stops working after a while (IPv6 tunnel) o kern/159817 net [udp] write UDPv4: No buffer space available (code=55) o kern/159629 net [ipsec] [panic] kernel panic with IPsec in transport m o kern/159621 net [tcp] [panic] panic: soabort: so_count o kern/159603 net [netinet] [patch] in_ifscrubprefix() - network route c o kern/159601 net [netinet] [patch] in_scrubprefix() - loopback route re o kern/159294 net [em] em watchdog timeouts o kern/159203 net [wpi] Intel 3945ABG Wireless LAN not support IBSS o kern/158930 net [bpf] BPF element leak in ifp->bpf_if->bif_dlist o kern/158726 net [ip6] [patch] ICMPv6 Router Announcement flooding limi o kern/158694 net [ix] [lagg] ix0 is not working within lagg(4) o kern/158665 net [ip6] [panic] kernel pagefault in in6_setscope() o kern/158635 net [em] TSO breaks BPF packet captures with em driver f kern/157802 net [dummynet] [panic] kernel panic in dummynet o kern/157785 net amd64 + jail + ipfw + natd = very slow outbound traffi o kern/157418 net [em] em driver lockup during boot on Supermicro X9SCM- o kern/157410 net [ip6] IPv6 Router Advertisements Cause Excessive CPU U o kern/157287 net [re] [panic] INVARIANTS panic (Memory modified after f o kern/157209 net [ip6] [patch] locking error in rip6_input() (sys/netin o kern/157200 net [network.subr] [patch] stf(4) can not communicate betw o kern/157182 net [lagg] lagg interface not working together with epair o kern/156877 net [dummynet] [panic] dummynet move_pkt() null ptr derefe o kern/156667 net [em] em0 fails to init on CURRENT after March 17 o kern/156408 net [vlan] Routing failure when using VLANs vs. Physical e o kern/156328 net [icmp]: host can ping other subnet but no have IP from o kern/156317 net [ip6] Wrong order of IPv6 NS DAD/MLD Report o kern/156283 net [ip6] [patch] nd6_ns_input - rtalloc_mpath does not re o kern/156279 net [if_bridge][divert][ipfw] unable to correctly re-injec o kern/156226 net [lagg]: failover does not announce the failover to swi o kern/156030 net [ip6] [panic] Crash in nd6_dad_start() due to null ptr o kern/155772 net ifconfig(8): ioctl (SIOCAIFADDR): File exists on direc o kern/155680 net [multicast] problems with multicast s kern/155642 net [request] Add driver for Realtek RTL8191SE/RTL8192SE W o kern/155597 net [panic] Kernel panics with "sbdrop" message o kern/155420 net [vlan] adding vlan break existent vlan o kern/155177 net [route] [panic] Panic when inject routes in kernel p kern/155030 net [igb] igb(4) DEVICE_POLLING does not work with carp(4) o kern/155010 net [msk] ntfs-3g via iscsi using msk driver cause kernel o kern/154943 net [gif] ifconfig gifX create on existing gifX clears IP s kern/154851 net [request]: Port brcm80211 driver from Linux to FreeBSD o kern/154850 net [netgraph] [patch] ng_ether fails to name nodes when t o kern/154679 net [em] Fatal trap 12: "em1 taskq" only at startup (8.1-R o kern/154600 net [tcp] [panic] Random kernel panics on tcp_output o kern/154557 net [tcp] Freeze tcp-session of the clients, if in the gat o kern/154443 net [if_bridge] Kernel module bridgestp.ko missing after u o kern/154286 net [netgraph] [panic] 8.2-PRERELEASE panic in netgraph o kern/154255 net [nfs] NFS not responding o kern/154214 net [stf] [panic] Panic when creating stf interface o kern/154185 net race condition in mb_dupcl o kern/154169 net [multicast] [ip6] Node Information Query multicast add o kern/154134 net [ip6] stuck kernel state in LISTEN on ipv6 daemon whic o kern/154091 net [netgraph] [panic] netgraph, unaligned mbuf? o conf/154062 net [vlan] [patch] change to way of auto-generatation of v o kern/153937 net [ral] ralink panics the system (amd64 freeBSDD 8.X) wh o kern/153936 net [ixgbe] [patch] MPRC workaround incorrectly applied to o kern/153816 net [ixgbe] ixgbe doesn't work properly with the Intel 10g o kern/153772 net [ixgbe] [patch] sysctls reference wrong XON/XOFF varia o kern/153497 net [netgraph] netgraph panic due to race conditions o kern/153454 net [patch] [wlan] [urtw] Support ad-hoc and hostap modes o kern/153308 net [em] em interface use 100% cpu o kern/153244 net [em] em(4) fails to send UDP to port 0xffff o kern/152893 net [netgraph] [panic] 8.2-PRERELEASE panic in netgraph o kern/152853 net [em] tftpd (and likely other udp traffic) fails over e o kern/152828 net [em] poor performance on 8.1, 8.2-PRE o kern/152569 net [net]: Multiple ppp connections and routing table prob o kern/152235 net [arp] Permanent local ARP entries are not properly upd o kern/152141 net [vlan] [patch] encapsulate vlan in ng_ether before out o kern/152036 net [libc] getifaddrs(3) returns truncated sockaddrs for n o kern/151690 net [ep] network connectivity won't work until dhclient is o kern/151681 net [nfs] NFS mount via IPv6 leads to hang on client with o kern/151593 net [igb] [panic] Kernel panic when bringing up igb networ o kern/150920 net [ixgbe][igb] Panic when packets are dropped with heade o kern/150557 net [igb] igb0: Watchdog timeout -- resetting o kern/150251 net [patch] [ixgbe] Late cable insertion broken o kern/150249 net [ixgbe] Media type detection broken o bin/150224 net ppp(8) does not reassign static IP after kill -KILL co f kern/149969 net [wlan] [ral] ralink rt2661 fails to maintain connectio o kern/149937 net [ipfilter] [patch] kernel panic in ipfilter IP fragmen o kern/149643 net [rum] device not sending proper beacon frames in ap mo o kern/149609 net [panic] reboot after adding second default route o kern/149117 net [inet] [patch] in_pcbbind: redundant test o kern/149086 net [multicast] Generic multicast join failure in 8.1 o kern/148018 net [flowtable] flowtable crashes on ia64 o kern/147912 net [boot] FreeBSD 8 Beta won't boot on Thinkpad i1300 11 o kern/147894 net [ipsec] IPv6-in-IPv4 does not work inside an ESP-only o kern/147155 net [ip6] setfb not work with ipv6 o kern/146845 net [libc] close(2) returns error 54 (connection reset by f kern/146792 net [flowtable] flowcleaner 100% cpu's core load o kern/146719 net [pf] [panic] PF or dumynet kernel panic o kern/146534 net [icmp6] wrong source address in echo reply o kern/146427 net [mwl] Additional virtual access points don't work on m f kern/146394 net [vlan] IP source address for outgoing connections o bin/146377 net [ppp] [tun] Interface doesn't clear addresses when PPP o kern/146358 net [vlan] wrong destination MAC address o kern/146165 net [wlan] [panic] Setting bssid in adhoc mode causes pani o kern/146082 net [ng_l2tp] a false invaliant check was performed in ng_ o kern/146037 net [panic] mpd + CoA = kernel panic o kern/145825 net [panic] panic: soabort: so_count o kern/145728 net [lagg] Stops working lagg between two servers. p kern/145600 net TCP/ECN behaves different to CE/CWR than ns2 reference f kern/144917 net [flowtable] [panic] flowtable crashes system [regressi o kern/144882 net MacBookPro =>4.1 does not connect to BSD in hostap wit o kern/144874 net [if_bridge] [patch] if_bridge frees mbuf after pfil ho o conf/144700 net [rc.d] async dhclient breaks stuff for too many people o kern/144616 net [nat] [panic] ip_nat panic FreeBSD 7.2 f kern/144315 net [ipfw] [panic] freebsd 8-stable reboot after add ipfw o kern/144231 net bind/connect/sendto too strict about sockaddr length o kern/143846 net [gif] bringing gif3 tunnel down causes gif0 tunnel to s kern/143673 net [stf] [request] there should be a way to support multi s kern/143666 net [ip6] [request] PMTU black hole detection not implemen o kern/143622 net [pfil] [patch] unlock pfil lock while calling firewall o kern/143593 net [ipsec] When using IPSec, tcpdump doesn't show outgoin o kern/143591 net [ral] RT2561C-based DLink card (DWL-510) fails to work o kern/143208 net [ipsec] [gif] IPSec over gif interface not working o kern/143034 net [panic] system reboots itself in tcp code [regression] o kern/142877 net [hang] network-related repeatable 8.0-STABLE hard hang o kern/142774 net Problem with outgoing connections on interface with mu o kern/142772 net [libc] lla_lookup: new lle malloc failed f kern/142518 net [em] [lagg] Problem on 8.0-STABLE with em and lagg o kern/142018 net [iwi] [patch] Possibly wrong interpretation of beacon- o kern/141861 net [wi] data garbled with WEP and wi(4) with Prism 2.5 f kern/141741 net Etherlink III NIC won't work after upgrade to FBSD 8, o kern/140742 net rum(4) Two asus-WL167G adapters cannot talk to each ot o kern/140682 net [netgraph] [panic] random panic in netgraph o kern/140634 net [vlan] destroying if_lagg interface with if_vlan membe o kern/140619 net [ifnet] [patch] refine obsolete if_var.h comments desc o kern/140346 net [wlan] High bandwidth use causes loss of wlan connecti o kern/140142 net [ip6] [panic] FreeBSD 7.2-amd64 panic w/IPv6 o kern/140066 net [bwi] install report for 8.0 RC 2 (multiple problems) o kern/139565 net [ipfilter] ipfilter ioctl SIOCDELST broken o kern/139387 net [ipsec] Wrong lenth of PF_KEY messages in promiscuous o bin/139346 net [patch] arp(8) add option to remove static entries lis o kern/139268 net [if_bridge] [patch] allow if_bridge to forward just VL p kern/139204 net [arp] DHCP server replies rejected, ARP entry lost bef o kern/139117 net [lagg] + wlan boot timing (EBUSY) o kern/139058 net [ipfilter] mbuf cluster leak on FreeBSD 7.2 o kern/138850 net [dummynet] dummynet doesn't work correctly on a bridge o kern/138782 net [panic] sbflush_internal: cc 0 || mb 0xffffff004127b00 o kern/138688 net [rum] possibly broken on 8 Beta 4 amd64: able to wpa a o kern/138678 net [lo] FreeBSD does not assign linklocal address to loop o kern/138407 net [gre] gre(4) interface does not come up after reboot o kern/138332 net [tun] [lor] ifconfig tun0 destroy causes LOR if_adata/ o kern/138266 net [panic] kernel panic when udp benchmark test used as r o kern/138177 net [ipfilter] FreeBSD crashing repeatedly in ip_nat.c:257 f kern/138029 net [bpf] [panic] periodically kernel panic and reboot o kern/137881 net [netgraph] [panic] ng_pppoe fatal trap 12 p bin/137841 net [patch] wpa_supplicant(8) cannot verify SHA256 signed p kern/137776 net [rum] panic in rum(4) driver on 8.0-BETA2 o bin/137641 net ifconfig(8): various problems with "vlan_device.vlan_i o kern/137392 net [ip] [panic] crash in ip_nat.c line 2577 o kern/137372 net [ral] FreeBSD doesn't support wireless interface from o kern/137089 net [lagg] lagg falsely triggers IPv6 duplicate address de o bin/136994 net [patch] ifconfig(8) print carp mac address o kern/136911 net [netgraph] [panic] system panic on kldload ng_bpf.ko t o kern/136618 net [pf][stf] panic on cloning interface without unit numb o kern/135502 net [periodic] Warning message raised by rtfree function i o kern/134583 net [hang] Machine with jail freezes after random amount o o kern/134531 net [route] [panic] kernel crash related to routes/zebra o kern/134157 net [dummynet] dummynet loads cpu for 100% and make a syst o kern/133969 net [dummynet] [panic] Fatal trap 12: page fault while in o kern/133968 net [dummynet] [panic] dummynet kernel panic o kern/133736 net [udp] ip_id not protected ... o kern/133595 net [panic] Kernel Panic at pcpu.h:195 o kern/133572 net [ppp] [hang] incoming PPTP connection hangs the system o kern/133490 net [bpf] [panic] 'kmem_map too small' panic on Dell r900 o kern/133235 net [netinet] [patch] Process SIOCDLIFADDR command incorre f kern/133213 net arp and sshd errors on 7.1-PRERELEASE o kern/133060 net [ipsec] [pfsync] [panic] Kernel panic with ipsec + pfs o kern/132889 net [ndis] [panic] NDIS kernel crash on load BCM4321 AGN d o conf/132851 net [patch] rc.conf(5): allow to setfib(1) for service run o kern/132734 net [ifmib] [panic] panic in net/if_mib.c o kern/132705 net [libwrap] [patch] libwrap - infinite loop if hosts.all o kern/132672 net [ndis] [panic] ndis with rt2860.sys causes kernel pani o kern/132554 net [ipl] There is no ippool start script/ipfilter magic t o kern/132354 net [nat] Getting some packages to ipnat(8) causes crash o kern/132277 net [crypto] [ipsec] poor performance using cryptodevice f o kern/131781 net [ndis] ndis keeps dropping the link o kern/131776 net [wi] driver fails to init o kern/131753 net [altq] [panic] kernel panic in hfsc_dequeue o kern/131601 net [ipfilter] [panic] 7-STABLE panic in nat_finalise (tcp o bin/131567 net [socket] [patch] Update for regression/sockets/unix_cm o bin/131365 net route(8): route add changes interpretation of network f kern/130820 net [ndis] wpa_supplicant(8) returns 'no space on device' o kern/130628 net [nfs] NFS / rpc.lockd deadlock on 7.1-R o conf/130555 net [rc.d] [patch] No good way to set ipfilter variables a o kern/130525 net [ndis] [panic] 64 bit ar5008 ndisgen-erated driver cau o kern/130311 net [wlan_xauth] [panic] hostapd restart causing kernel pa o kern/130109 net [ipfw] Can not set fib for packets originated from loc f kern/130059 net [panic] Leaking 50k mbufs/hour f kern/129719 net [nfs] [panic] Panic during shutdown, tcp_ctloutput: in o kern/129517 net [ipsec] [panic] double fault / stack overflow f kern/129508 net [carp] [panic] Kernel panic with EtherIP (may be relat o kern/129219 net [ppp] Kernel panic when using kernel mode ppp o kern/129197 net [panic] 7.0 IP stack related panic o bin/128954 net ifconfig(8) deletes valid routes o bin/128602 net [an] wpa_supplicant(8) crashes with an(4) o kern/128448 net [nfs] 6.4-RC1 Boot Fails if NFS Hostname cannot be res o bin/128295 net [patch] ifconfig(8) does not print TOE4 or TOE6 capabi o bin/128001 net wpa_supplicant(8), wlan(4), and wi(4) issues o kern/127826 net [iwi] iwi0 driver has reduced performance and connecti o kern/127815 net [gif] [patch] if_gif does not set vlan attributes from o kern/127724 net [rtalloc] rtfree: 0xc5a8f870 has 1 refs f bin/127719 net [arp] arp: Segmentation fault (core dumped) f kern/127528 net [icmp]: icmp socket receives icmp replies not owned by p kern/127360 net [socket] TOE socket options missing from sosetopt() o bin/127192 net routed(8) removes the secondary alias IP of interface f kern/127145 net [wi]: prism (wi) driver crash at bigger traffic o kern/126895 net [patch] [ral] Add antenna selection (marked as TBD) o kern/126874 net [vlan]: Zebra problem if ifconfig vlanX destroy o kern/126695 net rtfree messages and network disruption upon use of if_ o kern/126339 net [ipw] ipw driver drops the connection o kern/126075 net [inet] [patch] internet control accesses beyond end of o bin/125922 net [patch] Deadlock in arp(8) o kern/125920 net [arp] Kernel Routing Table loses Ethernet Link status o kern/125845 net [netinet] [patch] tcp_lro_rx() should make use of hard o kern/125258 net [socket] socket's SO_REUSEADDR option does not work o kern/125239 net [gre] kernel crash when using gre o kern/124341 net [ral] promiscuous mode for wireless device ral0 looses o kern/124225 net [ndis] [patch] ndis network driver sometimes loses net o kern/124160 net [libc] connect(2) function loops indefinitely o kern/124021 net [ip6] [panic] page fault in nd6_output() o kern/123968 net [rum] [panic] rum driver causes kernel panic with WPA. o kern/123892 net [tap] [patch] No buffer space available o kern/123890 net [ppp] [panic] crash & reboot on work with PPP low-spee o kern/123858 net [stf] [patch] stf not usable behind a NAT o kern/123796 net [ipf] FreeBSD 6.1+VPN+ipnat+ipf: port mapping does not o kern/123758 net [panic] panic while restarting net/freenet6 o bin/123633 net ifconfig(8) doesn't set inet and ether address in one o kern/123559 net [iwi] iwi periodically disassociates/associates [regre o bin/123465 net [ip6] route(8): route add -inet6 -interfac o kern/123463 net [ipsec] [panic] repeatable crash related to ipsec-tool o conf/123330 net [nsswitch.conf] Enabling samba wins in nsswitch.conf c o kern/123160 net [ip] Panic and reboot at sysctl kern.polling.enable=0 o kern/122989 net [swi] [panic] 6.3 kernel panic in swi1: net o kern/122954 net [lagg] IPv6 EUI64 incorrectly chosen for lagg devices f kern/122780 net [lagg] tcpdump on lagg interface during high pps wedge o kern/122685 net It is not visible passing packets in tcpdump(1) o kern/122319 net [wi] imposible to enable ad-hoc demo mode with Orinoco o kern/122290 net [netgraph] [panic] Netgraph related "kmem_map too smal o kern/122252 net [ipmi] [bge] IPMI problem with BCM5704 (does not work o kern/122033 net [ral] [lor] Lock order reversal in ral0 at bootup ieee o bin/121895 net [patch] rtsol(8)/rtsold(8) doesn't handle managed netw s kern/121774 net [swi] [panic] 6.3 kernel panic in swi1: net o kern/121555 net [panic] Fatal trap 12: current process = 12 (swi1: net o kern/121443 net [gif] [lor] icmp6_input/nd6_lookup o kern/121437 net [vlan] Routing to layer-2 address does not work on VLA o bin/121359 net [patch] [security] ppp(8): fix local stack overflow in o kern/121257 net [tcp] TSO + natd -> slow outgoing tcp traffic o kern/121181 net [panic] Fatal trap 3: breakpoint instruction fault whi o kern/120966 net [rum] kernel panic with if_rum and WPA encryption o kern/120566 net [request]: ifconfig(8) make order of arguments more fr o kern/120304 net [netgraph] [patch] netgraph source assumes 32-bit time o kern/120266 net [udp] [panic] gnugk causes kernel panic when closing U o bin/120060 net routed(8) deletes link-level routes in the presence of o kern/119945 net [rum] [panic] rum device in hostap mode, cause kernel o kern/119791 net [nfs] UDP NFS mount of aliased IP addresses from a Sol o kern/119617 net [nfs] nfs error on wpa network when reseting/shutdown f kern/119516 net [ip6] [panic] _mtx_lock_sleep: recursed on non-recursi o kern/119432 net [arp] route add -host -iface causes arp e o kern/119225 net [wi] 7.0-RC1 no carrier with Prism 2.5 wifi card [regr o kern/118727 net [netgraph] [patch] [request] add new ng_pf module o kern/117423 net [vlan] Duplicate IP on different interfaces o bin/117339 net [patch] route(8): loading routing management commands o bin/116643 net [patch] [request] fstat(1): add INET/INET6 socket deta o kern/116185 net [iwi] if_iwi driver leads system to reboot o kern/115239 net [ipnat] panic with 'kmem_map too small' using ipnat o kern/115019 net [netgraph] ng_ether upper hook packet flow stops on ad o kern/115002 net [wi] if_wi timeout. failed allocation (busy bit). ifco o kern/114915 net [patch] [pcn] pcn (sys/pci/if_pcn.c) ethernet driver f o kern/113432 net [ucom] WARNING: attempt to net_add_domain(netgraph) af o kern/112722 net [ipsec] [udp] IP v4 udp fragmented packet reject o kern/112686 net [patm] patm driver freezes System (FreeBSD 6.2-p4) i38 o bin/112557 net [patch] ppp(8) lock file should not use symlink name o kern/112528 net [nfs] NFS over TCP under load hangs with "impossible p o kern/111537 net [inet6] [patch] ip6_input() treats mbuf cluster wrong o kern/111457 net [ral] ral(4) freeze o kern/110284 net [if_ethersubr] Invalid Assumption in SIOCSIFADDR in et o kern/110249 net [kernel] [regression] [patch] setsockopt() error regre o kern/109470 net [wi] Orinoco Classic Gold PC Card Can't Channel Hop o bin/108895 net pppd(8): PPPoE dead connections on 6.2 [regression] o kern/107944 net [wi] [patch] Forget to unlock mutex-locks o conf/107035 net [patch] bridge(8): bridge interface given in rc.conf n o kern/106444 net [netgraph] [panic] Kernel Panic on Binding to an ip to o kern/106316 net [dummynet] dummynet with multipass ipfw drops packets o kern/105945 net Address can disappear from network interface s kern/105943 net Network stack may modify read-only mbuf chain copies o bin/105925 net problems with ifconfig(8) and vlan(4) [regression] o kern/104851 net [inet6] [patch] On link routes not configured when usi o kern/104751 net [netgraph] kernel panic, when getting info about my tr o kern/103191 net Unpredictable reboot o kern/103135 net [ipsec] ipsec with ipfw divert (not NAT) encodes a pac o kern/102540 net [netgraph] [patch] supporting vlan(4) by ng_fec(4) o conf/102502 net [netgraph] [patch] ifconfig name does't rename netgrap o kern/102035 net [plip] plip networking disables parallel port printing o kern/101948 net [ipf] [panic] Kernel Panic Trap No 12 Page Fault - cau o kern/100709 net [libc] getaddrinfo(3) should return TTL info o kern/100519 net [netisr] suggestion to fix suboptimal network polling o kern/98978 net [ipf] [patch] ipfilter drops OOW packets under 6.1-Rel o kern/98597 net [inet6] Bug in FreeBSD 6.1 IPv6 link-local DAD procedu o bin/98218 net wpa_supplicant(8) blacklist not working o kern/97306 net [netgraph] NG_L2TP locks after connection with failed o conf/97014 net [gif] gifconfig_gif? in rc.conf does not recognize IPv f kern/96268 net [socket] TCP socket performance drops by 3000% if pack o kern/95519 net [ral] ral0 could not map mbuf o kern/95288 net [pppd] [tty] [panic] if_ppp panic in sys/kern/tty_subr o kern/95277 net [netinet] [patch] IP Encapsulation mask_match() return o kern/95267 net packet drops periodically appear f kern/93378 net [tcp] Slow data transfer in Postfix and Cyrus IMAP (wo o kern/93019 net [ppp] ppp and tunX problems: no traffic after restarti o kern/92880 net [libc] [patch] almost rewritten inet_network(3) functi s kern/92279 net [dc] Core faults everytime I reboot, possible NIC issu o kern/91859 net [ndis] if_ndis does not work with Asus WL-138 s kern/91777 net [ipf] [patch] wrong behaviour with skip rule inside an o kern/91364 net [ral] [wep] WF-511 RT2500 Card PCI and WEP o kern/91311 net [aue] aue interface hanging o kern/87521 net [ipf] [panic] using ipfilter "auth" keyword leads to k o kern/87421 net [netgraph] [panic]: ng_ether + ng_eiface + if_bridge o kern/86871 net [tcp] [patch] allocation logic for PCBs in TIME_WAIT s o kern/86427 net [lor] Deadlock with FASTIPSEC and nat o kern/86103 net [ipf] Illegal NAT Traversal in IPFilter o kern/85780 net 'panic: bogus refcnt 0' in routing/ipv6 o bin/85445 net ifconfig(8): deprecated keyword to ifconfig inoperativ p kern/85320 net [gre] [patch] possible depletion of kernel stack in ip o bin/82975 net route change does not parse classfull network as given o kern/82881 net [netgraph] [panic] ng_fec(4) causes kernel panic after o kern/82468 net Using 64MB tcp send/recv buffers, trafficflow stops, i o bin/82185 net [patch] ndp(8) can delete the incorrect entry o kern/81095 net IPsec connection stops working if associated network i o kern/78968 net FreeBSD freezes on mbufs exhaustion (network interface o kern/78090 net [ipf] ipf filtering on bridged packets doesn't work if o kern/77341 net [ip6] problems with IPV6 implementation s kern/77195 net [ipf] [patch] ipfilter ioctl SIOCGNATL does not match o kern/75873 net Usability problem with non-RFC-compliant IP spoof prot s kern/75407 net [an] an(4): no carrier after short time a kern/71474 net [route] route lookup does not skip interfaces marked d o kern/71469 net default route to internet magically disappears with mu o kern/70904 net [ipf] ipfilter ipnat problem with h323 proxy support o kern/68889 net [panic] m_copym, length > size of mbuf chain o kern/66225 net [netgraph] [patch] extend ng_eiface(4) control message o kern/65616 net IPSEC can't detunnel GRE packets after real ESP encryp s kern/60293 net [patch] FreeBSD arp poison patch a kern/56233 net IPsec tunnel (ESP) over IPv6: MTU computation is wrong s bin/41647 net ifconfig(8) doesn't accept lladdr along with inet addr o kern/39937 net ipstealth issue a kern/38554 net [patch] changing interface ipaddress doesn't seem to w o kern/34665 net [ipf] [hang] ipfilter rcmd proxy "hangs". o kern/31940 net ip queue length too short for >500kpps o kern/31647 net [libc] socket calls can return undocumented EINVAL o kern/30186 net [libc] getaddrinfo(3) does not handle incorrect servna o kern/27474 net [ipf] [ppp] Interactive use of user PPP and ipfilter c f kern/24959 net [patch] proper TCP_NOPUSH/TCP_CORK compatibility o conf/23063 net [arp] [patch] for static ARP tables in rc.network o kern/21998 net [socket] [patch] ident only for outgoing connections o kern/5877 net [socket] sb_cc counts control data as well as data dat 424 problems total. From owner-freebsd-net@FreeBSD.ORG Mon Oct 8 14:21:29 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AFD3E1065672 for ; Mon, 8 Oct 2012 14:21:29 +0000 (UTC) (envelope-from darcsis@gmail.com) Received: from mail-da0-f54.google.com (mail-da0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 813128FC08 for ; Mon, 8 Oct 2012 14:21:29 +0000 (UTC) Received: by mail-da0-f54.google.com with SMTP id z9so1740859dad.13 for ; Mon, 08 Oct 2012 07:21:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:user-agent:x-envelope-to:mail-followup-to:date :message-id:mime-version:content-type; bh=Rqhn9UmZFPJNc4EGFAY/4Tr62Tg5EflmwjPKzuOnJ2Q=; b=xZ4dc2IFb/lV/GtAxcDie9p18olBzowLbwSbTNEhPv6PN9QhuNx/3NFYYUttqAn/DZ hva+YhnC3/eKlrek38GMdLq/wpCt0ae3sKEKzTLecZK8yyHaFtcXCEbAB8GYQiQQurjh WpOgkApZTLAAGr6d+FPqgQX5yR/V5dLrN7n5D17tTQz62NaGb6hdLl0mlbN8H2hBVh+l 1xfTV+xS5gbKXa4d+6eLSkw4MZoVqED2zqjlERRrIGyq8eW8a+tyos9PFC4Fbti8HXHD tLA6o55kYsMIfaBdTkxBAT1JWeJTwd10j2lge4K/Z2qqlRPXgX1b7BqrPFm8DgTs+Mko z7Og== Received: by 10.68.220.169 with SMTP id px9mr54668524pbc.14.1349706089105; Mon, 08 Oct 2012 07:21:29 -0700 (PDT) Received: from localhost ([123.117.46.17]) by mx.google.com with ESMTPS id vz8sm10788337pbc.63.2012.10.08.07.21.25 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Oct 2012 07:21:28 -0700 (PDT) From: darcsis@gmail.com (Denise H. G.) To: freebsd-net@freebsd.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (berkeley-unix) X-Envelope-To: freebsd-net@freebsd.org Mail-Followup-To: freebsd-net@freebsd.org Date: Mon, 08 Oct 2012 22:21:17 +0800 Message-ID: <86ehl96o4i.fsf@venux.xbsd.name> MIME-Version: 1.0 Content-Type: text/plain Subject: What driver should I use for 'intel centrino wireless-N 2200 BGN' ? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 14:21:29 -0000 Hi list, I tried ipw, iwn, and iwi, but ended up with no luck. What's more, it seems that the wireless adapter has not been even detected by the system. I ran 'pciconf -l' and got this line which seems to be my wireless adapter: none3@pci0:3:0:0: class=0x028000 card=0x42228086 chip=0x08918086 rev=0xc4 hdr=0x00 Is there a driver for that under FreeBSD 9.1-PRERELEASE? Thanks! From owner-freebsd-net@FreeBSD.ORG Mon Oct 8 16:36:04 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 39D5F106566C for ; Mon, 8 Oct 2012 16:36:04 +0000 (UTC) (envelope-from andrnils@gmail.com) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx1.freebsd.org (Postfix) with ESMTP id EAD498FC1B for ; Mon, 8 Oct 2012 16:36:03 +0000 (UTC) Received: by mail-oa0-f54.google.com with SMTP id n9so5454822oag.13 for ; Mon, 08 Oct 2012 09:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=WNlKeHL0vC5gDXfDW0yL7Vp3OdmpFDyZceQbdqVwX+g=; b=Brqh7s4xYWv7OOIG16n3OktvJFEH3u6Zgi2PG9OdMCUTofRZ5c3Kbg7AjCXAGhWu3r P0DSLRPEv5Q80IE4rPJzJux7AT1IBJbXno9a4Qs3Sh/WhxvCCGTxHGUmtA3/3o4GwySs Fxy2Msic/D8FSD07jYhOmACCHmERr3+1jRFk9LhyoT0l2EZ7hM4GH6Ued+76yA75Bmig tTVOUgXo77Uy+zqlUSIXAOzZVWCMzvHgjA9LyoE3Fri22eSTfH0tJIpQKkoxOrVHKZHw LX7cLe/0PeHbZhrwBeuwxrRWWGMSTqLEqAHLacZxyVUd/d4wJpUj4anf2ATPoeo5yE2d HNiw== MIME-Version: 1.0 Received: by 10.182.202.1 with SMTP id ke1mr582329obc.51.1349714163138; Mon, 08 Oct 2012 09:36:03 -0700 (PDT) Received: by 10.60.9.229 with HTTP; Mon, 8 Oct 2012 09:36:03 -0700 (PDT) In-Reply-To: <86ehl96o4i.fsf@venux.xbsd.name> References: <86ehl96o4i.fsf@venux.xbsd.name> Date: Mon, 8 Oct 2012 16:36:03 +0000 Message-ID: From: Andreas Nilsson To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: What driver should I use for 'intel centrino wireless-N 2200 BGN' ? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 16:36:04 -0000 On Mon, Oct 8, 2012 at 2:21 PM, Denise H. G. wrote: > Hi list, > > I tried ipw, iwn, and iwi, but ended up with no luck. What's more, it > seems that the wireless adapter has not been even detected by the > system. I ran 'pciconf -l' and got this line which seems to be my > wireless adapter: > > none3@pci0:3:0:0: class=0x028000 card=0x42228086 chip=0x08918086 > rev=0xc4 hdr=0x00 > > Is there a driver for that under FreeBSD 9.1-PRERELEASE? > > Thanks! > Man page for iwi says The iwi driver provides support for Intel PRO/Wireless 2200BG/2915ABG Do you have legal.intel_iwi.license_ack=1 in loader.conf ? Perhaps you need to check if the device id is listed in the source code? Best regards Andreas From owner-freebsd-net@FreeBSD.ORG Mon Oct 8 16:44:28 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 146F91065672 for ; Mon, 8 Oct 2012 16:44:28 +0000 (UTC) (envelope-from kob6558@gmail.com) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by mx1.freebsd.org (Postfix) with ESMTP id 9610C8FC1B for ; Mon, 8 Oct 2012 16:44:27 +0000 (UTC) Received: by mail-wi0-f178.google.com with SMTP id hr7so3061690wib.13 for ; Mon, 08 Oct 2012 09:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Jqa945Gqz0VSn5CaXS5sjUdZ5ihAPyBYB/PVbmM+zcI=; b=y9aPa6MJR8uOYAboJ5hrWPecrG1q+dkcxV7pUJfXXo2BBk2iP7h7t7AkkTaEuisqWu FmnPkZ66IBBozqdwBwkA467P05NouhRVXkAbXsk3p5hmXPXafL8h3MDGVFurHLn1q3kH NkqoVsK5aQzZCC6TEgGokGFiUHOnObvJ0a4gIYPQ5rp1x+j/3mrgUTeo4KhvHvm1mQkj uwIWytmox0jLpDCyXDCVZ6ImRxInT2L+9p/PgcvMl00mwLAETmWY3zBVbvcml8J8rqEy 4Nwv9vtbaz1u1eyXgLSqejBBf6x91rh0eIJ0cwXuVfOsGxL5AzVt6IZbptGWHeJYZRuO dtFg== MIME-Version: 1.0 Received: by 10.216.212.225 with SMTP id y75mr10173288weo.39.1349714666415; Mon, 08 Oct 2012 09:44:26 -0700 (PDT) Received: by 10.223.66.194 with HTTP; Mon, 8 Oct 2012 09:44:26 -0700 (PDT) In-Reply-To: References: <86ehl96o4i.fsf@venux.xbsd.name> Date: Mon, 8 Oct 2012 09:44:26 -0700 Message-ID: From: Kevin Oberman To: Andreas Nilsson Content-Type: text/plain; charset=UTF-8 Cc: freebsd-net@freebsd.org Subject: Re: What driver should I use for 'intel centrino wireless-N 2200 BGN' ? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 16:44:28 -0000 On Mon, Oct 8, 2012 at 9:36 AM, Andreas Nilsson wrote: > On Mon, Oct 8, 2012 at 2:21 PM, Denise H. G. wrote: > >> Hi list, >> >> I tried ipw, iwn, and iwi, but ended up with no luck. What's more, it >> seems that the wireless adapter has not been even detected by the >> system. I ran 'pciconf -l' and got this line which seems to be my >> wireless adapter: >> >> none3@pci0:3:0:0: class=0x028000 card=0x42228086 chip=0x08918086 >> rev=0xc4 hdr=0x00 >> >> Is there a driver for that under FreeBSD 9.1-PRERELEASE? >> >> Thanks! >> > > Man page for iwi says > The iwi driver provides support for Intel PRO/Wireless 2200BG/2915ABG > > Do you have legal.intel_iwi.license_ack=1 in loader.conf ? > > Perhaps you need to check if the device id is listed in the source code? Yes. Some vendors (e.g. Lenovo, HP) have private PCIIDs on their cards, so they may not be in the source. Adding them is trivial, but, should this be the issue, please open a PR to have it added to the source in SVN. -- R. Kevin Oberman, Network Engineer E-mail: kob6558@gmail.com From owner-freebsd-net@FreeBSD.ORG Mon Oct 8 11:07:24 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7895106566B for ; Mon, 8 Oct 2012 11:07:24 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id BF6CD8FC1C for ; Mon, 8 Oct 2012 11:07:24 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q98B7O8k029406 for ; Mon, 8 Oct 2012 11:07:24 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q98B7Ol9029404 for freebsd-net@FreeBSD.org; Mon, 8 Oct 2012 11:07:24 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 8 Oct 2012 11:07:24 GMT Message-Id: <201210081107.q98B7Ol9029404@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-net@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-net@FreeBSD.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 11:07:24 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/172364 net [cxbge] cxbge_vlan_config() Fatal trap 12: page fault o kern/172113 net [panic] [e1000] [patch] 9.1-RC1/amd64 panices in igb(4 o kern/171840 net [ip6] IPv6 packets transmitting only on queue 0 o kern/171739 net [bce] [panic] bce related kernel panic o kern/171728 net [arp] arp issue o kern/171711 net [dummynet] [panic] Kernel panic in dummynet o kern/171697 net [ip6] [ndp] panic when changing routes o kern/171532 net [ndis] ndis(4) driver includes 'pccard'-specific code, o kern/171531 net [ndis] undocumented dependency for ndis(4) o kern/171524 net [ipmi] ipmi driver crashes kernel by reboot or shutdow o kern/171520 net [alc] alc network driver + tso + vlan does not work. s kern/171508 net [epair] [request] Add the ability to name epair device o kern/171228 net [re] [patch] if_re - eeprom write issues o kern/170701 net [ppp] killl ppp or reboot with active ppp connection c o kern/170267 net [ixgbe] IXGBE_LE32_TO_CPUS is probably an unintentiona o kern/170081 net [fxp] pf/nat/jails not working if checksum offloading o kern/169898 net ifconfig(8) fails to set MTU on multiple interfaces. o kern/169676 net [bge] [hang] system hangs, fully or partially after re o kern/169664 net [bgp] Wrongful replacement of interface connected net o kern/169620 net [ng] [pf] ng_l2tp incoming packet bypass pf firewall o kern/169459 net [ppp] umodem/ppp/3g stopped working after update from o kern/169438 net [ipsec] ipv4-in-ipv6 tunnel mode IPsec does not work o kern/169399 net [re] RealTek RTL8168/8111/8111c network interface not p kern/168294 net [ixgbe] [patch] ixgbe driver compiled in kernel has no o kern/168246 net [em] Multiple em(4) not working with qemu o kern/168245 net [arp] [regression] Permanent ARP entry not deleted on o kern/168244 net [arp] [regression] Unable to manually remove permanent o kern/168183 net [bce] bce driver hang system o kern/168152 net [xl] Periodically, the network card xl0 stops working o kern/167947 net [setfib] [patch] arpresolve checks only the default FI o kern/167603 net [ip] IP fragment reassembly's broken: file transfer ov o kern/167500 net [em] [panic] Kernel panics in em driver o kern/167325 net [netinet] [patch] sosend sometimes return EINVAL with o kern/167202 net [igmp]: Sending multiple IGMP packets crashes kernel o kern/167059 net [tcp] [panic] System does panic in in_pcbbind() and ha o kern/166940 net [ipfilter] [panic] Double fault in kern 8.2 o kern/166462 net [gre] gre(4) when using a tunnel source address from c o kern/166372 net [patch] ipfilter drops UDP packets with zero checksum o kern/166285 net [arp] FreeBSD v8.1 REL p8 arp: unknown hardware addres o kern/166255 net [net] [patch] It should be possible to disable "promis o kern/165963 net [panic] [ipf] ipfilter/nat NULL pointer deference o kern/165903 net mbuf leak o kern/165643 net [net] [patch] Missing vnet restores in net/if_ethersub o kern/165622 net [ndis][panic][patch] Unregistered use of FPU in kernel s kern/165562 net [request] add support for Intel i350 in FreeBSD 7.4 o kern/165526 net [bxe] UDP packets checksum calculation whithin if_bxe o kern/165488 net [ppp] [panic] Fatal trap 12 jails and ppp , kernel wit o kern/165305 net [ip6] [request] Feature parity between IP_TOS and IPV6 o kern/165296 net [vlan] [patch] Fix EVL_APPLY_VLID, update EVL_APPLY_PR o kern/165181 net [igb] igb freezes after about 2 weeks of uptime o kern/165174 net [patch] [tap] allow tap(4) to keep its address on clos o kern/165152 net [ip6] Does not work through the issue of ipv6 addresse o kern/164495 net [igb] connect double head igb to switch cause system t o kern/164490 net [pfil] Incorrect IP checksum on pfil pass from ip_outp o kern/164475 net [gre] gre misses RUNNING flag after a reboot o kern/164265 net [netinet] [patch] tcp_lro_rx computes wrong checksum i o kern/163903 net [igb] "igb0:tx(0)","bpf interface lock" v2.2.5 9-STABL o kern/163481 net freebsd do not add itself to ping route packet o kern/162927 net [tun] Modem-PPP error ppp[1538]: tun0: Phase: Clearing o kern/162926 net [ipfilter] Infinite loop in ipfilter with fragmented I o kern/162558 net [dummynet] [panic] seldom dummynet panics o kern/162153 net [em] intel em driver 7.2.4 don't compile o kern/162110 net [igb] [panic] RELENG_9 panics on boot in IGB driver - o kern/162028 net [ixgbe] [patch] misplaced #endif in ixgbe.c o kern/161381 net [re] RTL8169SC - re0: PHY write failed o kern/161277 net [em] [patch] BMC cannot receive IPMI traffic after loa o kern/160873 net [igb] igb(4) from HEAD fails to build on 7-STABLE o kern/160750 net Intel PRO/1000 connection breaks under load until rebo o kern/160693 net [gif] [em] Multicast packet are not passed from GIF0 t o kern/160293 net [ieee80211] ppanic] kernel panic during network setup o kern/160206 net [gif] gifX stops working after a while (IPv6 tunnel) o kern/159817 net [udp] write UDPv4: No buffer space available (code=55) o kern/159629 net [ipsec] [panic] kernel panic with IPsec in transport m o kern/159621 net [tcp] [panic] panic: soabort: so_count o kern/159603 net [netinet] [patch] in_ifscrubprefix() - network route c o kern/159601 net [netinet] [patch] in_scrubprefix() - loopback route re o kern/159294 net [em] em watchdog timeouts o kern/159203 net [wpi] Intel 3945ABG Wireless LAN not support IBSS o kern/158930 net [bpf] BPF element leak in ifp->bpf_if->bif_dlist o kern/158726 net [ip6] [patch] ICMPv6 Router Announcement flooding limi o kern/158694 net [ix] [lagg] ix0 is not working within lagg(4) o kern/158665 net [ip6] [panic] kernel pagefault in in6_setscope() o kern/158635 net [em] TSO breaks BPF packet captures with em driver f kern/157802 net [dummynet] [panic] kernel panic in dummynet o kern/157785 net amd64 + jail + ipfw + natd = very slow outbound traffi o kern/157418 net [em] em driver lockup during boot on Supermicro X9SCM- o kern/157410 net [ip6] IPv6 Router Advertisements Cause Excessive CPU U o kern/157287 net [re] [panic] INVARIANTS panic (Memory modified after f o kern/157209 net [ip6] [patch] locking error in rip6_input() (sys/netin o kern/157200 net [network.subr] [patch] stf(4) can not communicate betw o kern/157182 net [lagg] lagg interface not working together with epair o kern/156877 net [dummynet] [panic] dummynet move_pkt() null ptr derefe o kern/156667 net [em] em0 fails to init on CURRENT after March 17 o kern/156408 net [vlan] Routing failure when using VLANs vs. Physical e o kern/156328 net [icmp]: host can ping other subnet but no have IP from o kern/156317 net [ip6] Wrong order of IPv6 NS DAD/MLD Report o kern/156283 net [ip6] [patch] nd6_ns_input - rtalloc_mpath does not re o kern/156279 net [if_bridge][divert][ipfw] unable to correctly re-injec o kern/156226 net [lagg]: failover does not announce the failover to swi o kern/156030 net [ip6] [panic] Crash in nd6_dad_start() due to null ptr o kern/155772 net ifconfig(8): ioctl (SIOCAIFADDR): File exists on direc o kern/155680 net [multicast] problems with multicast s kern/155642 net [request] Add driver for Realtek RTL8191SE/RTL8192SE W o kern/155597 net [panic] Kernel panics with "sbdrop" message o kern/155420 net [vlan] adding vlan break existent vlan o kern/155177 net [route] [panic] Panic when inject routes in kernel p kern/155030 net [igb] igb(4) DEVICE_POLLING does not work with carp(4) o kern/155010 net [msk] ntfs-3g via iscsi using msk driver cause kernel o kern/154943 net [gif] ifconfig gifX create on existing gifX clears IP s kern/154851 net [request]: Port brcm80211 driver from Linux to FreeBSD o kern/154850 net [netgraph] [patch] ng_ether fails to name nodes when t o kern/154679 net [em] Fatal trap 12: "em1 taskq" only at startup (8.1-R o kern/154600 net [tcp] [panic] Random kernel panics on tcp_output o kern/154557 net [tcp] Freeze tcp-session of the clients, if in the gat o kern/154443 net [if_bridge] Kernel module bridgestp.ko missing after u o kern/154286 net [netgraph] [panic] 8.2-PRERELEASE panic in netgraph o kern/154255 net [nfs] NFS not responding o kern/154214 net [stf] [panic] Panic when creating stf interface o kern/154185 net race condition in mb_dupcl o kern/154169 net [multicast] [ip6] Node Information Query multicast add o kern/154134 net [ip6] stuck kernel state in LISTEN on ipv6 daemon whic o kern/154091 net [netgraph] [panic] netgraph, unaligned mbuf? o conf/154062 net [vlan] [patch] change to way of auto-generatation of v o kern/153937 net [ral] ralink panics the system (amd64 freeBSDD 8.X) wh o kern/153936 net [ixgbe] [patch] MPRC workaround incorrectly applied to o kern/153816 net [ixgbe] ixgbe doesn't work properly with the Intel 10g o kern/153772 net [ixgbe] [patch] sysctls reference wrong XON/XOFF varia o kern/153497 net [netgraph] netgraph panic due to race conditions o kern/153454 net [patch] [wlan] [urtw] Support ad-hoc and hostap modes o kern/153308 net [em] em interface use 100% cpu o kern/153244 net [em] em(4) fails to send UDP to port 0xffff o kern/152893 net [netgraph] [panic] 8.2-PRERELEASE panic in netgraph o kern/152853 net [em] tftpd (and likely other udp traffic) fails over e o kern/152828 net [em] poor performance on 8.1, 8.2-PRE o kern/152569 net [net]: Multiple ppp connections and routing table prob o kern/152235 net [arp] Permanent local ARP entries are not properly upd o kern/152141 net [vlan] [patch] encapsulate vlan in ng_ether before out o kern/152036 net [libc] getifaddrs(3) returns truncated sockaddrs for n o kern/151690 net [ep] network connectivity won't work until dhclient is o kern/151681 net [nfs] NFS mount via IPv6 leads to hang on client with o kern/151593 net [igb] [panic] Kernel panic when bringing up igb networ o kern/150920 net [ixgbe][igb] Panic when packets are dropped with heade o kern/150557 net [igb] igb0: Watchdog timeout -- resetting o kern/150251 net [patch] [ixgbe] Late cable insertion broken o kern/150249 net [ixgbe] Media type detection broken o bin/150224 net ppp(8) does not reassign static IP after kill -KILL co f kern/149969 net [wlan] [ral] ralink rt2661 fails to maintain connectio o kern/149937 net [ipfilter] [patch] kernel panic in ipfilter IP fragmen o kern/149643 net [rum] device not sending proper beacon frames in ap mo o kern/149609 net [panic] reboot after adding second default route o kern/149117 net [inet] [patch] in_pcbbind: redundant test o kern/149086 net [multicast] Generic multicast join failure in 8.1 o kern/148018 net [flowtable] flowtable crashes on ia64 o kern/147912 net [boot] FreeBSD 8 Beta won't boot on Thinkpad i1300 11 o kern/147894 net [ipsec] IPv6-in-IPv4 does not work inside an ESP-only o kern/147155 net [ip6] setfb not work with ipv6 o kern/146845 net [libc] close(2) returns error 54 (connection reset by f kern/146792 net [flowtable] flowcleaner 100% cpu's core load o kern/146719 net [pf] [panic] PF or dumynet kernel panic o kern/146534 net [icmp6] wrong source address in echo reply o kern/146427 net [mwl] Additional virtual access points don't work on m f kern/146394 net [vlan] IP source address for outgoing connections o bin/146377 net [ppp] [tun] Interface doesn't clear addresses when PPP o kern/146358 net [vlan] wrong destination MAC address o kern/146165 net [wlan] [panic] Setting bssid in adhoc mode causes pani o kern/146082 net [ng_l2tp] a false invaliant check was performed in ng_ o kern/146037 net [panic] mpd + CoA = kernel panic o kern/145825 net [panic] panic: soabort: so_count o kern/145728 net [lagg] Stops working lagg between two servers. p kern/145600 net TCP/ECN behaves different to CE/CWR than ns2 reference f kern/144917 net [flowtable] [panic] flowtable crashes system [regressi o kern/144882 net MacBookPro =>4.1 does not connect to BSD in hostap wit o kern/144874 net [if_bridge] [patch] if_bridge frees mbuf after pfil ho o conf/144700 net [rc.d] async dhclient breaks stuff for too many people o kern/144616 net [nat] [panic] ip_nat panic FreeBSD 7.2 f kern/144315 net [ipfw] [panic] freebsd 8-stable reboot after add ipfw o kern/144231 net bind/connect/sendto too strict about sockaddr length o kern/143846 net [gif] bringing gif3 tunnel down causes gif0 tunnel to s kern/143673 net [stf] [request] there should be a way to support multi s kern/143666 net [ip6] [request] PMTU black hole detection not implemen o kern/143622 net [pfil] [patch] unlock pfil lock while calling firewall o kern/143593 net [ipsec] When using IPSec, tcpdump doesn't show outgoin o kern/143591 net [ral] RT2561C-based DLink card (DWL-510) fails to work o kern/143208 net [ipsec] [gif] IPSec over gif interface not working o kern/143034 net [panic] system reboots itself in tcp code [regression] o kern/142877 net [hang] network-related repeatable 8.0-STABLE hard hang o kern/142774 net Problem with outgoing connections on interface with mu o kern/142772 net [libc] lla_lookup: new lle malloc failed f kern/142518 net [em] [lagg] Problem on 8.0-STABLE with em and lagg o kern/142018 net [iwi] [patch] Possibly wrong interpretation of beacon- o kern/141861 net [wi] data garbled with WEP and wi(4) with Prism 2.5 f kern/141741 net Etherlink III NIC won't work after upgrade to FBSD 8, o kern/140742 net rum(4) Two asus-WL167G adapters cannot talk to each ot o kern/140682 net [netgraph] [panic] random panic in netgraph o kern/140634 net [vlan] destroying if_lagg interface with if_vlan membe o kern/140619 net [ifnet] [patch] refine obsolete if_var.h comments desc o kern/140346 net [wlan] High bandwidth use causes loss of wlan connecti o kern/140142 net [ip6] [panic] FreeBSD 7.2-amd64 panic w/IPv6 o kern/140066 net [bwi] install report for 8.0 RC 2 (multiple problems) o kern/139565 net [ipfilter] ipfilter ioctl SIOCDELST broken o kern/139387 net [ipsec] Wrong lenth of PF_KEY messages in promiscuous o bin/139346 net [patch] arp(8) add option to remove static entries lis o kern/139268 net [if_bridge] [patch] allow if_bridge to forward just VL p kern/139204 net [arp] DHCP server replies rejected, ARP entry lost bef o kern/139117 net [lagg] + wlan boot timing (EBUSY) o kern/139058 net [ipfilter] mbuf cluster leak on FreeBSD 7.2 o kern/138850 net [dummynet] dummynet doesn't work correctly on a bridge o kern/138782 net [panic] sbflush_internal: cc 0 || mb 0xffffff004127b00 o kern/138688 net [rum] possibly broken on 8 Beta 4 amd64: able to wpa a o kern/138678 net [lo] FreeBSD does not assign linklocal address to loop o kern/138407 net [gre] gre(4) interface does not come up after reboot o kern/138332 net [tun] [lor] ifconfig tun0 destroy causes LOR if_adata/ o kern/138266 net [panic] kernel panic when udp benchmark test used as r o kern/138177 net [ipfilter] FreeBSD crashing repeatedly in ip_nat.c:257 f kern/138029 net [bpf] [panic] periodically kernel panic and reboot o kern/137881 net [netgraph] [panic] ng_pppoe fatal trap 12 p bin/137841 net [patch] wpa_supplicant(8) cannot verify SHA256 signed p kern/137776 net [rum] panic in rum(4) driver on 8.0-BETA2 o bin/137641 net ifconfig(8): various problems with "vlan_device.vlan_i o kern/137392 net [ip] [panic] crash in ip_nat.c line 2577 o kern/137372 net [ral] FreeBSD doesn't support wireless interface from o kern/137089 net [lagg] lagg falsely triggers IPv6 duplicate address de o bin/136994 net [patch] ifconfig(8) print carp mac address o kern/136911 net [netgraph] [panic] system panic on kldload ng_bpf.ko t o kern/136618 net [pf][stf] panic on cloning interface without unit numb o kern/135502 net [periodic] Warning message raised by rtfree function i o kern/134583 net [hang] Machine with jail freezes after random amount o o kern/134531 net [route] [panic] kernel crash related to routes/zebra o kern/134157 net [dummynet] dummynet loads cpu for 100% and make a syst o kern/133969 net [dummynet] [panic] Fatal trap 12: page fault while in o kern/133968 net [dummynet] [panic] dummynet kernel panic o kern/133736 net [udp] ip_id not protected ... o kern/133595 net [panic] Kernel Panic at pcpu.h:195 o kern/133572 net [ppp] [hang] incoming PPTP connection hangs the system o kern/133490 net [bpf] [panic] 'kmem_map too small' panic on Dell r900 o kern/133235 net [netinet] [patch] Process SIOCDLIFADDR command incorre f kern/133213 net arp and sshd errors on 7.1-PRERELEASE o kern/133060 net [ipsec] [pfsync] [panic] Kernel panic with ipsec + pfs o kern/132889 net [ndis] [panic] NDIS kernel crash on load BCM4321 AGN d o conf/132851 net [patch] rc.conf(5): allow to setfib(1) for service run o kern/132734 net [ifmib] [panic] panic in net/if_mib.c o kern/132705 net [libwrap] [patch] libwrap - infinite loop if hosts.all o kern/132672 net [ndis] [panic] ndis with rt2860.sys causes kernel pani o kern/132554 net [ipl] There is no ippool start script/ipfilter magic t o kern/132354 net [nat] Getting some packages to ipnat(8) causes crash o kern/132277 net [crypto] [ipsec] poor performance using cryptodevice f o kern/131781 net [ndis] ndis keeps dropping the link o kern/131776 net [wi] driver fails to init o kern/131753 net [altq] [panic] kernel panic in hfsc_dequeue o kern/131601 net [ipfilter] [panic] 7-STABLE panic in nat_finalise (tcp o bin/131567 net [socket] [patch] Update for regression/sockets/unix_cm o bin/131365 net route(8): route add changes interpretation of network f kern/130820 net [ndis] wpa_supplicant(8) returns 'no space on device' o kern/130628 net [nfs] NFS / rpc.lockd deadlock on 7.1-R o conf/130555 net [rc.d] [patch] No good way to set ipfilter variables a o kern/130525 net [ndis] [panic] 64 bit ar5008 ndisgen-erated driver cau o kern/130311 net [wlan_xauth] [panic] hostapd restart causing kernel pa o kern/130109 net [ipfw] Can not set fib for packets originated from loc f kern/130059 net [panic] Leaking 50k mbufs/hour f kern/129719 net [nfs] [panic] Panic during shutdown, tcp_ctloutput: in o kern/129517 net [ipsec] [panic] double fault / stack overflow f kern/129508 net [carp] [panic] Kernel panic with EtherIP (may be relat o kern/129219 net [ppp] Kernel panic when using kernel mode ppp o kern/129197 net [panic] 7.0 IP stack related panic o bin/128954 net ifconfig(8) deletes valid routes o bin/128602 net [an] wpa_supplicant(8) crashes with an(4) o kern/128448 net [nfs] 6.4-RC1 Boot Fails if NFS Hostname cannot be res o bin/128295 net [patch] ifconfig(8) does not print TOE4 or TOE6 capabi o bin/128001 net wpa_supplicant(8), wlan(4), and wi(4) issues o kern/127826 net [iwi] iwi0 driver has reduced performance and connecti o kern/127815 net [gif] [patch] if_gif does not set vlan attributes from o kern/127724 net [rtalloc] rtfree: 0xc5a8f870 has 1 refs f bin/127719 net [arp] arp: Segmentation fault (core dumped) f kern/127528 net [icmp]: icmp socket receives icmp replies not owned by p kern/127360 net [socket] TOE socket options missing from sosetopt() o bin/127192 net routed(8) removes the secondary alias IP of interface f kern/127145 net [wi]: prism (wi) driver crash at bigger traffic o kern/126895 net [patch] [ral] Add antenna selection (marked as TBD) o kern/126874 net [vlan]: Zebra problem if ifconfig vlanX destroy o kern/126695 net rtfree messages and network disruption upon use of if_ o kern/126339 net [ipw] ipw driver drops the connection o kern/126075 net [inet] [patch] internet control accesses beyond end of o bin/125922 net [patch] Deadlock in arp(8) o kern/125920 net [arp] Kernel Routing Table loses Ethernet Link status o kern/125845 net [netinet] [patch] tcp_lro_rx() should make use of hard o kern/125258 net [socket] socket's SO_REUSEADDR option does not work o kern/125239 net [gre] kernel crash when using gre o kern/124341 net [ral] promiscuous mode for wireless device ral0 looses o kern/124225 net [ndis] [patch] ndis network driver sometimes loses net o kern/124160 net [libc] connect(2) function loops indefinitely o kern/124021 net [ip6] [panic] page fault in nd6_output() o kern/123968 net [rum] [panic] rum driver causes kernel panic with WPA. o kern/123892 net [tap] [patch] No buffer space available o kern/123890 net [ppp] [panic] crash & reboot on work with PPP low-spee o kern/123858 net [stf] [patch] stf not usable behind a NAT o kern/123796 net [ipf] FreeBSD 6.1+VPN+ipnat+ipf: port mapping does not o kern/123758 net [panic] panic while restarting net/freenet6 o bin/123633 net ifconfig(8) doesn't set inet and ether address in one o kern/123559 net [iwi] iwi periodically disassociates/associates [regre o bin/123465 net [ip6] route(8): route add -inet6 -interfac o kern/123463 net [ipsec] [panic] repeatable crash related to ipsec-tool o conf/123330 net [nsswitch.conf] Enabling samba wins in nsswitch.conf c o kern/123160 net [ip] Panic and reboot at sysctl kern.polling.enable=0 o kern/122989 net [swi] [panic] 6.3 kernel panic in swi1: net o kern/122954 net [lagg] IPv6 EUI64 incorrectly chosen for lagg devices f kern/122780 net [lagg] tcpdump on lagg interface during high pps wedge o kern/122685 net It is not visible passing packets in tcpdump(1) o kern/122319 net [wi] imposible to enable ad-hoc demo mode with Orinoco o kern/122290 net [netgraph] [panic] Netgraph related "kmem_map too smal o kern/122252 net [ipmi] [bge] IPMI problem with BCM5704 (does not work o kern/122033 net [ral] [lor] Lock order reversal in ral0 at bootup ieee o bin/121895 net [patch] rtsol(8)/rtsold(8) doesn't handle managed netw s kern/121774 net [swi] [panic] 6.3 kernel panic in swi1: net o kern/121555 net [panic] Fatal trap 12: current process = 12 (swi1: net o kern/121443 net [gif] [lor] icmp6_input/nd6_lookup o kern/121437 net [vlan] Routing to layer-2 address does not work on VLA o bin/121359 net [patch] [security] ppp(8): fix local stack overflow in o kern/121257 net [tcp] TSO + natd -> slow outgoing tcp traffic o kern/121181 net [panic] Fatal trap 3: breakpoint instruction fault whi o kern/120966 net [rum] kernel panic with if_rum and WPA encryption o kern/120566 net [request]: ifconfig(8) make order of arguments more fr o kern/120304 net [netgraph] [patch] netgraph source assumes 32-bit time o kern/120266 net [udp] [panic] gnugk causes kernel panic when closing U o bin/120060 net routed(8) deletes link-level routes in the presence of o kern/119945 net [rum] [panic] rum device in hostap mode, cause kernel o kern/119791 net [nfs] UDP NFS mount of aliased IP addresses from a Sol o kern/119617 net [nfs] nfs error on wpa network when reseting/shutdown f kern/119516 net [ip6] [panic] _mtx_lock_sleep: recursed on non-recursi o kern/119432 net [arp] route add -host -iface causes arp e o kern/119225 net [wi] 7.0-RC1 no carrier with Prism 2.5 wifi card [regr o kern/118727 net [netgraph] [patch] [request] add new ng_pf module o kern/117423 net [vlan] Duplicate IP on different interfaces o bin/117339 net [patch] route(8): loading routing management commands o bin/116643 net [patch] [request] fstat(1): add INET/INET6 socket deta o kern/116185 net [iwi] if_iwi driver leads system to reboot o kern/115239 net [ipnat] panic with 'kmem_map too small' using ipnat o kern/115019 net [netgraph] ng_ether upper hook packet flow stops on ad o kern/115002 net [wi] if_wi timeout. failed allocation (busy bit). ifco o kern/114915 net [patch] [pcn] pcn (sys/pci/if_pcn.c) ethernet driver f o kern/113432 net [ucom] WARNING: attempt to net_add_domain(netgraph) af o kern/112722 net [ipsec] [udp] IP v4 udp fragmented packet reject o kern/112686 net [patm] patm driver freezes System (FreeBSD 6.2-p4) i38 o bin/112557 net [patch] ppp(8) lock file should not use symlink name o kern/112528 net [nfs] NFS over TCP under load hangs with "impossible p o kern/111537 net [inet6] [patch] ip6_input() treats mbuf cluster wrong o kern/111457 net [ral] ral(4) freeze o kern/110284 net [if_ethersubr] Invalid Assumption in SIOCSIFADDR in et o kern/110249 net [kernel] [regression] [patch] setsockopt() error regre o kern/109470 net [wi] Orinoco Classic Gold PC Card Can't Channel Hop o bin/108895 net pppd(8): PPPoE dead connections on 6.2 [regression] o kern/107944 net [wi] [patch] Forget to unlock mutex-locks o conf/107035 net [patch] bridge(8): bridge interface given in rc.conf n o kern/106444 net [netgraph] [panic] Kernel Panic on Binding to an ip to o kern/106316 net [dummynet] dummynet with multipass ipfw drops packets o kern/105945 net Address can disappear from network interface s kern/105943 net Network stack may modify read-only mbuf chain copies o bin/105925 net problems with ifconfig(8) and vlan(4) [regression] o kern/104851 net [inet6] [patch] On link routes not configured when usi o kern/104751 net [netgraph] kernel panic, when getting info about my tr o kern/103191 net Unpredictable reboot o kern/103135 net [ipsec] ipsec with ipfw divert (not NAT) encodes a pac o kern/102540 net [netgraph] [patch] supporting vlan(4) by ng_fec(4) o conf/102502 net [netgraph] [patch] ifconfig name does't rename netgrap o kern/102035 net [plip] plip networking disables parallel port printing o kern/101948 net [ipf] [panic] Kernel Panic Trap No 12 Page Fault - cau o kern/100709 net [libc] getaddrinfo(3) should return TTL info o kern/100519 net [netisr] suggestion to fix suboptimal network polling o kern/98978 net [ipf] [patch] ipfilter drops OOW packets under 6.1-Rel o kern/98597 net [inet6] Bug in FreeBSD 6.1 IPv6 link-local DAD procedu o bin/98218 net wpa_supplicant(8) blacklist not working o kern/97306 net [netgraph] NG_L2TP locks after connection with failed o conf/97014 net [gif] gifconfig_gif? in rc.conf does not recognize IPv f kern/96268 net [socket] TCP socket performance drops by 3000% if pack o kern/95519 net [ral] ral0 could not map mbuf o kern/95288 net [pppd] [tty] [panic] if_ppp panic in sys/kern/tty_subr o kern/95277 net [netinet] [patch] IP Encapsulation mask_match() return o kern/95267 net packet drops periodically appear f kern/93378 net [tcp] Slow data transfer in Postfix and Cyrus IMAP (wo o kern/93019 net [ppp] ppp and tunX problems: no traffic after restarti o kern/92880 net [libc] [patch] almost rewritten inet_network(3) functi s kern/92279 net [dc] Core faults everytime I reboot, possible NIC issu o kern/91859 net [ndis] if_ndis does not work with Asus WL-138 s kern/91777 net [ipf] [patch] wrong behaviour with skip rule inside an o kern/91364 net [ral] [wep] WF-511 RT2500 Card PCI and WEP o kern/91311 net [aue] aue interface hanging o kern/87521 net [ipf] [panic] using ipfilter "auth" keyword leads to k o kern/87421 net [netgraph] [panic]: ng_ether + ng_eiface + if_bridge o kern/86871 net [tcp] [patch] allocation logic for PCBs in TIME_WAIT s o kern/86427 net [lor] Deadlock with FASTIPSEC and nat o kern/86103 net [ipf] Illegal NAT Traversal in IPFilter o kern/85780 net 'panic: bogus refcnt 0' in routing/ipv6 o bin/85445 net ifconfig(8): deprecated keyword to ifconfig inoperativ p kern/85320 net [gre] [patch] possible depletion of kernel stack in ip o bin/82975 net route change does not parse classfull network as given o kern/82881 net [netgraph] [panic] ng_fec(4) causes kernel panic after o kern/82468 net Using 64MB tcp send/recv buffers, trafficflow stops, i o bin/82185 net [patch] ndp(8) can delete the incorrect entry o kern/81095 net IPsec connection stops working if associated network i o kern/78968 net FreeBSD freezes on mbufs exhaustion (network interface o kern/78090 net [ipf] ipf filtering on bridged packets doesn't work if o kern/77341 net [ip6] problems with IPV6 implementation s kern/77195 net [ipf] [patch] ipfilter ioctl SIOCGNATL does not match o kern/75873 net Usability problem with non-RFC-compliant IP spoof prot s kern/75407 net [an] an(4): no carrier after short time a kern/71474 net [route] route lookup does not skip interfaces marked d o kern/71469 net default route to internet magically disappears with mu o kern/70904 net [ipf] ipfilter ipnat problem with h323 proxy support o kern/68889 net [panic] m_copym, length > size of mbuf chain o kern/66225 net [netgraph] [patch] extend ng_eiface(4) control message o kern/65616 net IPSEC can't detunnel GRE packets after real ESP encryp s kern/60293 net [patch] FreeBSD arp poison patch a kern/56233 net IPsec tunnel (ESP) over IPv6: MTU computation is wrong s bin/41647 net ifconfig(8) doesn't accept lladdr along with inet addr o kern/39937 net ipstealth issue a kern/38554 net [patch] changing interface ipaddress doesn't seem to w o kern/34665 net [ipf] [hang] ipfilter rcmd proxy "hangs". o kern/31940 net ip queue length too short for >500kpps o kern/31647 net [libc] socket calls can return undocumented EINVAL o kern/30186 net [libc] getaddrinfo(3) does not handle incorrect servna o kern/27474 net [ipf] [ppp] Interactive use of user PPP and ipfilter c f kern/24959 net [patch] proper TCP_NOPUSH/TCP_CORK compatibility o conf/23063 net [arp] [patch] for static ARP tables in rc.network o kern/21998 net [socket] [patch] ident only for outgoing connections o kern/5877 net [socket] sb_cc counts control data as well as data dat 424 problems total. From owner-freebsd-net@FreeBSD.ORG Tue Oct 9 13:22:22 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B3DDB2D9 for ; Tue, 9 Oct 2012 13:22:22 +0000 (UTC) (envelope-from darcsis@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7DA108FC12 for ; Tue, 9 Oct 2012 13:22:22 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so5682679pad.13 for ; Tue, 09 Oct 2012 06:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:x-envelope-to :mail-followup-to:date:message-id:mime-version:content-type; bh=x157KgH9TaTwoROE2/gK82L2oZFawZRvMMjNkNtUKQs=; b=bihrQ8Hr59Qd2sC1euUB+tfislwC7IcFN8BUggVyzc0+rbINw+UYz59UFbnnJEMkdr nXfibU8M5sknhshpQPyat40H3FNvqMnNPD2F4G5DPY3KqSvgkDZvF2JbBejCcqlmGJ2p Hgfcjb9MXF/83JAL8lzIchZ2s8sm1tzDIAicweckV5835P5yyVBQE2HdR4D/U1cYnybo NDYzF++0Ld2TDIzuDXB3GXdEKtidUsEIIoQrMmR/3v97ShBv+m80QDEwdqQ0ngOue5vG y3hltp3Prk0rXPuRYSDdhX/jFxd2WdzZHTAONbNsblTtLxxl5rNCvQIbPMQYqy94nGBw hDEA== Received: by 10.68.222.231 with SMTP id qp7mr62990066pbc.7.1349788941921; Tue, 09 Oct 2012 06:22:21 -0700 (PDT) Received: from localhost ([125.34.64.49]) by mx.google.com with ESMTPS id j3sm12573685paz.37.2012.10.09.06.22.09 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Oct 2012 06:22:21 -0700 (PDT) From: darcsis@gmail.com (Denise H. G.) To: Andreas Nilsson Subject: Re: What driver should I use for 'intel centrino wireless-N 2200 BGN' ? In-Reply-To: (Andreas Nilsson's message of "Mon, 8 Oct 2012 16:36:03 +0000") References: <86ehl96o4i.fsf@venux.xbsd.name> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (berkeley-unix) X-Envelope-To: andrnils@gmail.com Mail-Followup-To: Andreas Nilsson , freebsd-net@freebsd.org Date: Tue, 09 Oct 2012 21:22:02 +0800 Message-ID: <86391nzsp1.fsf@venux.xbsd.name> MIME-Version: 1.0 Content-Type: text/plain Cc: freebsd-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: Tue, 09 Oct 2012 13:22:22 -0000 On 2012/10/09 at 00:36, Andreas Nilsson wrote: > > On Mon, Oct 8, 2012 at 2:21 PM, Denise H. G. wrote: >> Hi list, >> >> I tried ipw, iwn, and iwi, but ended up with no luck. What's more, it >> seems that the wireless adapter has not been even detected by the >> system. I ran 'pciconf -l' and got this line which seems to be my >> wireless adapter: >> >> none3@pci0:3:0:0: class=0x028000 card=0x42228086 chip=0x08918086 >> rev=0xc4 hdr=0x00 >> >> Is there a driver for that under FreeBSD 9.1-PRERELEASE? >> >> Thanks! >> > > Man page for iwi says > The iwi driver provides support for Intel PRO/Wireless 2200BG/2915ABG > Mine is an Intel Centrino Wireless-N 2200 BGN. > Do you have legal.intel_iwi.license_ack=1 in loader.conf ? Yes. according the man pages, I've done what is needed, but still with no luck. > > Perhaps you need to check if the device id is listed in the source > code? Thanks. I've been trying. Hope this has something to do with the device ids. > > Best regards > Andreas > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > From owner-freebsd-net@FreeBSD.ORG Tue Oct 9 13:23:57 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E80D43F6 for ; Tue, 9 Oct 2012 13:23:57 +0000 (UTC) (envelope-from darcsis@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id AF9B68FC17 for ; Tue, 9 Oct 2012 13:23:57 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so5684559pad.13 for ; Tue, 09 Oct 2012 06:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:x-envelope-to :mail-followup-to:date:message-id:mime-version:content-type; bh=0cI55LpQ8J9vxmLyEohn8YWRrTI8Eikr7ShaSP/waaE=; b=jtfPzDjxjE6A47mXqkyXkeSBSHa0Py7ePv3ogfl2oZIP5Eyupuryb5pLVhXC0NLE2j sUmTW5S+v5rAM9Sn44AqmsZQ+uGPxtbpZwqHWlDq0tsHFVbdBbrhfe5q/UzaKQiUf71b opjOfYZOsDUTDh2t4DhP9z5cWR/E21wUSsl7aMMoWCASuneBVVkyiTLkQPqKPKkAiHVM FmUHXMdUShMp5UzqzDrT2gOL/Gu6XS0CBI4KZe1zpNQ1Nh38j1qxDTbAaOZjTJvU7kvB z0uuY2Rv7qSy3aFWaV3NJgrqL8BPVxoxca2IlLbsZyDBFJ+RWlKTpq0Qn/aGCfYwAjiI pQXA== Received: by 10.66.75.132 with SMTP id c4mr53047008paw.2.1349789037501; Tue, 09 Oct 2012 06:23:57 -0700 (PDT) Received: from localhost ([125.34.64.49]) by mx.google.com with ESMTPS id qa4sm12395958pbb.70.2012.10.09.06.23.47 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Oct 2012 06:23:56 -0700 (PDT) From: darcsis@gmail.com (Denise H. G.) To: Kevin Oberman Subject: Re: What driver should I use for 'intel centrino wireless-N 2200 BGN' ? In-Reply-To: (Kevin Oberman's message of "Mon, 8 Oct 2012 09:44:26 -0700") References: <86ehl96o4i.fsf@venux.xbsd.name> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (berkeley-unix) X-Envelope-To: kob6558@gmail.com Mail-Followup-To: Kevin Oberman , Andreas Nilsson , freebsd-net@freebsd.org Date: Tue, 09 Oct 2012 21:23:41 +0800 Message-ID: <86y5jfye1u.fsf@venux.xbsd.name> MIME-Version: 1.0 Content-Type: text/plain Cc: freebsd-net@freebsd.org, Andreas Nilsson 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: Tue, 09 Oct 2012 13:23:58 -0000 On 2012/10/09 at 00:44, Kevin Oberman wrote: > > On Mon, Oct 8, 2012 at 9:36 AM, Andreas Nilsson wrote: >> On Mon, Oct 8, 2012 at 2:21 PM, Denise H. G. wrote: >> >>> Hi list, >>> >>> I tried ipw, iwn, and iwi, but ended up with no luck. What's more, it >>> seems that the wireless adapter has not been even detected by the >>> system. I ran 'pciconf -l' and got this line which seems to be my >>> wireless adapter: >>> >>> none3@pci0:3:0:0: class=0x028000 card=0x42228086 chip=0x08918086 >>> rev=0xc4 hdr=0x00 >>> >>> Is there a driver for that under FreeBSD 9.1-PRERELEASE? >>> >>> Thanks! >>> >> >> Man page for iwi says >> The iwi driver provides support for Intel PRO/Wireless 2200BG/2915ABG >> >> Do you have legal.intel_iwi.license_ack=1 in loader.conf ? >> >> Perhaps you need to check if the device id is listed in the source code? > > Yes. Some vendors (e.g. Lenovo, HP) have private PCIIDs on their > cards, so they may not be in the source. Adding them is trivial, but, > should this be the issue, please open a PR to have it added to the > source in SVN. I tried to add some device ids into the source code of the drivers, but with no luck. Maybe I am doing it the wrong way. Thanks! > -- > R. Kevin Oberman, Network Engineer > E-mail: kob6558@gmail.com > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > From owner-freebsd-net@FreeBSD.ORG Tue Oct 9 15:41:37 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 0744B6D9 for ; Tue, 9 Oct 2012 15:41:37 +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 E13108FC1A for ; Tue, 9 Oct 2012 15:41:35 +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 q99FfSxR077773 for ; Tue, 9 Oct 2012 19:41:28 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q99FfSev077772 for net@FreeBSD.org; Tue, 9 Oct 2012 19:41:28 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 9 Oct 2012 19:41:28 +0400 From: Gleb Smirnoff To: net@FreeBSD.org Subject: [CFT/Review] net byte order for AF_INET Message-ID: <20121009154128.GU34622@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Ycz6tD7Th1CMF4v7" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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: Tue, 09 Oct 2012 15:41:37 -0000 --Ycz6tD7Th1CMF4v7 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Hello, 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. 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. The patch has been tested by me on amd64 and ray@ on mips. TCP, UDP, ICMP, fragment reassembly and basic packet filtering works okay. 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. Code reviewing also appreciated. -- Totus tuus, Glebius. --Ycz6tD7Th1CMF4v7 Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="IPv4.net-byte-order.diff" Index: sys/netinet/tcp_input.c =================================================================== --- sys/netinet/tcp_input.c (revision 241370) +++ sys/netinet/tcp_input.c (working copy) @@ -645,21 +645,19 @@ ip = mtod(m, struct ip *); ipov = (struct ipovly *)ip; th = (struct tcphdr *)((caddr_t)ip + off0); - tlen = ip->ip_len; + tlen = ntohs(ip->ip_len); if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) th->th_sum = m->m_pkthdr.csum_data; else th->th_sum = in_pseudo(ip->ip_src.s_addr, - ip->ip_dst.s_addr, - htonl(m->m_pkthdr.csum_data + - ip->ip_len + - IPPROTO_TCP)); + ip->ip_dst.s_addr, + htonl(m->m_pkthdr.csum_data + tlen + + IPPROTO_TCP)); th->th_sum ^= 0xffff; #ifdef TCPDEBUG - ipov->ih_len = (u_short)tlen; - ipov->ih_len = htons(ipov->ih_len); + ipov->ih_len = ip->ip_len; #endif } else { /* @@ -667,8 +665,7 @@ */ len = sizeof (struct ip) + tlen; bzero(ipov->ih_x1, sizeof(ipov->ih_x1)); - ipov->ih_len = (u_short)tlen; - ipov->ih_len = htons(ipov->ih_len); + ipov->ih_len = ip->ip_len; th->th_sum = in_cksum(m, len); } if (th->th_sum) { Index: sys/netinet/in.h =================================================================== --- sys/netinet/in.h (revision 241370) +++ sys/netinet/in.h (working copy) @@ -741,33 +741,6 @@ #define satosin(sa) ((struct sockaddr_in *)(sa)) #define sintosa(sin) ((struct sockaddr *)(sin)) #define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) - -/* - * Historically, BSD keeps ip_len and ip_off in host format - * when doing layer 3 processing, and this often requires - * to translate the format back and forth. - * To make the process explicit, we define a couple of macros - * that also take into account the fact that at some point - * we may want to keep those fields always in net format. - */ - -#if (BYTE_ORDER == BIG_ENDIAN) || defined(HAVE_NET_IPLEN) -#define SET_NET_IPLEN(p) do {} while (0) -#define SET_HOST_IPLEN(p) do {} while (0) -#else -#define SET_NET_IPLEN(p) do { \ - struct ip *h_ip = (p); \ - h_ip->ip_len = htons(h_ip->ip_len); \ - h_ip->ip_off = htons(h_ip->ip_off); \ - } while (0) - -#define SET_HOST_IPLEN(p) do { \ - struct ip *h_ip = (p); \ - h_ip->ip_len = ntohs(h_ip->ip_len); \ - h_ip->ip_off = ntohs(h_ip->ip_off); \ - } while (0) -#endif /* !HAVE_NET_IPLEN */ - #endif /* _KERNEL */ /* INET6 stuff */ Index: sys/netinet/tcp_subr.c =================================================================== --- sys/netinet/tcp_subr.c (revision 241370) +++ sys/netinet/tcp_subr.c (working copy) @@ -584,10 +584,10 @@ #ifdef INET { tlen += sizeof (struct tcpiphdr); - ip->ip_len = tlen; + ip->ip_len = htons(tlen); ip->ip_ttl = V_ip_defttl; if (V_path_mtu_discovery) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); } #endif m->m_len = tlen; @@ -1398,12 +1398,11 @@ /* * If no alternative MTU was * proposed, try the next smaller - * one. ip->ip_len has already - * been swapped in icmp_input(). + * one. */ if (!mtu) - mtu = ip_next_mtu(ip->ip_len, - 1); + mtu = ip_next_mtu( + ntohs(ip->ip_len), 1); if (mtu < V_tcp_minmss + sizeof(struct tcpiphdr)) mtu = V_tcp_minmss Index: sys/netinet/tcp_debug.c =================================================================== --- sys/netinet/tcp_debug.c (revision 241370) +++ sys/netinet/tcp_debug.c (working copy) @@ -175,11 +175,10 @@ #ifdef INET6 isipv6 ? ntohs(((struct ip6_hdr *)ipgen)->ip6_plen) : #endif - ((struct ip *)ipgen)->ip_len; + ntohs(((struct ip *)ipgen)->ip_len); if (act == TA_OUTPUT) { seq = ntohl(seq); ack = ntohl(ack); - len = ntohs((u_short)len); } if (act == TA_OUTPUT) len -= sizeof (struct tcphdr); Index: sys/netinet/tcp_syncache.c =================================================================== --- sys/netinet/tcp_syncache.c (revision 241370) +++ sys/netinet/tcp_syncache.c (working copy) @@ -1395,7 +1395,7 @@ ip = mtod(m, struct ip *); ip->ip_v = IPVERSION; ip->ip_hl = sizeof(struct ip) >> 2; - ip->ip_len = tlen; + ip->ip_len = htons(tlen); ip->ip_id = 0; ip->ip_off = 0; ip->ip_sum = 0; @@ -1413,7 +1413,7 @@ * 2) the SCF_UNREACH flag has been set */ if (V_path_mtu_discovery && ((sc->sc_flags & SCF_UNREACH) == 0)) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); th = (struct tcphdr *)(ip + 1); } @@ -1473,7 +1473,7 @@ ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) + optlen); else #endif - ip->ip_len += optlen; + ip->ip_len = htons(ntohs(ip->ip_len) + optlen); } else optlen = 0; Index: sys/netinet/sctp_input.c =================================================================== --- sys/netinet/sctp_input.c (revision 241370) +++ sys/netinet/sctp_input.c (working copy) @@ -6038,7 +6038,7 @@ dst.sin_len = sizeof(struct sockaddr_in); dst.sin_port = sh->dest_port; dst.sin_addr = ip->ip_dst; - length = ip->ip_len + iphlen; + length = ntohs(ip->ip_len) + iphlen; /* Validate mbuf chain length with IP payload length. */ if (SCTP_HEADER_LEN(m) != length) { SCTPDBG(SCTP_DEBUG_INPUT1, Index: sys/netinet/udp_usrreq.c =================================================================== --- sys/netinet/udp_usrreq.c (revision 241370) +++ sys/netinet/udp_usrreq.c (working copy) @@ -338,7 +338,7 @@ struct udphdr *uh; struct ifnet *ifp; struct inpcb *inp; - int len; + uint16_t len, ip_len; struct ip save_ip; struct sockaddr_in udp_in; #ifdef IPFIREWALL_FORWARD @@ -392,13 +392,13 @@ * reflect UDP length, drop. */ len = ntohs((u_short)uh->uh_ulen); - if (ip->ip_len != len) { - if (len > ip->ip_len || len < sizeof(struct udphdr)) { + ip_len = ntohs(ip->ip_len); + if (ip_len != len) { + if (len > ip_len || len < sizeof(struct udphdr)) { UDPSTAT_INC(udps_badlen); goto badunlocked; } - m_adj(m, len - ip->ip_len); - /* ip->ip_len = len; */ + m_adj(m, len - ip_len); } /* @@ -601,7 +601,7 @@ if (badport_bandlim(BANDLIM_ICMP_UNREACH) < 0) goto badunlocked; *ip = save_ip; - ip->ip_len += iphlen; + ip->ip_len = htons(ip_len + iphlen); icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); return; } @@ -1206,7 +1206,7 @@ struct ip *ip; ip = (struct ip *)&ui->ui_i; - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); } ipflags = 0; @@ -1233,7 +1233,7 @@ m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); } else ui->ui_sum = 0; - ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; + ((struct ip *)ui)->ip_len = htons(sizeof(struct udpiphdr) + len); ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */ ((struct ip *)ui)->ip_tos = tos; /* XXX */ UDPSTAT_INC(udps_opackets); @@ -1383,7 +1383,7 @@ m_adj(m, skip); ip = mtod(m, struct ip *); - ip->ip_len -= skip; + ip->ip_len = htons(ntohs(ip->ip_len) - skip); ip->ip_p = IPPROTO_ESP; /* Index: sys/netinet/ip_carp.c =================================================================== --- sys/netinet/ip_carp.c (revision 241370) +++ sys/netinet/ip_carp.c (working copy) @@ -783,9 +783,9 @@ ip->ip_v = IPVERSION; ip->ip_hl = sizeof(*ip) >> 2; ip->ip_tos = IPTOS_LOWDELAY; - ip->ip_len = len; + ip->ip_len = htons(len); ip->ip_id = ip_newid(); - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); ip->ip_ttl = CARP_DFLTTL; ip->ip_p = IPPROTO_CARP; ip->ip_sum = 0; Index: sys/netinet/raw_ip.c =================================================================== --- sys/netinet/raw_ip.c (revision 241370) +++ sys/netinet/raw_ip.c (working copy) @@ -292,6 +292,7 @@ * not modify the packet except for some * byte order swaps. */ + ip->ip_len = ntohs(ip->ip_len); ip->ip_len += off; hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, @@ -449,11 +450,11 @@ ip = mtod(m, struct ip *); ip->ip_tos = inp->inp_ip_tos; if (inp->inp_flags & INP_DONTFRAG) - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); else ip->ip_off = 0; ip->ip_p = inp->inp_ip_p; - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); ip->ip_src = inp->inp_laddr; if (jailed(inp->inp_cred)) { /* @@ -495,8 +496,8 @@ * and don't allow packet length sizes that will crash. */ if (((ip->ip_hl != (sizeof (*ip) >> 2)) && inp->inp_options) - || (ip->ip_len > m->m_pkthdr.len) - || (ip->ip_len < (ip->ip_hl << 2))) { + || (ntohs(ip->ip_len) > m->m_pkthdr.len) + || (ntohs(ip->ip_len) < (ip->ip_hl << 2))) { INP_RUNLOCK(inp); m_freem(m); return (EINVAL); Index: sys/netinet/ip_divert.c =================================================================== --- sys/netinet/ip_divert.c (revision 241370) +++ sys/netinet/ip_divert.c (working copy) @@ -386,10 +386,6 @@ INP_RUNLOCK(inp); goto cantsend; } - - /* Convert fields to host order for ip_output() */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); break; #ifdef INET6 case IPV6_VERSION >> 4: Index: sys/netinet/sctp_usrreq.c =================================================================== --- sys/netinet/sctp_usrreq.c (revision 241370) +++ sys/netinet/sctp_usrreq.c (working copy) @@ -180,7 +180,7 @@ SCTP_TCB_UNLOCK(stcb); return; } - totsz = ip->ip_len; + totsz = ntohs(ip->ip_len); nxtsz = ntohs(icmph->icmp_nextmtu); if (nxtsz == 0) { Index: sys/netinet/ip_output.c =================================================================== --- sys/netinet/ip_output.c (revision 241370) +++ sys/netinet/ip_output.c (working copy) @@ -102,7 +102,6 @@ /* * IP output. The packet in mbuf chain m contains a skeletal IP * header (with len, off, ttl, proto, tos, src, dst). - * ip_len and ip_off are in host format. * The mbuf chain containing the packet will be freed. * The mbuf opt, if present, will not be freed. * If route ro is present and has ro_rt initialized, route lookup would be @@ -175,6 +174,8 @@ hlen = len; /* ip->ip_hl is updated above */ } ip = mtod(m, struct ip *); + ip_len = ntohs(ip->ip_len); + ip_off = ntohs(ip->ip_off); /* * Fill in IP header. If we are not allowing fragmentation, @@ -442,7 +443,7 @@ * packet or packet fragments, unless ALTQ is enabled on the given * interface in which case packetdrop should be done by queueing. */ - n = ip->ip_len / mtu + 1; /* how many fragments ? */ + n = ip_len / mtu + 1; /* how many fragments ? */ if ( #ifdef ALTQ (!ALTQ_IS_ENABLED(&ifp->if_snd)) && @@ -469,7 +470,7 @@ goto bad; } /* don't allow broadcast messages to be fragmented */ - if (ip->ip_len > mtu) { + if (ip_len > mtu) { error = EMSGSIZE; goto bad; } @@ -502,12 +503,6 @@ hlen = ip->ip_hl << 2; #endif /* IPSEC */ - /* - * To network byte order. pfil(9) hooks and ip_fragment() expect this. - */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - /* Jump over all PFIL processing if hooks are not active. */ if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; @@ -544,8 +539,6 @@ } else { if (ia != NULL) ifa_free(&ia->ia_ifa); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto again; /* Redo the routing table lookup. */ } } @@ -579,16 +572,11 @@ m_tag_delete(m, fwd_tag); if (ia != NULL) ifa_free(&ia->ia_ifa); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto again; } #endif /* IPFIREWALL_FORWARD */ passout: - ip_len = ntohs(ip->ip_len); - ip_off = ntohs(ip->ip_off); - /* 127/8 must not appear on wire - RFC1122. */ if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { @@ -1295,8 +1283,6 @@ * calls the output routine of the loopback "driver", but with an interface * pointer that might NOT be a loopback interface -- evil, but easier than * replicating that code here. - * - * IP header in host byte order. */ static void ip_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in *dst, @@ -1326,8 +1312,6 @@ * than the interface's MTU. Can this possibly matter? */ ip = mtod(copym, struct ip *); - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(copym, hlen); #if 1 /* XXX */ Index: sys/netinet/in_gif.c =================================================================== --- sys/netinet/in_gif.c (revision 241370) +++ sys/netinet/in_gif.c (working copy) @@ -192,7 +192,7 @@ iphdr.ip_p = proto; /* version will be set in ip_output() */ iphdr.ip_ttl = V_ip_gif_ttl; - iphdr.ip_len = m->m_pkthdr.len + sizeof(struct ip); + iphdr.ip_len = htons(m->m_pkthdr.len + sizeof(struct ip)); ip_ecn_ingress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED : ECN_NOCARE, &iphdr.ip_tos, &tos); Index: sys/netinet/ip_options.c =================================================================== --- sys/netinet/ip_options.c (revision 241370) +++ sys/netinet/ip_options.c (working copy) @@ -494,7 +494,7 @@ unsigned optlen; optlen = opt->m_len - sizeof(p->ipopt_dst); - if (optlen + ip->ip_len > IP_MAXPACKET) { + if (optlen + ntohs(ip->ip_len) > IP_MAXPACKET) { *phlen = 0; return (m); /* XXX should fail */ } @@ -527,7 +527,7 @@ *phlen = sizeof(struct ip) + optlen; ip->ip_v = IPVERSION; ip->ip_hl = *phlen >> 2; - ip->ip_len += optlen; + ip->ip_len = htons(ntohs(ip->ip_len) + optlen); return (m); } Index: sys/netinet/tcp_timewait.c =================================================================== --- sys/netinet/tcp_timewait.c (revision 241370) +++ sys/netinet/tcp_timewait.c (working copy) @@ -593,9 +593,9 @@ m->m_pkthdr.csum_flags = CSUM_TCP; th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(sizeof(struct tcphdr) + optlen + IPPROTO_TCP)); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); if (V_path_mtu_discovery) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); error = ip_output(m, inp->inp_options, NULL, ((tw->tw_so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), NULL, inp); Index: sys/netinet/tcp_output.c =================================================================== --- sys/netinet/tcp_output.c (revision 241370) +++ sys/netinet/tcp_output.c (working copy) @@ -1239,7 +1239,7 @@ struct route ro; bzero(&ro, sizeof(ro)); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); #ifdef INET6 if (tp->t_inpcb->inp_vflag & INP_IPV6PROTO) ip->ip_ttl = in6_selecthlim(tp->t_inpcb, NULL); @@ -1253,7 +1253,7 @@ * NB: Don't set DF on small MTU/MSS to have a safe fallback. */ if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); error = ip_output(m, tp->t_inpcb->inp_options, &ro, ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0, Index: sys/netinet/sctputil.c =================================================================== --- sys/netinet/sctputil.c (revision 241370) +++ sys/netinet/sctputil.c (working copy) @@ -6821,7 +6821,7 @@ switch (iph->ip_v) { #ifdef INET case IPVERSION: - iph->ip_len -= sizeof(struct udphdr); + iph->ip_len = ntohs(htons(iph->ip_len) - sizeof(struct udphdr)); sctp_input_with_port(m, off, port); break; #endif Index: sys/netinet/ip_input.c =================================================================== --- sys/netinet/ip_input.c (revision 241370) +++ sys/netinet/ip_input.c (working copy) @@ -390,9 +390,8 @@ m->m_flags &= ~M_FASTFWD_OURS; /* Set up some basics that will be used later. */ ip = mtod(m, struct ip *); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); hlen = ip->ip_hl << 2; + ip_len = ntohs(ip->ip_len); goto ours; } @@ -513,8 +512,6 @@ #ifdef IPFIREWALL_FORWARD if (m->m_flags & M_FASTFWD_OURS) { m->m_flags &= ~M_FASTFWD_OURS; - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto ours; } if ((dchg = (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL)) != 0) { @@ -523,20 +520,12 @@ * packets originally destined to us to some other directly * connected host. */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); ip_forward(m, dchg); return; } #endif /* IPFIREWALL_FORWARD */ passin: - /* - * From now and up to output pfil(9) processing in ip_output() - * the header is in host byte order. - */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); /* * Process options and, if not destined for us, @@ -732,20 +721,21 @@ * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. */ - if (ip->ip_off & (IP_MF | IP_OFFMASK)) { + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) { m = ip_reass(m); if (m == NULL) return; ip = mtod(m, struct ip *); /* Get the header length of the reassembled packet */ hlen = ip->ip_hl << 2; + ip_len = ntohs(ip->ip_len); } /* * Further protocols expect the packet length to be w/o the * IP header. */ - ip->ip_len -= hlen; + ip->ip_len = htons(ip_len - hlen); #ifdef IPSEC /* @@ -914,22 +904,21 @@ * Adjust ip_len to not reflect header, * convert offset of this to bytes. */ - ip->ip_len -= hlen; - if (ip->ip_off & IP_MF) { + ip->ip_len = htons(ntohs(ip->ip_len) - hlen); + if (ip->ip_off & htons(IP_MF)) { /* * Make sure that fragments have a data length * that's a non-zero multiple of 8 bytes. */ - if (ip->ip_len == 0 || (ip->ip_len & 0x7) != 0) { + if (ip->ip_len == 0 || (ip->ip_len & htons(0x7)) != 0) { IPSTAT_INC(ips_toosmall); /* XXX */ goto dropfrag; } m->m_flags |= M_FRAG; } else m->m_flags &= ~M_FRAG; - ip->ip_off <<= 3; + ip->ip_off = htons(ntohs(ip->ip_off) << 3); - /* * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. @@ -1000,7 +989,7 @@ * Find a segment which begins after this one does. */ for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) - if (GETIP(q)->ip_off > ip->ip_off) + if (ntohs(GETIP(q)->ip_off) > ntohs(ip->ip_off)) break; /* @@ -1013,14 +1002,15 @@ * segment, then it's checksum is invalidated. */ if (p) { - i = GETIP(p)->ip_off + GETIP(p)->ip_len - ip->ip_off; + i = ntohs(GETIP(p)->ip_off) + ntohs(GETIP(p)->ip_len) - + ntohs(ip->ip_off); if (i > 0) { - if (i >= ip->ip_len) + if (i >= ntohs(ip->ip_len)) goto dropfrag; m_adj(m, i); m->m_pkthdr.csum_flags = 0; - ip->ip_off += i; - ip->ip_len -= i; + ip->ip_off = htons(ntohs(ip->ip_off) + i); + ip->ip_len = htons(ntohs(ip->ip_len) - i); } m->m_nextpkt = p->m_nextpkt; p->m_nextpkt = m; @@ -1033,12 +1023,13 @@ * While we overlap succeeding segments trim them or, * if they are completely covered, dequeue them. */ - for (; q != NULL && ip->ip_off + ip->ip_len > GETIP(q)->ip_off; - q = nq) { - i = (ip->ip_off + ip->ip_len) - GETIP(q)->ip_off; - if (i < GETIP(q)->ip_len) { - GETIP(q)->ip_len -= i; - GETIP(q)->ip_off += i; + for (; q != NULL && ntohs(ip->ip_off) + ntohs(ip->ip_len) > + ntohs(GETIP(q)->ip_off); q = nq) { + i = (ntohs(ip->ip_off) + ntohs(ip->ip_len)) - + ntohs(GETIP(q)->ip_off); + if (i < ntohs(GETIP(q)->ip_len)) { + GETIP(q)->ip_len = htons(ntohs(GETIP(q)->ip_len) - i); + GETIP(q)->ip_off = htons(ntohs(GETIP(q)->ip_off) + i); m_adj(q, i); q->m_pkthdr.csum_flags = 0; break; @@ -1062,14 +1053,14 @@ */ next = 0; for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) { - if (GETIP(q)->ip_off != next) { + if (ntohs(GETIP(q)->ip_off) != next) { if (fp->ipq_nfrags > V_maxfragsperpacket) { IPSTAT_ADD(ips_fragdropped, fp->ipq_nfrags); ip_freef(head, fp); } goto done; } - next += GETIP(q)->ip_len; + next += ntohs(GETIP(q)->ip_len); } /* Make sure the last packet didn't have the IP_MF flag */ if (p->m_flags & M_FRAG) { @@ -1125,7 +1116,7 @@ * packet; dequeue and discard fragment reassembly header. * Make header visible. */ - ip->ip_len = (ip->ip_hl << 2) + next; + ip->ip_len = htons((ip->ip_hl << 2) + next); ip->ip_src = fp->ipq_src; ip->ip_dst = fp->ipq_dst; TAILQ_REMOVE(head, fp, ipq_list); @@ -1365,8 +1356,6 @@ * * The srcrt parameter indicates whether the packet is being forwarded * via a source route. - * - * IP header in host byte order. */ void ip_forward(struct mbuf *m, int srcrt) @@ -1436,7 +1425,7 @@ mcopy = NULL; } if (mcopy != NULL) { - mcopy->m_len = min(ip->ip_len, M_TRAILINGSPACE(mcopy)); + mcopy->m_len = min(ntohs(ip->ip_len), M_TRAILINGSPACE(mcopy)); mcopy->m_pkthdr.len = mcopy->m_len; m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t)); } @@ -1564,7 +1553,7 @@ if (ia != NULL) mtu = ia->ia_ifp->if_mtu; else - mtu = ip_next_mtu(ip->ip_len, 0); + mtu = ip_next_mtu(ntohs(ip->ip_len), 0); } IPSTAT_INC(ips_cantfrag); break; Index: sys/netinet/siftr.c =================================================================== --- sys/netinet/siftr.c (revision 241370) +++ sys/netinet/siftr.c (working copy) @@ -952,7 +952,8 @@ * the mbuf cluster "at" at offset "offset" bytes from * the beginning of the "at" mbuf's data pointer. */ - th->th_sum = in_cksum_skip(*m, ip->ip_len, ip_hl); + th->th_sum = in_cksum_skip(*m, ntohs(ip->ip_len), + ip_hl); } /* Index: sys/netinet/ip_icmp.c =================================================================== --- sys/netinet/ip_icmp.c (revision 241370) +++ sys/netinet/ip_icmp.c (working copy) @@ -200,7 +200,7 @@ */ if (n->m_flags & M_DECRYPTED) goto freeit; - if (oip->ip_off & ~(IP_MF|IP_DF)) + if (oip->ip_off & htons(~(IP_MF|IP_DF))) goto freeit; if (n->m_flags & (M_BCAST|M_MCAST)) goto freeit; @@ -234,16 +234,17 @@ tcphlen = th->th_off << 2; if (tcphlen < sizeof(struct tcphdr)) goto freeit; - if (oip->ip_len < oiphlen + tcphlen) + if (ntohs(oip->ip_len) < oiphlen + tcphlen) goto freeit; if (oiphlen + tcphlen > n->m_len && n->m_next == NULL) goto stdreply; if (n->m_len < oiphlen + tcphlen && ((n = m_pullup(n, oiphlen + tcphlen)) == NULL)) goto freeit; - icmpelen = max(tcphlen, min(V_icmp_quotelen, oip->ip_len - oiphlen)); + icmpelen = max(tcphlen, min(V_icmp_quotelen, + ntohs(oip->ip_len) - oiphlen)); } else -stdreply: icmpelen = max(8, min(V_icmp_quotelen, oip->ip_len - oiphlen)); +stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); icmplen = min(oiphlen + icmpelen, nlen); if (icmplen < sizeof(struct ip)) @@ -293,8 +294,6 @@ */ m_copydata(n, 0, icmplen, (caddr_t)&icp->icmp_ip); nip = &icp->icmp_ip; - nip->ip_len = htons(nip->ip_len); - nip->ip_off = htons(nip->ip_off); /* * Set up ICMP message mbuf and copy old IP header (without options @@ -309,7 +308,7 @@ m->m_pkthdr.rcvif = n->m_pkthdr.rcvif; nip = mtod(m, struct ip *); bcopy((caddr_t)oip, (caddr_t)nip, sizeof(struct ip)); - nip->ip_len = m->m_len; + nip->ip_len = htons(m->m_len); nip->ip_v = IPVERSION; nip->ip_hl = 5; nip->ip_p = IPPROTO_ICMP; @@ -331,7 +330,7 @@ struct ip *ip = mtod(m, struct ip *); struct sockaddr_in icmpsrc, icmpdst, icmpgw; int hlen = off; - int icmplen = ip->ip_len; + int icmplen = ntohs(ip->ip_len); int i, code; void (*ctlfunc)(int, struct sockaddr *, void *); int fibnum; @@ -472,7 +471,6 @@ ICMPSTAT_INC(icps_badlen); goto freeit; } - icp->icmp_ip.ip_len = ntohs(icp->icmp_ip.ip_len); /* Discard ICMP's in response to multicast packets */ if (IN_MULTICAST(ntohl(icp->icmp_ip.ip_dst.s_addr))) goto badcode; @@ -565,7 +563,8 @@ } ifa_free(&ia->ia_ifa); reflect: - ip->ip_len += hlen; /* since ip_input deducts this */ + /* Since ip_input() deducts this. */ + ip->ip_len = htons(ntohs(ip->ip_len) + hlen); ICMPSTAT_INC(icps_reflect); ICMPSTAT_INC(icps_outhist[icp->icmp_type]); icmp_reflect(m); @@ -835,7 +834,7 @@ * Now strip out original options by copying rest of first * mbuf's data back, and adjust the IP length. */ - ip->ip_len -= optlen; + ip->ip_len = htons(ntohs(ip->ip_len) - optlen); ip->ip_v = IPVERSION; ip->ip_hl = 5; m->m_len -= optlen; @@ -869,7 +868,7 @@ m->m_len -= hlen; icp = mtod(m, struct icmp *); icp->icmp_cksum = 0; - icp->icmp_cksum = in_cksum(m, ip->ip_len - hlen); + icp->icmp_cksum = in_cksum(m, ntohs(ip->ip_len) - hlen); m->m_data -= hlen; m->m_len += hlen; m->m_pkthdr.rcvif = (struct ifnet *)0; Index: sys/netinet/ip_gre.c =================================================================== --- sys/netinet/ip_gre.c (revision 241370) +++ sys/netinet/ip_gre.c (working copy) @@ -274,12 +274,10 @@ /* * On FreeBSD, rip_input() supplies us with ip->ip_len - * already converted into host byteorder and also decreases - * it by the lengh of IP header, however, ip_input() expects - * that this field is in the original format (network byteorder - * and full size of IP packet), so that adjust accordingly. + * decreased by the lengh of IP header, however, ip_input() + * expects it to be full size of IP packet, so adjust accordingly. */ - ip->ip_len = htons(ip->ip_len + sizeof(struct ip) - msiz); + ip->ip_len = htons(ntohs(ip->ip_len) + sizeof(struct ip) - msiz); ip->ip_sum = 0; ip->ip_sum = in_cksum(m, (ip->ip_hl << 2)); Index: sys/netinet/ip_ipsec.c =================================================================== --- sys/netinet/ip_ipsec.c (revision 241370) +++ sys/netinet/ip_ipsec.c (working copy) @@ -264,7 +264,6 @@ { #ifdef IPSEC struct secpolicy *sp = NULL; - struct ip *ip = mtod(*m, struct ip *); struct tdb_ident *tdbi; struct m_tag *mtag; int s; @@ -332,9 +331,6 @@ } } - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - /* * Do delayed checksums now because we send before * this is done in the normal processing path. @@ -345,6 +341,8 @@ } #ifdef SCTP if ((*m)->m_pkthdr.csum_flags & CSUM_SCTP) { + struct ip *ip = mtod(*m, struct ip *); + sctp_delayed_cksum(*m, (uint32_t)(ip->ip_hl << 2)); (*m)->m_pkthdr.csum_flags &= ~CSUM_SCTP; } @@ -359,8 +357,6 @@ * IPsec processing and return without error. */ *error = 0; - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto done; } /* Index: sys/netinet/ip_mroute.c =================================================================== --- sys/netinet/ip_mroute.c (revision 241370) +++ sys/netinet/ip_mroute.c (working copy) @@ -1493,7 +1493,7 @@ { struct ip *ip = mtod(m, struct ip *); vifi_t vifi; - int plen = ip->ip_len; + int plen = ntohs(ip->ip_len); VIF_LOCK_ASSERT(); @@ -2376,10 +2376,7 @@ /* Take care of delayed checksums */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - /* XXX: in_delayed_cksum() expects net byte order */ - ip->ip_len = htons(ip->ip_len); in_delayed_cksum(m); - ip->ip_len = ntohs(ip->ip_len); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } @@ -2401,10 +2398,8 @@ /* Compute the MTU after the PIM Register encapsulation */ mtu = 0xffff - sizeof(pim_encap_iphdr) - sizeof(pim_encap_pimhdr); - if (ip->ip_len <= mtu) { + if (ntohs(ip->ip_len) <= mtu) { /* Turn the IP header into a valid one */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(mb_copy, ip->ip_hl << 2); } else { @@ -2509,7 +2504,8 @@ ip_outer = mtod(mb_first, struct ip *); *ip_outer = pim_encap_iphdr; ip_outer->ip_id = ip_newid(); - ip_outer->ip_len = len + sizeof(pim_encap_iphdr) + sizeof(pim_encap_pimhdr); + ip_outer->ip_len = htons(len + sizeof(pim_encap_iphdr) + + sizeof(pim_encap_pimhdr)); ip_outer->ip_src = V_viftable[vifi].v_lcl_addr; ip_outer->ip_dst = rt->mfc_rp; /* @@ -2517,8 +2513,8 @@ * IP_DF bit. */ ip_outer->ip_tos = ip->ip_tos; - if (ntohs(ip->ip_off) & IP_DF) - ip_outer->ip_off |= IP_DF; + if (ip->ip_off & htons(IP_DF)) + ip_outer->ip_off |= htons(IP_DF); pimhdr = (struct pim_encap_pimhdr *)((caddr_t)ip_outer + sizeof(pim_encap_iphdr)); *pimhdr = pim_encap_pimhdr; @@ -2571,7 +2567,7 @@ struct ip *ip = mtod(m, struct ip *); struct pim *pim; int minlen; - int datalen = ip->ip_len; + int datalen = ntohs(ip->ip_len); int ip_tos; int iphlen = off; Index: sys/netinet/sctp_output.c =================================================================== --- sys/netinet/sctp_output.c (revision 241370) +++ sys/netinet/sctp_output.c (working copy) @@ -3980,7 +3980,7 @@ tos_value |= sctp_get_ect(stcb); } if ((nofragment_flag) && (port == 0)) { - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); } else ip->ip_off = 0; @@ -3988,7 +3988,7 @@ ip->ip_id = ip_newid(); ip->ip_ttl = inp->ip_inp.inp.inp_ip_ttl; - ip->ip_len = packet_length; + ip->ip_len = htons(packet_length); ip->ip_tos = tos_value; if (port) { ip->ip_p = IPPROTO_UDP; @@ -10991,7 +10991,7 @@ udp->uh_sum = 0; } } - ip->ip_len = len; + ip->ip_len = htons(len); if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); Index: sys/netinet/igmp.c =================================================================== --- sys/netinet/igmp.c (revision 241370) +++ sys/netinet/igmp.c (working copy) @@ -1442,7 +1442,7 @@ ip = mtod(m, struct ip *); iphlen = off; - igmplen = ip->ip_len; + igmplen = ntohs(ip->ip_len); /* * Validate lengths. @@ -2225,7 +2225,7 @@ ip = mtod(m, struct ip *); ip->ip_tos = 0; - ip->ip_len = sizeof(struct ip) + sizeof(struct igmp); + ip->ip_len = htons(sizeof(struct ip) + sizeof(struct igmp)); ip->ip_off = 0; ip->ip_p = IPPROTO_IGMP; ip->ip_src.s_addr = INADDR_ANY; @@ -3522,8 +3522,8 @@ ip = mtod(m, struct ip *); ip->ip_tos = IPTOS_PREC_INTERNETCONTROL; - ip->ip_len = hdrlen + igmpreclen; - ip->ip_off = IP_DF; + ip->ip_len = htons(hdrlen + igmpreclen); + ip->ip_off = htons(IP_DF); ip->ip_p = IPPROTO_IGMP; ip->ip_sum = 0; Index: sys/netinet6/ip6_ipsec.c =================================================================== --- sys/netinet6/ip6_ipsec.c (revision 241370) +++ sys/netinet6/ip6_ipsec.c (working copy) @@ -295,15 +295,9 @@ */ #ifdef INET if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - struct ip *ip; - ipseclog((LOG_DEBUG, "%s: we do not support IPv4 over IPv6", __func__)); - /* XXX: in_delayed_cksum() expects net byte order */ - ip = mtod(*m, struct ip *); - ip->ip_len = htons(ip->ip_len); in_delayed_cksum(*m); - ip->ip_len = ntohs(ip->ip_len); (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } #endif Index: sys/netpfil/pf/pf.c =================================================================== --- sys/netpfil/pf/pf.c (revision 241370) +++ sys/netpfil/pf/pf.c (working copy) @@ -2252,8 +2252,8 @@ h->ip_v = 4; h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; - h->ip_off = V_path_mtu_discovery ? IP_DF : 0; - h->ip_len = len; + h->ip_off = V_path_mtu_discovery ? htons(IP_DF) : 0; + h->ip_len = htons(len); h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; @@ -2316,17 +2316,8 @@ switch (af) { #ifdef INET case AF_INET: - { - struct ip *ip; - - /* icmp_error() expects host byte ordering */ - ip = mtod(m0, struct ip *); - NTOHS(ip->ip_len); - NTOHS(ip->ip_off); - pfse->pfse_type = PFSE_ICMP; break; - } #endif /* INET */ #ifdef INET6 case AF_INET6: Index: sys/netpfil/pf/if_pfsync.c =================================================================== --- sys/netpfil/pf/if_pfsync.c (revision 241370) +++ sys/netpfil/pf/if_pfsync.c (working copy) @@ -1384,7 +1384,7 @@ ip->ip_hl = sizeof(sc->sc_template) >> 2; ip->ip_tos = IPTOS_LOWDELAY; /* len and id are set later. */ - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); ip->ip_ttl = PFSYNC_DFLTTL; ip->ip_p = IPPROTO_PFSYNC; ip->ip_src.s_addr = INADDR_ANY; @@ -1522,7 +1522,7 @@ bcopy(&sc->sc_template, ip, sizeof(*ip)); offset = sizeof(*ip); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); ip->ip_id = htons(ip_randomid()); /* build the pfsync header */ Index: sys/netpfil/ipfw/ip_fw_dynamic.c =================================================================== --- sys/netpfil/ipfw/ip_fw_dynamic.c (revision 241370) +++ sys/netpfil/ipfw/ip_fw_dynamic.c (working copy) @@ -1017,8 +1017,7 @@ h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; h->ip_off = 0; - /* ip_len must be in host format for ip_output */ - h->ip_len = len; + h->ip_len = htons(len); h->ip_ttl = V_ip_defttl; h->ip_sum = 0; break; Index: sys/netpfil/ipfw/ip_fw_pfil.c =================================================================== --- sys/netpfil/ipfw/ip_fw_pfil.c (revision 241370) +++ sys/netpfil/ipfw/ip_fw_pfil.c (working copy) @@ -431,7 +431,6 @@ int hlen; struct mbuf *reass; - SET_HOST_IPLEN(ip); /* ip_reass wants host order */ reass = ip_reass(clone); /* Reassemble packet. */ if (reass == NULL) return 0; /* not an error */ @@ -442,7 +441,6 @@ */ ip = mtod(reass, struct ip *); hlen = ip->ip_hl << 2; - SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Index: sys/netpfil/ipfw/ip_dn_io.c =================================================================== --- sys/netpfil/ipfw/ip_dn_io.c (revision 241370) +++ sys/netpfil/ipfw/ip_dn_io.c (working copy) @@ -658,13 +658,10 @@ switch (dst) { case DIR_OUT: - SET_HOST_IPLEN(mtod(m, struct ip *)); ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL); break ; case DIR_IN : - /* put header in network format for ip_input() */ - //SET_NET_IPLEN(mtod(m, struct ip *)); netisr_dispatch(NETISR_IP, m); break; Index: sys/netpfil/ipfw/ip_fw2.c =================================================================== --- sys/netpfil/ipfw/ip_fw2.c (revision 241370) +++ sys/netpfil/ipfw/ip_fw2.c (working copy) @@ -627,8 +627,6 @@ m_adj(m, args->L3offset); #endif if (code != ICMP_REJECT_RST) { /* Send an ICMP unreach */ - /* We need the IP header in host order for icmp_error(). */ - SET_HOST_IPLEN(ip); icmp_error(args->m, ICMP_UNREACH, code, 0L, 0); } else if (args->f_id.proto == IPPROTO_TCP) { struct tcphdr *const tcp = @@ -2418,11 +2416,6 @@ /* if not fragmented, go to next rule */ if ((ip_off & (IP_MF | IP_OFFMASK)) == 0) break; - /* - * ip_reass() expects len & off in host - * byte order. - */ - SET_HOST_IPLEN(ip); args->m = m = ip_reass(m); @@ -2436,7 +2429,6 @@ ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; - SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Index: sys/netipsec/ipsec.c =================================================================== --- sys/netipsec/ipsec.c (revision 241370) +++ sys/netipsec/ipsec.c (working copy) @@ -597,10 +597,9 @@ IPSEC_ASSERT(m != NULL, ("null mbuf")); IPSEC_ASSERT(m->m_pkthdr.len >= sizeof(struct ip),("packet too short")); - /* NB: ip_input() flips it into host endian. XXX Need more checking. */ if (m->m_len >= sizeof (struct ip)) { struct ip *ip = mtod(m, struct ip *); - if (ip->ip_off & (IP_MF | IP_OFFMASK)) + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) goto done; #ifdef _IP_VHL off = _IP_VHL_HL(ip->ip_vhl) << 2; @@ -612,7 +611,7 @@ struct ip ih; m_copydata(m, 0, sizeof (struct ip), (caddr_t) &ih); - if (ih.ip_off & (IP_MF | IP_OFFMASK)) + if (ih.ip_off & htons(IP_MF | IP_OFFMASK)) goto done; #ifdef _IP_VHL off = _IP_VHL_HL(ih.ip_vhl) << 2; Index: sys/netgraph/ng_ipfw.c =================================================================== --- sys/netgraph/ng_ipfw.c (revision 241370) +++ sys/netgraph/ng_ipfw.c (working copy) @@ -265,7 +265,6 @@ switch (ip->ip_v) { #ifdef INET case IPVERSION: - SET_HOST_IPLEN(ip); return (ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL)); #endif Index: sys/net/if_stf.c =================================================================== --- sys/net/if_stf.c (revision 241370) +++ sys/net/if_stf.c (working copy) @@ -523,7 +523,7 @@ bcopy(&in4, &ip->ip_dst, sizeof(ip->ip_dst)); ip->ip_p = IPPROTO_IPV6; ip->ip_ttl = ip_stf_ttl; - ip->ip_len = m->m_pkthdr.len; /*host order*/ + ip->ip_len = htons(m->m_pkthdr.len); if (ifp->if_flags & IFF_LINK1) ip_ecn_ingress(ECN_ALLOWED, &ip->ip_tos, &tos); else Index: sys/net/if_gre.c =================================================================== --- sys/net/if_gre.c (revision 241370) +++ sys/net/if_gre.c (working copy) @@ -356,7 +356,7 @@ * RFC2004 specifies that fragmented diagrams shouldn't * be encapsulated. */ - if (ip->ip_off & (IP_MF | IP_OFFMASK)) { + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) { _IF_DROP(&ifp->if_snd); m_freem(m); error = EINVAL; /* is there better errno? */ @@ -410,7 +410,7 @@ } ip = mtod(m, struct ip *); memcpy((caddr_t)(ip + 1), &mob_h, (unsigned)msiz); - ip->ip_len = ntohs(ip->ip_len) + msiz; + ip->ip_len = htons(ntohs(ip->ip_len) + msiz); } else { /* AF_INET */ _IF_DROP(&ifp->if_snd); m_freem(m); --Ycz6tD7Th1CMF4v7-- From owner-freebsd-net@FreeBSD.ORG Tue Oct 9 20:36:41 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 61B4060F; Tue, 9 Oct 2012 20:36:41 +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 153458FC18; Tue, 9 Oct 2012 20:36:40 +0000 (UTC) Received: by mail-ia0-f182.google.com with SMTP id k10so1506377iag.13 for ; Tue, 09 Oct 2012 13:36:40 -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 :content-transfer-encoding:message-id:references:to:x-mailer; bh=lJf2GEMPcpXKxuHRjeQjL2egP9L84RMY4PW8owFsxV4=; b=NYcI5qY4L6j62OQPPf9FQ0cSEi6kQxMRgKtaVdBB3h3sWK8tATWnW2jLY6yy2pZvb/ 2J7OCpSD05bB8eVbBDd3KHzsN73Z1tXLpOfFzDN86Ln0YfsTVShhYb6ZvhpvxiK1+0I1 RLP4UXBfQucjLBKdM3I6dSi5RhArv2lmIiqvv7f7uQ8XVzLHA5y/xggPJ3HVxYUqFnqu rDogcBRS9Xk9+tMefssd4d3fJTU8g6E02NYih9NCUpmJAK/enjr99zRs1OwtfgXBX9Kz 0FLMMk03O4Mo6ZwwnCNJZ34qUWfzjAT5NnBDiy8ClDFc+cv5e97pcTjAoB07bDfO2Qou +BXw== Received: by 10.50.150.167 with SMTP id uj7mr3100194igb.33.1349815000154; Tue, 09 Oct 2012 13:36:40 -0700 (PDT) Received: from guysmbp.dyn.palisadesys.com ([216.81.189.9]) by mx.google.com with ESMTPS id pp3sm10805308igb.8.2012.10.09.13.36.38 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Oct 2012 13:36:39 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.1 \(1498\)) Subject: Re: 8.3: kernel panic in bpf.c catchpacket() From: Guy Helmer In-Reply-To: <4B5399BF-4EE0-4182-8297-3BB97C4AA884@gmail.com> Date: Tue, 9 Oct 2012 15:36:33 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <59F9A36E-3DB2-4F6F-BB2A-A4C9DA76A70C@gmail.com> References: <4B5399BF-4EE0-4182-8297-3BB97C4AA884@gmail.com> To: FreeBSD Stable , freebsd-net@freebsd.org X-Mailer: Apple Mail (2.1498) 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: Tue, 09 Oct 2012 20:36:41 -0000 On Oct 8, 2012, at 8:09 AM, Guy Helmer wrote: > I'm seeing a consistent new kernel panic in FreeBSD 8.3: >=20 > #0 doadump () at pcpu.h:224 > 224 __asm("movq %%gs:0,%0" : "=3Dr" (td)); > (kgdb) #0 doadump () at pcpu.h:224 > #1 0xffffffff804c82e0 in boot (howto=3D260) at = ../../../kern/kern_shutdown.c:441 > #2 0xffffffff804c8763 in panic (fmt=3D0x0) at = ../../../kern/kern_shutdown.c:614 > #3 0xffffffff8069f3cd in trap_fatal (frame=3D0xffffffff809ecfc0, = eva=3DVariable "eva" is not available.) > at ../../../amd64/amd64/trap.c:825 > #4 0xffffffff8069f701 in trap_pfault (frame=3D0xffffff800014a8b0, = usermode=3D0) > at ../../../amd64/amd64/trap.c:741 > #5 0xffffffff8069fadf in trap (frame=3D0xffffff800014a8b0) > at ../../../amd64/amd64/trap.c:478 > #6 0xffffffff806870f4 in calltrap () at = ../../../amd64/amd64/exception.S:228 > #7 0xffffffff8069d026 in bcopy () at = ../../../amd64/amd64/support.S:124 > #8 0xffffffff8056ea8e in catchpacket (d=3D0xffffff00aee2c600,=20 > pkt=3D0xffffff00253ac600 "", pktlen=3D1434, snaplen=3DVariable = "snaplen" is not available.) > at ../../../net/bpf.c:2005 > #9 0xffffffff8056f0e5 in bpf_mtap (bp=3D0xffffff0001be1780,=20 > m=3D0xffffff00253ac600) at ../../../net/bpf.c:1832 > #10 0xffffffff80579035 in ether_input (ifp=3D0xffffff0001b73800,=20 > m=3D0xffffff00253ac600) at ../../../net/if_ethersubr.c:635 > #11 0xffffffff802b694a in em_rxeof (rxr=3D0xffffff0001bca200, = count=3D99, done=3D0x0) > at ../../../dev/e1000/if_em.c:4404 > #12 0xffffffff802b6db8 in em_handle_que (context=3DVariable "context" = is not available.) > at ../../../dev/e1000/if_em.c:1494 > #13 0xffffffff80506de5 in taskqueue_run_locked = (queue=3D0xffffff0001bdd600) > at ../../../kern/subr_taskqueue.c:250 > #14 0xffffffff80506f7e in taskqueue_thread_loop (arg=3DVariable "arg" = is not available.) > at ../../../kern/subr_taskqueue.c:387 > #15 0xffffffff8049da2f in fork_exit ( > callout=3D0xffffffff80506f30 ,=20 > arg=3D0xffffff8000945768, frame=3D0xffffff800014ac50) > at ../../../kern/kern_fork.c:876 > #16 0xffffffff8068763e in fork_trampoline () > at ../../../amd64/amd64/exception.S:602 > #17 0x0000000000000000 in ?? () >=20 > (kgdb) frame 8 > #8 0xffffffff8056ea8e in catchpacket (d=3D0xffffff00aee2c600,=20 > pkt=3D0xffffff00253ac600 "", pktlen=3D1434, snaplen=3DVariable = "snaplen" is not available. > ) > at ../../../net/bpf.c:2005 > 2005 bpf_append_bytes(d, d->bd_sbuf, curlen, &hdr, = sizeof(hdr)); > (kgdb) list > 2000 bzero(&hdr, sizeof(hdr)); > 2001 hdr.bh_tstamp =3D *tv; > 2002 hdr.bh_datalen =3D pktlen; > 2003 hdr.bh_hdrlen =3D hdrlen; > 2004 hdr.bh_caplen =3D totlen - hdrlen; > 2005 bpf_append_bytes(d, d->bd_sbuf, curlen, &hdr, = sizeof(hdr)); > 2006=09 > 2007 /* > 2008 * Copy the packet data into the store buffer and update = its length. > 2009 */ > (kgdb) print *d > $2 =3D {bd_next =3D {le_next =3D 0x0, le_prev =3D 0xffffff0001be1790}, = bd_sbuf =3D 0x0,=20 > bd_hbuf =3D 0x0, bd_fbuf =3D 0xffffff8000eae000 "?OoP", bd_slen =3D = 0,=20 > bd_hlen =3D 0, bd_bufsize =3D 8388608, bd_bif =3D 0xffffff0001be1780,=20= > bd_rtout =3D 1, bd_rfilter =3D 0xffffff0001e89180, bd_wfilter =3D = 0x0,=20 > bd_bfilter =3D 0x0, bd_rcount =3D 4, bd_dcount =3D 0, bd_promisc =3D = 1 '\001',=20 > bd_state =3D 2 '\002', bd_immediate =3D 1 '\001', bd_hdrcmplt =3D 1,=20= > bd_direction =3D 0, bd_feedback =3D 0, bd_async =3D 0, bd_sig =3D 23,=20= > bd_sigio =3D 0x0, bd_sel =3D {si_tdlist =3D {tqh_first =3D 0x0,=20 > tqh_last =3D 0xffffff00aee2c690}, si_note =3D {kl_list =3D = {slh_first =3D 0x0},=20 > kl_lock =3D 0xffffffff80497980 ,=20 > kl_unlock =3D 0xffffffff80497950 ,=20 > kl_assert_locked =3D 0xffffffff80494630 = ,=20 > kl_assert_unlocked =3D 0xffffffff80494640 = ,=20 > kl_lockarg =3D 0xffffff00aee2c6d8}, si_mtx =3D = 0xffffff8000de5270},=20 > bd_mtx =3D {lock_object =3D {lo_name =3D 0xffffff0001a5fce0 "bpf",=20 > lo_flags =3D 16973824, lo_data =3D 0, lo_witness =3D 0x0},=20 > mtx_lock =3D 18446742974226712770}, bd_callout =3D {c_links =3D = {sle =3D { > sle_next =3D 0x0}, tqe =3D {tqe_next =3D 0x0,=20 > tqe_prev =3D 0xffffff80f69c0c00}}, c_time =3D 20424328,=20 > c_arg =3D 0xffffff00aee2c600, c_func =3D 0xffffffff8056b690 = ,=20 > c_lock =3D 0xffffff00aee2c6d8, c_flags =3D 2, c_cpu =3D 0}, = bd_label =3D 0x0,=20 > bd_fcount =3D 4, bd_pid =3D 95393, bd_locked =3D 0, bd_bufmode =3D 1, = bd_wcount =3D 0,=20 > bd_wfcount =3D 0, bd_wdcount =3D 0, bd_zcopy =3D 0, bd_compat32 =3D 0 = '\0'} > (kgdb)=20 >=20 > I'm not seeing how bd_sbuf would be NULL here. Any ideas? Since I've not had any replies, I hope nobody minds if I reply with more = information. This panic seems to be occasionally triggered now that my user land code = is changing the packet filter a while after the bpd device has been = opened and an initial packet filter was set (previously, my code did not = change the filter after it was initially set). I'm focusing on bpf_setf() since that seems to be the place that could = be tickling a problem, and I see that bpf_setf() calls reset_d(d) to = clear the hold buffer. I have manually verified that the BPFD lock is = held during the call to reset_d(), and the lock is held every other = place that the buffers are manipulated, so I haven't been able to find = any place that seems vulnerable to losing one of the bpf buffers. Still = searching, but any help would be appreciated. Guy From owner-freebsd-net@FreeBSD.ORG Tue Oct 9 22:14:23 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C4AE6C35 for ; Tue, 9 Oct 2012 22:14:23 +0000 (UTC) (envelope-from fernando@gont.com.ar) Received: from web01.jbserver.net (web01.jbserver.net [IPv6:2a00:d10:2000:e::3]) by mx1.freebsd.org (Postfix) with ESMTP id 5F7928FC14 for ; Tue, 9 Oct 2012 22:14:23 +0000 (UTC) Received: from 178-116-22-62.access.telenet.be ([178.116.22.62] helo=[192.168.0.107]) by web01.jbserver.net with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.76) (envelope-from ) id 1TLi4C-0005u6-34; Wed, 10 Oct 2012 00:14:20 +0200 Message-ID: <5074A1BA.7060702@gont.com.ar> Date: Wed, 10 Oct 2012 00:14:18 +0200 From: Fernando Gont User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: FreeBSD Net Subject: IPv6 stable privacy addresses (Fwd: I-D Action: draft-ietf-6man-stable-privacy-addresses-01.txt) References: <20121007235049.15102.96254.idtracker@ietfa.amsl.com> In-Reply-To: <20121007235049.15102.96254.idtracker@ietfa.amsl.com> X-Enigmail-Version: 1.4.4 X-Forwarded-Message-Id: <20121007235049.15102.96254.idtracker@ietfa.amsl.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: Tue, 09 Oct 2012 22:14:23 -0000 Folks, FYI. You may find this one interesting. (Yep, I'm aware that at least Bjoern reads the 6man mailing-list ;-) ) Cheers, Fernando -------- Original Message -------- Subject: I-D Action: draft-ietf-6man-stable-privacy-addresses-01.txt Date: Sun, 07 Oct 2012 16:50:49 -0700 From: internet-drafts@ietf.org To: i-d-announce@ietf.org CC: ipv6@ietf.org A New Internet-Draft is available from the on-line Internet-Drafts directories. This draft is a work item of the IPv6 Maintenance Working Group of the IETF. Title : A method for Generating Stable Privacy-Enhanced Addresses with IPv6 Stateless Address Autoconfiguration (SLAAC) Author(s) : Fernando Gont Filename : draft-ietf-6man-stable-privacy-addresses-01.txt Pages : 17 Date : 2012-10-07 Abstract: This document specifies a method for generating IPv6 Interface Identifiers to be used with IPv6 Stateless Address Autoconfiguration (SLAAC), such that addresses configured using this method are stable within each subnet, but the Interface Identifier changes when hosts move from one network to another. The aforementioned method is meant to be an alternative to generating Interface Identifiers based on IEEE identifiers, such that the benefits of stable addresses can be achieved without sacrificing the privacy of users. The IETF datatracker status page for this draft is: https://datatracker.ietf.org/doc/draft-ietf-6man-stable-privacy-addresses There's also a htmlized version available at: http://tools.ietf.org/html/draft-ietf-6man-stable-privacy-addresses-01 A diff from the previous version is available at: http://www.ietf.org/rfcdiff?url2=draft-ietf-6man-stable-privacy-addresses-01 Internet-Drafts are also available by anonymous FTP at: ftp://ftp.ietf.org/internet-drafts/ -------------------------------------------------------------------- IETF IPv6 working group mailing list ipv6@ietf.org Administrative Requests: https://www.ietf.org/mailman/listinfo/ipv6 -------------------------------------------------------------------- -- Fernando Gont e-mail: fernando@gont.com.ar || fgont@si6networks.com PGP Fingerprint: 7809 84F5 322E 45C7 F1C9 3945 96EE A9EF D076 FFF1 From owner-freebsd-net@FreeBSD.ORG Tue Oct 9 23:58:02 2012 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5EBA5A2B; Tue, 9 Oct 2012 23:58:02 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from outgoing.tristatelogic.com (segfault.tristatelogic.com [69.62.255.118]) by mx1.freebsd.org (Postfix) with ESMTP id 363EB8FC08; Tue, 9 Oct 2012 23:58:01 +0000 (UTC) Received: from segfault-nmh-helo.tristatelogic.com (localhost [127.0.0.1]) by segfault.tristatelogic.com (Postfix) with ESMTP id 66B8B50840; Tue, 9 Oct 2012 16:58:01 -0700 (PDT) To: rpaulo@FreeBSD.org, freebsd-net@FreeBSD.org Subject: Intel 5100 Wifi... more questions. Date: Tue, 09 Oct 2012 16:58:01 -0700 Message-ID: <32938.1349827081@tristatelogic.com> From: "Ronald F. Guilmette" 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: Tue, 09 Oct 2012 23:58:02 -0000 Ok so I upgraded t FreeBSD 9.0-RELEASE, and now my Intel 5100 is automagically recognized during boot up. I have also managed to get it all configured the way I want, and it is now working just great... well... it is working anyway. I still do have a couple of questions. Some things about my setup are REALLY mysterious. Firstly, the machine that contains the Intel 5100 Wifi is talking to my Linksys E1000 router. This router allegedly speaks, a, b, g, and also n. I have set the router to the "N-only" mode and rebooted it... a hard reboot (power cycled). Still, despite me having set the router to "N-only" mode, this is what I am seeing on the client side: % ifconfig wlan0 wlan0: flags=8843 metric 0 mtu 1500 ether 00:22:fb:76:6d:18 inet 192.168.1.23 netmask 0xffffff00 broadcast 192.168.1.255 inet6 fe80::222:fbff:fe76:6d18%wlan0 prefixlen 64 scopeid 0xb nd6 options=29 media: IEEE 802.11 Wireless Ethernet OFDM/18Mbps mode 11ng status: associated ssid ronair2-1 channel 11 (2462 MHz 11g ht/20) bssid c0:c1:c0:8b:4b:f3 country US authmode WPA2/802.11i privacy ON deftxkey UNDEF AES-CCM 2:128-bit txpower 15 bmiss 10 scanvalid 450 bgscan bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 64 protmode CTS ampdulimit 64k ampdudensity 8 -amsdutx amsdurx shortgi wme roaming MANUAL So I have the obvious question... WTF? How/why is it that the Intel 5100 seems to be able to speak to a router using 11g (which is obviously is doing, based on the above output) even though the router has been configured to speak `N' only?? What am I missing? OK, so the second question I have is an obvious one too... I want to get the best speed possible out of this connection. The router allegedly supports `N' and the Intel 5100 client allegedly supports `N' also. How can I force the Intel 5100 to choose `N' rather than `G'? (It seems to always be connecting via 11g, even though I would prefer that it connect via the faster 11n. I would have thought that it would have been smart enough, given that it could use either, for it to have selected 11n, but for reasons know only to the developers, it didn't, so now I would like to see if I can find a way to force it into 11n.) I've looked at this (up-to-date?) man page: http://www.freebsd.org/cgi/man.cgi?query=ifconfig&sektion=8 and under the "mode" option it only talks about 11a, 11b, and 11g. WTF? Does the current incarnation of FreeBSD ifconfig really not even support 11n?? I mean it is not as if 11n were really ``new'' anymore or anything. Looking forward to any answers. Thanks. Regards, rfg From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 00:41:09 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A50026ED for ; Wed, 10 Oct 2012 00:41:09 +0000 (UTC) (envelope-from kurt.buff@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 360888FC17 for ; Wed, 10 Oct 2012 00:41:08 +0000 (UTC) Received: by mail-ee0-f54.google.com with SMTP id c50so4240845eek.13 for ; Tue, 09 Oct 2012 17:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=g+a0VavKxEb2OV21BZZ2HdfFlN1L+7DDJFeG6tCJIKA=; b=KfcY3cslfW2XBYfIVJonWZEcQ+v+uLU5NX6LIPfzN6uTJraknkOn543FFa64+KnTz5 z/t2dCW3+yxDkt7UU4L97e8rlsOfjyFbdrqHpZkKFl4L2qu0+/5hGTCnFqBH9lsDUv18 Ji98rCXgn4C5ceP0eEMvVMv7vg0ffSoMW7z3fn1EIaR10Y+CECc1qq7nwm0m0wr1yLyL tEvxoj0hPsc30+bukRFztatfC+//fXqCAwKLhLM8fObPIa7Fkaqn7WhMs5AAKwzHzdyb IY+hoSfgZ/LOj8krPHMay701KnH8BOTsI8i+KPG3ztCTz+mQkgE0/wotMDx54QWPSRmc 79kw== MIME-Version: 1.0 Received: by 10.14.4.201 with SMTP id 49mr30631384eej.0.1349829668038; Tue, 09 Oct 2012 17:41:08 -0700 (PDT) Received: by 10.14.214.131 with HTTP; Tue, 9 Oct 2012 17:41:08 -0700 (PDT) In-Reply-To: <32938.1349827081@tristatelogic.com> References: <32938.1349827081@tristatelogic.com> Date: Tue, 9 Oct 2012 17:41:08 -0700 Message-ID: Subject: Re: Intel 5100 Wifi... more questions. From: Kurt Buff To: freebsd-net@freebsd.org Content-Type: text/plain; charset=UTF-8 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 00:41:09 -0000 On Tue, Oct 9, 2012 at 4:58 PM, Ronald F. Guilmette wrote: > % ifconfig wlan0 > wlan0: flags=8843 metric 0 mtu 1500 > ether 00:22:fb:76:6d:18 > inet 192.168.1.23 netmask 0xffffff00 broadcast 192.168.1.255 > inet6 fe80::222:fbff:fe76:6d18%wlan0 prefixlen 64 scopeid 0xb > nd6 options=29 > media: IEEE 802.11 Wireless Ethernet OFDM/18Mbps mode 11ng > status: associated > ssid ronair2-1 channel 11 (2462 MHz 11g ht/20) bssid c0:c1:c0:8b:4b:f3 > country US authmode WPA2/802.11i privacy ON deftxkey UNDEF > AES-CCM 2:128-bit txpower 15 bmiss 10 scanvalid 450 bgscan > bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 64 protmode CTS > ampdulimit 64k ampdudensity 8 -amsdutx amsdurx shortgi wme > roaming MANUAL > Just a guess, as I really am not sure about this, but perhaps 1) media: IEEE 802.11 Wireless Ethernet OFDM/18Mbps mode 11ng 2) status: associated 3) ssid ronair2-1 channel 11 (2462 MHz 11g ht/20) bssid c0:c1:c0:8b:4b:f3 line 1 might indicate that it's talking 11ng - and that 802.11n is operative and perhaps line 3 only indicates frequency/channel. Have you looked at your E1000 unit and verified what the link type is for your connection? Perhaps it will tell you that it's connected via 'n' vs.'g'. Or not. I'm sure someone more knowledgeable than me can comment further. Kurt From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 01:35:03 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CFCF4299 for ; Wed, 10 Oct 2012 01:35:03 +0000 (UTC) (envelope-from erichfreebsdlist@ovitrap.com) Received: from alogreentechnologies.com (alogreentechnologies.com [67.212.224.110]) by mx1.freebsd.org (Postfix) with ESMTP id 7B06E8FC0A for ; Wed, 10 Oct 2012 01:35:03 +0000 (UTC) Received: from X220.ovitrap.com ([122.129.201.29]) (authenticated bits=0) by alogreentechnologies.com (8.13.1/8.13.1) with ESMTP id q9A0lf5c006339 for ; Tue, 9 Oct 2012 18:47:43 -0600 Date: Wed, 10 Oct 2012 07:47:40 +0700 From: Erich Dollansky To: FreeBSD Net Subject: shape network traffic but give priority to one application Message-ID: <20121010074740.0c66cdc0@X220.ovitrap.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 01:35:03 -0000 Hi, I am again on a very remote location with a pretty slow Internet connection. The problem I would like to solve sounds simple. What is the easiest way to shape the network traffic so that one machine gets most of the bandwidth when needed while all other machines share the remaining bandwidth? Google tells me that pfsense is a good start. Are there better options? Erich From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 01:47:36 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 72972517 for ; Wed, 10 Oct 2012 01:47:36 +0000 (UTC) (envelope-from pprocacci@datapipe.com) Received: from EXFESMQ03.datapipe-corp.net (exfesmq03.datapipe.com [64.27.120.67]) by mx1.freebsd.org (Postfix) with ESMTP id 27CC28FC12 for ; Wed, 10 Oct 2012 01:47:33 +0000 (UTC) Received: from nat.myhome (192.168.128.103) by EXFESMQ03.datapipe-corp.net (192.168.128.28) with Microsoft SMTP Server (TLS) id 14.2.318.1; Tue, 9 Oct 2012 21:46:23 -0400 Date: Tue, 9 Oct 2012 20:46:46 -0500 From: "Paul A. Procacci" To: Erich Dollansky Subject: Re: shape network traffic but give priority to one application Message-ID: <20121010014646.GZ56954@nat.myhome> References: <20121010074740.0c66cdc0@X220.ovitrap.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20121010074740.0c66cdc0@X220.ovitrap.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [192.168.128.103] Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Net 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 01:47:36 -0000 On Wed, Oct 10, 2012 at 07:47:40AM +0700, Erich Dollansky wrote: > Hi, > > I am again on a very remote location with a pretty slow Internet > connection. The problem I would like to solve sounds simple. > > What is the easiest way to shape the network traffic so that one > machine gets most of the bandwidth when needed while all other machines > share the remaining bandwidth? > > Google tells me that pfsense is a good start. Are there better options? > > Erich > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" Now sure about pfsense, but I use ipfw w/ weighted queues pretty effectivel= y. ~Paul ________________________________ This message may contain confidential or privileged information. If you are= not the intended recipient, please advise us immediately and delete this m= essage. See http://www.datapipe.com/legal/email_disclaimer/ for further inf= ormation on confidentiality and the risks of non-secure electronic communic= ation. If you cannot access these links, please notify us by reply message = and we will send the contents to you. From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 03:44:26 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 080B44C4 for ; Wed, 10 Oct 2012 03:44:26 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id CC1A58FC08 for ; Wed, 10 Oct 2012 03:44:25 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so115410pad.13 for ; Tue, 09 Oct 2012 20:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=SDAcfPg670Bzbcw249Cc5GPrOn6ftjUgJQUdMVqutvA=; b=w+jLbV+AcK0AYG7hOKA7ieC7kp87EYWdEVgsIDoJkCFbW5UdJz+RQTThqKi15+CZgP XlqOmfO+1PmKjEyPGOkokbcSJi4VyjKdjcdSTUTpNqStOJXZRuKvAc8Lfrr+bJapoq0A 0A51HoZK8DCxGxJRZX5o1vBjQatGTU3c37K9NocOJnYODg+CpXZW95/CGvswilvjiE0m zo9VXAKwUqqNn8oYU3Bay5+QUuCCyZVYDsMxmzJW+zL4i7nkWZj6aNtu926M7QRX/4DB LaHNH5q8E9YxAXUgahgu3OITv8FoaAKet8JhGwZnp+BpC/1HkT/EoaGsxKhp5YV9lrkq zruA== MIME-Version: 1.0 Received: by 10.68.242.164 with SMTP id wr4mr69939431pbc.41.1349840665325; Tue, 09 Oct 2012 20:44:25 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.223.136 with HTTP; Tue, 9 Oct 2012 20:44:25 -0700 (PDT) In-Reply-To: References: <32938.1349827081@tristatelogic.com> Date: Tue, 9 Oct 2012 20:44:25 -0700 X-Google-Sender-Auth: zee1dRPLtgNRtjfp-dS0ElY2h6s Message-ID: Subject: Re: Intel 5100 Wifi... more questions. From: Adrian Chadd To: Kurt Buff Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-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 03:44:26 -0000 Yes. It says 11g HT/20. That's "11n." Do "ifconfig wlan0 list sta". See what rate its selecting. It should be high. I should really replace the MCS rates with actual MCSX rather than xxxMB, it confuses people. Adrian From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 04:32:28 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2DBE9820 for ; Wed, 10 Oct 2012 04:32:28 +0000 (UTC) (envelope-from kob6558@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id ADF5E8FC08 for ; Wed, 10 Oct 2012 04:32:27 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id x43so79090wey.13 for ; Tue, 09 Oct 2012 21:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=8wHxSfxuoRVN6CmHMMvK09pFN2N9fT+B977WxCLTNn8=; b=Mk0843API9mxO1bLWFSPDkr62MLl3y8tx9xykzliqbQAztQoft1Rgzfp7OHWZXj2TR 2b7l5BR1ZUIaAnc3ntIuCrCzuNH8ZdYfkEOf1zb8pK0Op4zcaxwyC0hDCD7aCiykceCK SUClYo/pThxQswvMaaFiimSY5atX+XR9nqv700JT90zF8+6MBIr0VjllLJOJ6NYnvuVA tJMUShPf7o38vt32qsn45tOTRJUvXau8STafrtm9I/CZG88zDVzG7g74zG5AB8HQySfv ibt+7sz2SCSSo2jK12EYb1ZmqMrGxm2VhLagKzr4LiA2Uky4ECAs8RXrEe2G9pjkt6Ki xZyA== MIME-Version: 1.0 Received: by 10.216.197.104 with SMTP id s82mr12833379wen.62.1349843546523; Tue, 09 Oct 2012 21:32:26 -0700 (PDT) Received: by 10.223.66.194 with HTTP; Tue, 9 Oct 2012 21:32:26 -0700 (PDT) In-Reply-To: <86y5jfye1u.fsf@venux.xbsd.name> References: <86ehl96o4i.fsf@venux.xbsd.name> <86y5jfye1u.fsf@venux.xbsd.name> Date: Tue, 9 Oct 2012 21:32:26 -0700 Message-ID: Subject: Re: What driver should I use for 'intel centrino wireless-N 2200 BGN' ? From: Kevin Oberman To: Kevin Oberman , Andreas Nilsson , freebsd-net@freebsd.org Content-Type: text/plain; charset=UTF-8 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 04:32:28 -0000 On Tue, Oct 9, 2012 at 6:23 AM, Denise H. G. wrote: > > On 2012/10/09 at 00:44, Kevin Oberman wrote: >> >> On Mon, Oct 8, 2012 at 9:36 AM, Andreas Nilsson wrote: >>> On Mon, Oct 8, 2012 at 2:21 PM, Denise H. G. wrote: >>> >>>> Hi list, >>>> >>>> I tried ipw, iwn, and iwi, but ended up with no luck. What's more, it >>>> seems that the wireless adapter has not been even detected by the >>>> system. I ran 'pciconf -l' and got this line which seems to be my >>>> wireless adapter: >>>> >>>> none3@pci0:3:0:0: class=0x028000 card=0x42228086 chip=0x08918086 >>>> rev=0xc4 hdr=0x00 >>>> >>>> Is there a driver for that under FreeBSD 9.1-PRERELEASE? >>>> >>>> Thanks! >>>> >>> >>> Man page for iwi says >>> The iwi driver provides support for Intel PRO/Wireless 2200BG/2915ABG >>> >>> Do you have legal.intel_iwi.license_ack=1 in loader.conf ? >>> >>> Perhaps you need to check if the device id is listed in the source code? >> >> Yes. Some vendors (e.g. Lenovo, HP) have private PCIIDs on their >> cards, so they may not be in the source. Adding them is trivial, but, >> should this be the issue, please open a PR to have it added to the >> source in SVN. > > I tried to add some device ids into the source code of the drivers, but > with no luck. Maybe I am doing it the wrong way. The card ID in the code is 4220 and yours has is 4222. Edit /sys/dev/iwi/if_iwi.c and add: { 0x8086, 0x4222, "Intel(R) PRO/Wireless 2200BG" }, after line 123. If you are loading the module, you can just rebuild that. Otherwise you will need to rebuild the kernel. If you are not familiar with building a module, rebuilding the whole thing, kernel and modules, is probably the best idea. Note that I don't currently have any 2200BG card, so I have not done any testing. I looked at the pci.ids file and it does not seem to have an entry for 0x4220, but does have one for 0x4222, so I am a bit confused, but the pci.ids file is not relevant to the driver. It's just an oddity. -- R. Kevin Oberman, Network Engineer E-mail: kob6558@gmail.com From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 05:33:03 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B0F42F5 for ; Wed, 10 Oct 2012 05:33:03 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 690E78FC08 for ; Wed, 10 Oct 2012 05:33:03 +0000 (UTC) Received: from JRE-MBP-2.local (c-50-143-149-146.hsd1.ca.comcast.net [50.143.149.146]) (authenticated bits=0) by vps1.elischer.org (8.14.5/8.14.5) with ESMTP id q9A5Wu7R006862 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 9 Oct 2012 22:32:56 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <50750887.10005@freebsd.org> Date: Tue, 09 Oct 2012 22:32:55 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Erich Dollansky Subject: Re: [maybe spam] shape network traffic but give priority to one application References: <20121010074740.0c66cdc0@X220.ovitrap.com> In-Reply-To: <20121010074740.0c66cdc0@X220.ovitrap.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Net 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 05:33:03 -0000 On 10/9/12 5:47 PM, Erich Dollansky wrote: > Hi, > > I am again on a very remote location with a pretty slow Internet > connection. The problem I would like to solve sounds simple. > > What is the easiest way to shape the network traffic so that one > machine gets most of the bandwidth when needed while all other machines > share the remaining bandwidth? > > Google tells me that pfsense is a good start. Are there better options? pfsense is a whole OS image and you install it onto a machine. it's what you'd do if you had a spare OC you want to use for traffic shaping etc. internally it uses FreeBSD as the OS and 'pf + altq' as the shaper. If you have a FreeBSD machine up already, and you can pass all the traffic through it then you can do the same and use pf + altq, or you can use ipfw + dummynet. Your choice. > > Erich > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > > From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 08:41:39 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 C940470F; Wed, 10 Oct 2012 08:41:39 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 951958FC18; Wed, 10 Oct 2012 08:41:39 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id rp8so505736pbb.13 for ; Wed, 10 Oct 2012 01:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=FBUVWFgsA44AFOgOYobp/GwEZb+G5yCzCZPBb1LX7Ks=; b=CmR8yD0/ilhX6WBt6QgklwQLrrT10R3kt8JYBFEMeCTPWZXC6GqyiOiz+p2KgNNmlu B92TjMi+XUxtkdAFembvtcDwcEHpuWniXJxJdYfJtoDOjyACSfUHWQ8XYSrv3vmxD0L5 VIk8lKlmLbTiaJtHE4bIwYCO00IYmyetE9PKEBHLuMQ7czMa45Ta+gI5FPMu8Zsj8qTj 6pT9zlGG9s6aNX/MAaA7l6TaZ3inI0/jkJFhgIjsSs/2s9K/Lz8yGYS2ZRMaN6i5k3sC 77Mj3rM787W3YQQHQsxDifzNd4pgKUmaN4Xm8aV9Rh/vD8kwTwYKo6+r53QqgL0f69Cw +MuQ== MIME-Version: 1.0 Received: by 10.66.72.194 with SMTP id f2mr16049599pav.40.1349858499314; Wed, 10 Oct 2012 01:41:39 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.223.136 with HTTP; Wed, 10 Oct 2012 01:41:39 -0700 (PDT) In-Reply-To: <20121009154128.GU34622@FreeBSD.org> References: <20121009154128.GU34622@FreeBSD.org> Date: Wed, 10 Oct 2012 01:41:39 -0700 X-Google-Sender-Auth: bWE9I-kU02oNQiNx6bC11ubbrX8 Message-ID: Subject: Re: [CFT/Review] net byte order for AF_INET From: Adrian Chadd To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 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 08:41:39 -0000 Can you please test on i386? :) Adrian On 9 October 2012 08:41, Gleb Smirnoff wrote: > Hello, > > 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. > > 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. > > The patch has been tested by me on amd64 and ray@ on mips. > TCP, UDP, ICMP, fragment reassembly and basic packet filtering > works okay. > > 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. > > Code reviewing also appreciated. > > -- > Totus tuus, Glebius. > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 08:56:13 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 22EB6E01; Wed, 10 Oct 2012 08:56:13 +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 76F368FC08; Wed, 10 Oct 2012 08:56:12 +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 q9A8uBSS082966; Wed, 10 Oct 2012 12:56:11 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9A8uBBY082965; Wed, 10 Oct 2012 12:56:11 +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 12:56:11 +0400 From: Gleb Smirnoff To: Adrian Chadd Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121010085611.GA34622@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 08:56:13 -0000 On Wed, Oct 10, 2012 at 01:41:39AM -0700, Adrian Chadd wrote: A> Can you please test on i386? :) I don't have any. If you are hinting at debugging printf from in_cksum code that is present on i386 and not on amd64, then don't worry, I've added similar printf to amd64 in_cksum in my tree. -- Totus tuus, Glebius. From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 11:50:11 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 975C1516 for ; Wed, 10 Oct 2012 11:50:11 +0000 (UTC) (envelope-from dblais@interplex.ca) Received: from smtp1.interplex.ca (smtp1.interplex.ca [207.134.105.5]) by mx1.freebsd.org (Postfix) with ESMTP id 2C9AA8FC16 for ; Wed, 10 Oct 2012 11:50:10 +0000 (UTC) Received: by smtp1.interplex.ca (Postfix, from userid 106) id 4E84550959; Wed, 10 Oct 2012 07:50:04 -0400 (EDT) Received: from smtp.interplex.ca (office.abi.ca [207.134.166.34]) by smtp1.interplex.ca (Postfix) with ESMTP id E83DC5088F for ; Wed, 10 Oct 2012 07:50:03 -0400 (EDT) Received: from WIN2008.Domnt.abi.ca ([fe80::e06e:fea4:8702:2295]) by WIN2008.Domnt.abi.ca ([fe80::e06e:fea4:8702:2295%12]) with mapi; Wed, 10 Oct 2012 07:50:03 -0400 From: Dominic Blais To: "freebsd-net@freebsd.org" Date: Wed, 10 Oct 2012 07:50:02 -0400 Subject: Default route "random" gateway modification bug Thread-Topic: Default route "random" gateway modification bug Thread-Index: Ac2m3WGdfKfLqttgTeidmeLOjosAYg== Message-ID: <2DE61B0869B7484997BCA012845482C7EBE8E2819E@WIN2008.Domnt.abi.ca> Accept-Language: fr-FR, fr-CA Content-Language: fr-FR X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: fr-FR, fr-CA Content-Type: multipart/related; boundary="_004_2DE61B0869B7484997BCA012845482C7EBE8E2819EWIN2008Domnta_"; type="multipart/alternative" MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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 11:50:11 -0000 --_004_2DE61B0869B7484997BCA012845482C7EBE8E2819EWIN2008Domnta_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, I had to change the server of my customer who have this bug because we want= ed to put 2 redundant servers with carp... I removed the old server and re= placed it with 2 brand new ones. The old one was an HP ML115 and the new on= es are Lenovo TS120 -- [cid:image001.gif@01CDA6BB.DA8AD840] --_004_2DE61B0869B7484997BCA012845482C7EBE8E2819EWIN2008Domnta_-- From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 11:57:08 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A8875816 for ; Wed, 10 Oct 2012 11:57:08 +0000 (UTC) (envelope-from dblais@interplex.ca) Received: from smtp1.interplex.ca (smtp1.interplex.ca [207.134.105.5]) by mx1.freebsd.org (Postfix) with ESMTP id 189EB8FC12 for ; Wed, 10 Oct 2012 11:57:07 +0000 (UTC) Received: by smtp1.interplex.ca (Postfix, from userid 106) id 3605F50959; Wed, 10 Oct 2012 07:57:07 -0400 (EDT) Received: from smtp.interplex.ca (office.abi.ca [207.134.166.34]) by smtp1.interplex.ca (Postfix) with ESMTP id CCD5B508A3 for ; Wed, 10 Oct 2012 07:57:06 -0400 (EDT) Received: from WIN2008.Domnt.abi.ca ([fe80::e06e:fea4:8702:2295]) by WIN2008.Domnt.abi.ca ([fe80::e06e:fea4:8702:2295%12]) with mapi; Wed, 10 Oct 2012 07:57:06 -0400 From: Dominic Blais To: "freebsd-net@freebsd.org" Date: Wed, 10 Oct 2012 07:57:05 -0400 Subject: Default route "random" gateway modification bug Thread-Topic: Default route "random" gateway modification bug Thread-Index: Ac2m3l39o02GBaGGQPykMzeaPsc91w== Message-ID: <2DE61B0869B7484997BCA012845482C7EBE8E2819F@WIN2008.Domnt.abi.ca> Accept-Language: fr-FR, fr-CA Content-Language: fr-FR X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: fr-FR, fr-CA Content-Type: multipart/related; boundary="_004_2DE61B0869B7484997BCA012845482C7EBE8E2819FWIN2008Domnta_"; type="multipart/alternative" MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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 11:57:08 -0000 --_004_2DE61B0869B7484997BCA012845482C7EBE8E2819FWIN2008Domnta_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi (sorry, I clicked send too fast ;) ), I had to change the server of my customer who have this bug because we want= ed to put 2 redundant servers with carp... I removed the old server and re= placed it with 2 brand new ones. The old one was an HP ML115 and th= e new ones are Lenovo TS120. The new servers are the same model (H= P ML115). I used the same software: - FreeBSD 9.0 - MPD 5.6 - IPFW (pipes only + single pass all rule) - PF ruleset for filter and NAT. And only added: kldload if_carp.ko The problem just happened this last night with that configuration so I may = say it should be replicable if someone did use the same FreeBSD version wit= h ipfw for pipes and pf for rules/nat. We still don't know what is exactly = messing up with the default gateway but we know that it is something with t= he mix of FreeBSD 9, IPFW for pipes and PF for NAT. You must add some traff= ic to it to make it happen since it looks like it's using an IP of a host t= he users communicated with to replace the gateway. I often see, but not onl= y, Microsoft owned IP as my default gateway when it happens. -- [cid:image001.gif@01CDA6BC.D6EB26D0] --_004_2DE61B0869B7484997BCA012845482C7EBE8E2819FWIN2008Domnta_-- From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 12:00:24 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E407CF5 for ; Wed, 10 Oct 2012 12:00:24 +0000 (UTC) (envelope-from dblais@interplex.ca) Received: from smtp1.interplex.ca (smtp1.interplex.ca [207.134.105.5]) by mx1.freebsd.org (Postfix) with ESMTP id 8E9508FC2C for ; Wed, 10 Oct 2012 12:00:23 +0000 (UTC) Received: by smtp1.interplex.ca (Postfix, from userid 106) id C93A650959; Wed, 10 Oct 2012 08:00:22 -0400 (EDT) Received: from smtp.interplex.ca (office.abi.ca [207.134.166.34]) by smtp1.interplex.ca (Postfix) with ESMTP id 6A748508A3 for ; Wed, 10 Oct 2012 08:00:22 -0400 (EDT) Received: from WIN2008.Domnt.abi.ca ([fe80::e06e:fea4:8702:2295]) by WIN2008.Domnt.abi.ca ([fe80::e06e:fea4:8702:2295%12]) with mapi; Wed, 10 Oct 2012 08:00:22 -0400 From: Dominic Blais To: "freebsd-net@freebsd.org" Date: Wed, 10 Oct 2012 08:00:21 -0400 Subject: Microsoft's bases... Thread-Topic: Microsoft's bases... Thread-Index: Ac2m3tLrioFGR6zPSGC82SrkVgNfiQ== Message-ID: <2DE61B0869B7484997BCA012845482C7EBE8E281A0@WIN2008.Domnt.abi.ca> Accept-Language: fr-FR, fr-CA Content-Language: fr-FR X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: fr-FR, fr-CA Content-Type: multipart/related; boundary="_004_2DE61B0869B7484997BCA012845482C7EBE8E281A0WIN2008Domnta_"; type="multipart/alternative" MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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 12:00:24 -0000 --_004_2DE61B0869B7484997BCA012845482C7EBE8E281A0WIN2008Domnta_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Microsoft says: All your default gateways are belong to us! ;) -- [cid:image001.gif@01CDA6BD.4BD87880] --_004_2DE61B0869B7484997BCA012845482C7EBE8E281A0WIN2008Domnta_-- From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 12:02:33 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0BC7F43 for ; Wed, 10 Oct 2012 12:02:33 +0000 (UTC) (envelope-from erich@alogreentechnologies.com) Received: from alogreentechnologies.com (alogreentechnologies.com [67.212.224.110]) by mx1.freebsd.org (Postfix) with ESMTP id BF6EA8FC0C for ; Wed, 10 Oct 2012 12:02:32 +0000 (UTC) Received: from X220.ovitrap.com ([122.129.201.2]) (authenticated bits=0) by alogreentechnologies.com (8.13.1/8.13.1) with ESMTP id q9AC2S6L013414; Wed, 10 Oct 2012 06:02:30 -0600 Date: Wed, 10 Oct 2012 19:02:28 +0700 From: Erich Dollansky To: Dominic Blais Subject: Re: Default route "random" gateway modification bug Message-ID: <20121010190228.455b9b39@X220.ovitrap.com> In-Reply-To: <2DE61B0869B7484997BCA012845482C7EBE8E2819F@WIN2008.Domnt.abi.ca> References: <2DE61B0869B7484997BCA012845482C7EBE8E2819F@WIN2008.Domnt.abi.ca> Organization: ALO Green Technologies X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "freebsd-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 12:02:33 -0000 Hi, On Wed, 10 Oct 2012 07:57:05 -0400 Dominic Blais wrote: > Hi (sorry, I clicked send too fast ;) ), oh yeah, the fast index finger. > > replace the gateway. I often see, but not only, Microsoft owned IP as > my default gateway when it happens. do you have traffic to these addresses too? What kind of traffic is it? Erich From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 12:06:11 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5ACAA198 for ; Wed, 10 Oct 2012 12:06:11 +0000 (UTC) (envelope-from krzysiek@airnet.opole.pl) Received: from base.airnet.opole.pl (ns2.airmax.pl [176.111.128.3]) by mx1.freebsd.org (Postfix) with ESMTP id 0A2F58FC19 for ; Wed, 10 Oct 2012 12:06:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by base.airnet.opole.pl (Postfix) with ESMTP id 7173B7FF02B; Wed, 10 Oct 2012 14:06:05 +0200 (CEST) Received: from base.airnet.opole.pl ([127.0.0.1]) by localhost (mail.airnet.opole.pl [127.0.0.1]) (maiad, port 10024) with ESMTP id 41678-07; Wed, 10 Oct 2012 14:06:05 +0200 (CEST) Received: from [10.10.11.223] (unknown [176.111.138.12]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: krzysiek@airnet.opole.pl) by base.airnet.opole.pl (Postfix) with ESMTPSA id 424A17FF020; Wed, 10 Oct 2012 14:06:05 +0200 (CEST) Message-ID: <507564AB.7090204@airnet.opole.pl> Date: Wed, 10 Oct 2012 14:06:03 +0200 From: Krzysztof Barcikowski User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Dominic Blais Subject: Re: Default route "random" gateway modification bug References: <2DE61B0869B7484997BCA012845482C7EBE8E2819F@WIN2008.Domnt.abi.ca> In-Reply-To: <2DE61B0869B7484997BCA012845482C7EBE8E2819F@WIN2008.Domnt.abi.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "freebsd-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 12:06:11 -0000 W dniu 2012-10-10 13:57, Dominic Blais pisze: > Hi (sorry, I clicked send too fast ;) ), > > I had to change the server of my customer who have this bug because we wanted to put 2 redundant servers with carp... I removed the old server and replaced it with 2 brand new ones. The old one was an HP ML115 and the new ones are Lenovo TS120. The new servers are the same model (HP ML115). > > I used the same software: > > - FreeBSD 9.0 > - MPD 5.6 > - IPFW (pipes only + single pass all rule) > - PF ruleset for filter and NAT. > > And only added: > kldload if_carp.ko > > The problem just happened this last night with that configuration so I may say it should be replicable if someone did use the same FreeBSD version with ipfw for pipes and pf for rules/nat. We still don't know what is exactly messing up with the default gateway but we know that it is something with the mix of FreeBSD 9, IPFW for pipes and PF for NAT. You must add some traffic to it to make it happen since it looks like it's using an IP of a host the users communicated with to replace the gateway. I often see, but not only, Microsoft owned IP as my default gateway when it happens. > > Hi I often see DNS server IP's used in my network, but not only. Best regards! Krzysztof Barcikowski From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 12:26:25 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 AE1AABB6; Wed, 10 Oct 2012 12:26:25 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 44AD38FC0A; Wed, 10 Oct 2012 12:26:25 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id B18357300A; Wed, 10 Oct 2012 14:46:37 +0200 (CEST) Date: Wed, 10 Oct 2012 14:46:37 +0200 From: Luigi Rizzo To: Gleb Smirnoff Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121010124637.GA15522@onelab2.iet.unipi.it> References: <20121009154128.GU34622@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121009154128.GU34622@FreeBSD.org> User-Agent: Mutt/1.4.2.3i 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 12:26:25 -0000 On Tue, Oct 09, 2012 at 07:41:28PM +0400, Gleb Smirnoff wrote: > Hello, > > 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. ... > Code reviewing also appreciated. > > -- > Totus tuus, Glebius. I am really grataful you are doing this. A few comments: + as a strategy, i would probably suggest (something you mostly seem to do already) that arithmetic comparisons (even if just for equality) always use the HOST format, so that at some point one needs to change == to > or < this does not cause subtle bugs. This includes comparison with 0 (there is 1-2 instances where we do x == 0 when x is in NET format. This might confuse the reader. I would almost suggest the same for | and & though the chances that one changes | onto something that is endian-sensitive are null. + i hope this change will be merged to STABLE as soon as we are confident that it is complete so we will have an easier time maintaining the code across branches. Some comments inline (first one is probably a bug, the others are just suggestions) > Index: sys/netinet/raw_ip.c > =================================================================== > --- sys/netinet/raw_ip.c (revision 241370) > +++ sys/netinet/raw_ip.c (working copy) > @@ -292,6 +292,7 @@ > * not modify the packet except for some > * byte order swaps. > */ > + ip->ip_len = ntohs(ip->ip_len); > ip->ip_len += off; > > hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, this seems wrong, perhaps you want - ip->ip_len += off; + ip->ip_len = htons(ntohs(ip->ip_len) + off); > Index: sys/netinet/ip_input.c > =================================================================== > --- sys/netinet/ip_input.c (revision 241370) > +++ sys/netinet/ip_input.c (working copy) > @@ -914,22 +904,21 @@ > * Adjust ip_len to not reflect header, > * convert offset of this to bytes. > */ > - ip->ip_len -= hlen; > - if (ip->ip_off & IP_MF) { > + ip->ip_len = htons(ntohs(ip->ip_len) - hlen); > + if (ip->ip_off & htons(IP_MF)) { > /* > * Make sure that fragments have a data length > * that's a non-zero multiple of 8 bytes. > */ > - if (ip->ip_len == 0 || (ip->ip_len & 0x7) != 0) { > + if (ip->ip_len == 0 || (ip->ip_len & htons(0x7)) != 0) { > IPSTAT_INC(ips_toosmall); /* XXX */ > goto dropfrag; > } > m->m_flags |= M_FRAG; > } else > m->m_flags &= ~M_FRAG; > - ip->ip_off <<= 3; > + ip->ip_off = htons(ntohs(ip->ip_off) << 3); > > - > /* > * Attempt reassembly; if it succeeds, proceed. > * ip_reass() will return a different mbuf. + above i would rather use a temp variable ip_len = ntohs(ip->ip_len) and retain the existing expression in native format. + in the chunk below, maybe it makes sense for readability to use a couple of temp variables for ip->ip_off and ip->ip_len and adjust the values in *ip only at the end ? > @@ -1013,14 +1002,15 @@ > * segment, then it's checksum is invalidated. > */ > if (p) { > - i = GETIP(p)->ip_off + GETIP(p)->ip_len - ip->ip_off; > + i = ntohs(GETIP(p)->ip_off) + ntohs(GETIP(p)->ip_len) - > + ntohs(ip->ip_off); > if (i > 0) { > - if (i >= ip->ip_len) > + if (i >= ntohs(ip->ip_len)) > goto dropfrag; > m_adj(m, i); > m->m_pkthdr.csum_flags = 0; > - ip->ip_off += i; > - ip->ip_len -= i; > + ip->ip_off = htons(ntohs(ip->ip_off) + i); > + ip->ip_len = htons(ntohs(ip->ip_len) - i); > } > m->m_nextpkt = p->m_nextpkt; > p->m_nextpkt = m; > @@ -1033,12 +1023,13 @@ > * While we overlap succeeding segments trim them or, > * if they are completely covered, dequeue them. > */ > - for (; q != NULL && ip->ip_off + ip->ip_len > GETIP(q)->ip_off; > - q = nq) { > - i = (ip->ip_off + ip->ip_len) - GETIP(q)->ip_off; > - if (i < GETIP(q)->ip_len) { > - GETIP(q)->ip_len -= i; > - GETIP(q)->ip_off += i; > + for (; q != NULL && ntohs(ip->ip_off) + ntohs(ip->ip_len) > > + ntohs(GETIP(q)->ip_off); q = nq) { > + i = (ntohs(ip->ip_off) + ntohs(ip->ip_len)) - > + ntohs(GETIP(q)->ip_off); > + if (i < ntohs(GETIP(q)->ip_len)) { > + GETIP(q)->ip_len = htons(ntohs(GETIP(q)->ip_len) - i); > + GETIP(q)->ip_off = htons(ntohs(GETIP(q)->ip_off) + i); > m_adj(q, i); > q->m_pkthdr.csum_flags = 0; > break; > @@ -1062,14 +1053,14 @@ > */ > next = 0; > for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) { > - if (GETIP(q)->ip_off != next) { > + if (ntohs(GETIP(q)->ip_off) != next) { > if (fp->ipq_nfrags > V_maxfragsperpacket) { > IPSTAT_ADD(ips_fragdropped, fp->ipq_nfrags); > ip_freef(head, fp); > } > goto done; > } > - next += GETIP(q)->ip_len; > + next += ntohs(GETIP(q)->ip_len); > } > /* Make sure the last packet didn't have the IP_MF flag */ > if (p->m_flags & M_FRAG) { thans again luigi From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 13:09:21 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 16869156 for ; Wed, 10 Oct 2012 13:09:21 +0000 (UTC) (envelope-from contreconference@free.fr) Received: from ml.free.fr (ml-g19.proxad.net [212.27.60.41]) by mx1.freebsd.org (Postfix) with ESMTP id C9AE48FC08 for ; Wed, 10 Oct 2012 13:09:20 +0000 (UTC) Received: from ml-g19 (localhost [127.0.0.1]) by ml.free.fr (Postfix) with ESMTP id 6ADBCC27F0 for ; Wed, 10 Oct 2012 14:40:00 +0200 (CEST) Received: from ml-g19 by ml-g19 (LISTAR/0.42); Wed, 10 Oct 2012 14:40:00 +0200 (CEST) Date: Wed, 10 Oct 2012 14:40:00 +0200 (CEST) From: Listar To: freebsd-net@freebsd.org Message-ID: X-listar-antiloop: ml-g19 Precedence: list Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Expiry-Date: Thu, 11 Oct 2012 14:40:00 +0200 (CEST) Subject: Listar: Post sent to moderator. X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Reply-To: cyberinternational-repost@ml.free.fr 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 13:09:21 -0000 >> Post to list cyberinternational >> Subject: Post submitted to moderator for reason: This list requires that you provide a subject for any messages posted to it. --- Gestionnaire de liste Listar/0.42 - fin de traitement/job execution complete. From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 13:51:41 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CE684383 for ; Wed, 10 Oct 2012 13:51:41 +0000 (UTC) (envelope-from darcsis@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 93F548FC16 for ; Wed, 10 Oct 2012 13:51:41 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id rp8so781823pbb.13 for ; Wed, 10 Oct 2012 06:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:x-envelope-to :mail-followup-to:date:message-id:mime-version:content-type; bh=XebC6fkDLGQFgrwUDWumGPILqjros4D8oqvOF/Zjz4Y=; b=HPR7fT5oBS+MbjK3oC1cV/8kd9hzPberACCx8g6cNejr2SMenq3HwACB5BnT0SVaew fNJewR+0tdmx5G/EenIVF1ovvlZFITRlhqyS7v8lCzTmm9U9WKeWxKh11s9imIEzpki5 ogUGzCX/El7Ts8UnuZd3R/9hyTQ2ADpnKyCokrBGXC28JmoV3atORVJvrI7zfew/1F9N J9He87R1BOQH/MoEfDHyXM+nGU9bS7tLIVBEgapkT2jF/nPMmxEJiut/PBS3LlUwzydX Mqy2eh57wYc2yHQXOOoAf6Se5Tm3CQo0XoPxEWfiNlrv2e9V/kJUP3tpN3o5h3Z4aLpm fiTw== Received: by 10.68.200.72 with SMTP id jq8mr73711544pbc.38.1349877100736; Wed, 10 Oct 2012 06:51:40 -0700 (PDT) Received: from localhost ([125.34.64.49]) by mx.google.com with ESMTPS id rz10sm1063361pbc.32.2012.10.10.06.51.35 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 10 Oct 2012 06:51:39 -0700 (PDT) From: darcsis@gmail.com (Denise H. G.) To: Kevin Oberman Subject: Re: What driver should I use for 'intel centrino wireless-N 2200 BGN' ? In-Reply-To: (Kevin Oberman's message of "Tue, 9 Oct 2012 21:32:26 -0700") References: <86ehl96o4i.fsf@venux.xbsd.name> <86y5jfye1u.fsf@venux.xbsd.name> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (berkeley-unix) X-Envelope-To: kob6558@gmail.com Mail-Followup-To: Kevin Oberman , Andreas Nilsson , freebsd-net@freebsd.org Date: Wed, 10 Oct 2012 21:51:24 +0800 Message-ID: <86txu277vn.fsf@venux.xbsd.name> MIME-Version: 1.0 Content-Type: text/plain Cc: freebsd-net@freebsd.org, Andreas Nilsson 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 13:51:42 -0000 On 2012/10/10 at 12:32, Kevin Oberman wrote: > > On Tue, Oct 9, 2012 at 6:23 AM, Denise H. G. wrote: >> >> On 2012/10/09 at 00:44, Kevin Oberman wrote: >>> >>> On Mon, Oct 8, 2012 at 9:36 AM, Andreas Nilsson wrote: >>>> On Mon, Oct 8, 2012 at 2:21 PM, Denise H. G. wrote: >>>> >>>>> Hi list, >>>>> >>>>> I tried ipw, iwn, and iwi, but ended up with no luck. What's more, it >>>>> seems that the wireless adapter has not been even detected by the >>>>> system. I ran 'pciconf -l' and got this line which seems to be my >>>>> wireless adapter: >>>>> >>>>> none3@pci0:3:0:0: class=0x028000 card=0x42228086 chip=0x08918086 >>>>> rev=0xc4 hdr=0x00 >>>>> >>>>> Is there a driver for that under FreeBSD 9.1-PRERELEASE? >>>>> >>>>> Thanks! >>>>> >>>> >>>> Man page for iwi says >>>> The iwi driver provides support for Intel PRO/Wireless 2200BG/2915ABG >>>> >>>> Do you have legal.intel_iwi.license_ack=1 in loader.conf ? >>>> >>>> Perhaps you need to check if the device id is listed in the source code? >>> >>> Yes. Some vendors (e.g. Lenovo, HP) have private PCIIDs on their >>> cards, so they may not be in the source. Adding them is trivial, but, >>> should this be the issue, please open a PR to have it added to the >>> source in SVN. >> >> I tried to add some device ids into the source code of the drivers, but >> with no luck. Maybe I am doing it the wrong way. > > The card ID in the code is 4220 and yours has is 4222. Edit > /sys/dev/iwi/if_iwi.c and add: > { 0x8086, 0x4222, "Intel(R) PRO/Wireless 2200BG" }, > after line 123. > > If you are loading the module, you can just rebuild that. Otherwise > you will need to rebuild the kernel. If you are not familiar with > building a module, rebuilding the whole thing, kernel and modules, is > probably the best idea. > > Note that I don't currently have any 2200BG card, so I have not done > any testing. I looked at the pci.ids file and it does not seem to have > an entry for 0x4220, but does have one for 0x4222, so I am a bit > confused, but the pci.ids file is not relevant to the driver. It's > just an oddity. Thanks for your help. I've added the card's id to if_iwn.c and rebuilt the kernel. When system boots, the card is recognized. But the driver says it cannot load the firmware for this specific card. I guess more work is to be done to get this card running. I took a look at the code in if_iwn.c. It seems it is pretty hard coded for the known cards. If a new card is to be supported, much work may be needed to do it. Anyway, thank you. I think I might need a USB wireless solution now. > -- > R. Kevin Oberman, Network Engineer > E-mail: kob6558@gmail.com > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 14:27:41 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 96A8611C; Wed, 10 Oct 2012 14:27:41 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 5A5018FC14; Wed, 10 Oct 2012 14:27:41 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id rp8so821215pbb.13 for ; Wed, 10 Oct 2012 07:27:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Xkj3eV5vbtfOxnlq74kppt18cXiigH66wUaYmhsj00Y=; b=twcw+c/N2tI+rgD4r4HElOxJBgUI3uVwmEkD5g47iNl7YWi1Gt7MVPG1h1WjKd9y8Y lc+m8gPEe56J0t3hu0hUr7+ndiyaCdN3uj9uC3LCI7oKL6MmoqF1X9/EGAAZhTwkK2A6 U2IlaGu/ZZMBr3trx056DUbTgkInRFX3d671yMgVnhgKSYVuUkbEpwROHhhhdHqBZ9H3 LzAmS0czwHueVMmKU3Dxeg7lePPLScScvv7VsDsqB7vzBtzvvNa1wRaZ2y1Wt14DbBsa F4W5RCywN0n82/HJ3bnmzsz+A3pRyTnkU3KSCAosYXss4ooPtLpfv08Ggd3rVFxGmNBV i74g== MIME-Version: 1.0 Received: by 10.66.89.37 with SMTP id bl5mr63311822pab.55.1349879260878; Wed, 10 Oct 2012 07:27:40 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.223.136 with HTTP; Wed, 10 Oct 2012 07:27:40 -0700 (PDT) In-Reply-To: <86txu277vn.fsf@venux.xbsd.name> References: <86ehl96o4i.fsf@venux.xbsd.name> <86y5jfye1u.fsf@venux.xbsd.name> <86txu277vn.fsf@venux.xbsd.name> Date: Wed, 10 Oct 2012 07:27:40 -0700 X-Google-Sender-Auth: LLPfvK5-UdmWUh7IUaSBIqJpZwo Message-ID: Subject: Re: What driver should I use for 'intel centrino wireless-N 2200 BGN' ? From: Adrian Chadd To: Kevin Oberman , Andreas Nilsson , freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-wireless@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:27:41 -0000 No, just give Bermhard time to see and reply :) adrian On 10 October 2012 06:51, Denise H. G. wrote: > > On 2012/10/10 at 12:32, Kevin Oberman wrote: >> >> On Tue, Oct 9, 2012 at 6:23 AM, Denise H. G. wrote: >>> >>> On 2012/10/09 at 00:44, Kevin Oberman wrote: >>>> >>>> On Mon, Oct 8, 2012 at 9:36 AM, Andreas Nilsson wrote: >>>>> On Mon, Oct 8, 2012 at 2:21 PM, Denise H. G. wrote: >>>>> >>>>>> Hi list, >>>>>> >>>>>> I tried ipw, iwn, and iwi, but ended up with no luck. What's more, it >>>>>> seems that the wireless adapter has not been even detected by the >>>>>> system. I ran 'pciconf -l' and got this line which seems to be my >>>>>> wireless adapter: >>>>>> >>>>>> none3@pci0:3:0:0: class=0x028000 card=0x42228086 chip=0x08918086 >>>>>> rev=0xc4 hdr=0x00 >>>>>> >>>>>> Is there a driver for that under FreeBSD 9.1-PRERELEASE? >>>>>> >>>>>> Thanks! >>>>>> >>>>> >>>>> Man page for iwi says >>>>> The iwi driver provides support for Intel PRO/Wireless 2200BG/2915ABG >>>>> >>>>> Do you have legal.intel_iwi.license_ack=1 in loader.conf ? >>>>> >>>>> Perhaps you need to check if the device id is listed in the source code? >>>> >>>> Yes. Some vendors (e.g. Lenovo, HP) have private PCIIDs on their >>>> cards, so they may not be in the source. Adding them is trivial, but, >>>> should this be the issue, please open a PR to have it added to the >>>> source in SVN. >>> >>> I tried to add some device ids into the source code of the drivers, but >>> with no luck. Maybe I am doing it the wrong way. >> >> The card ID in the code is 4220 and yours has is 4222. Edit >> /sys/dev/iwi/if_iwi.c and add: >> { 0x8086, 0x4222, "Intel(R) PRO/Wireless 2200BG" }, >> after line 123. >> >> If you are loading the module, you can just rebuild that. Otherwise >> you will need to rebuild the kernel. If you are not familiar with >> building a module, rebuilding the whole thing, kernel and modules, is >> probably the best idea. >> >> Note that I don't currently have any 2200BG card, so I have not done >> any testing. I looked at the pci.ids file and it does not seem to have >> an entry for 0x4220, but does have one for 0x4222, so I am a bit >> confused, but the pci.ids file is not relevant to the driver. It's >> just an oddity. > > Thanks for your help. I've added the card's id to if_iwn.c and rebuilt > the kernel. When system boots, the card is recognized. But the driver > says it cannot load the firmware for this specific card. I guess more > work is to be done to get this card running. > > I took a look at the code in if_iwn.c. It seems it is pretty hard coded > for the known cards. If a new card is to be supported, much work may be > needed to do it. > > Anyway, thank you. I think I might need a USB wireless solution now. > >> -- >> R. Kevin Oberman, Network Engineer >> E-mail: kob6558@gmail.com >> _______________________________________________ >> freebsd-net@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-net >> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >> > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" 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 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. From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 15:07:31 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 95050582; Wed, 10 Oct 2012 15:07:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 60EDB8FC0A; Wed, 10 Oct 2012 15:07:31 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AF87BB918; Wed, 10 Oct 2012 11:07:30 -0400 (EDT) From: John Baldwin To: freebsd-net@freebsd.org Subject: Re: [CFT/Review] net byte order for AF_INET Date: Wed, 10 Oct 2012 08:48:12 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p20; KDE/4.5.5; amd64; ; ) References: <20121009154128.GU34622@FreeBSD.org> <20121010085611.GA34622@glebius.int.ru> In-Reply-To: <20121010085611.GA34622@glebius.int.ru> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201210100848.12468.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 10 Oct 2012 11:07:30 -0400 (EDT) Cc: Adrian Chadd 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 15:07:31 -0000 On Wednesday, October 10, 2012 4:56:11 am Gleb Smirnoff wrote: > On Wed, Oct 10, 2012 at 01:41:39AM -0700, Adrian Chadd wrote: > A> Can you please test on i386? :) > > I don't have any. If you have amd64 you have i386. You might even be able to test under virtualbox or the like. -- John Baldwin From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 17:38:03 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3CA8F6D5 for ; Wed, 10 Oct 2012 17:38:03 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mx.techwires.net (mx.techwires.net [IPv6:2001:4d88:100f:1::3]) by mx1.freebsd.org (Postfix) with ESMTP id C92368FC17 for ; Wed, 10 Oct 2012 17:38:02 +0000 (UTC) Received: from amy.lab.techwires.net (dslb-088-067-206-241.pools.arcor-ip.net [88.67.206.241]) by mx.techwires.net (Postfix) with ESMTPSA id BE24429637F; Wed, 10 Oct 2012 19:37:54 +0200 (CEST) From: Bernhard Schmidt To: freebsd-net@freebsd.org Subject: Re: Oops! (was: Support for Intel 5100 WiFi ?) Date: Wed, 10 Oct 2012 19:38:01 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.1-PRERELEASE; KDE/4.7.4; amd64; ; ) References: <14851.1349645303@tristatelogic.com> In-Reply-To: <14851.1349645303@tristatelogic.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201210101938.01847.bschmidt@techwires.net> Cc: "Ronald F. Guilmette" 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 17:38:03 -0000 On Sunday 07 October 2012 23:28:23 Ronald F. Guilmette wrote: > > In message <201210071040.01104.bschmidt@techwires.net>, > Bernhard Schmidt wrote: > > >iwn(4) does support 11n, 5GHz and 40MHz channels. Though, it might > >be better to switch to 9.x as it has received many many enhancements. > > OK. I suspected that might be the case. I'm glad that I asked! > > Is the iwn(4) driver in 9.0 pretty good. Or are there some things in > 9.1-RC1 (relating to iwn) that I might possibly want/need? (I prefer > to stick with official releases, if possible.) There is at least one 11n related bug fix 9.1 which isn't available in 9.0. You should be fine with 9.0 if you are not running into this issue (which is pretty hard to trigger I guess). > >Using those features is rather easy, it does so by default ;) > > OK. I want to make sure that I understand what you just said. > > (Please note that I was almost entirely ignorant about the standards and > the current state of technology with respect to ALL of this wireless stuff > up until about three weeks ago, but I have tried my best to learn since > then, so bear with me here.) > > If I have understood you correctly, then you are saying that, with respect > to the decision of whether to use or, alternatively, to not use 11n > (falling back to 11g if necessary), *and* with respect to the decision to > use or not use 5GHz (falling back to 2.4Ghz if necessary), *and* with > respect to the decision of whether to use or not use 40GHz channels > (falling back to 20MHz if necessary), the client does not get to make > any of its own decisions about any of these things, and it must instead > just follow the lead of whatever AP it is trying to connect to. > > Is that correct? Have I understood you correctly? > > (Forgive me. I'me really just still feeling my way through all of this > stuff.) What I was trying to say is, if an AP supports 11n, 11g, 20 and 40MHz channels, by default the setup which does give the best performance is used; which would be 11n+40MHz in this case. If an AP supports just 20MHz channels, iwn(4) is fine with that; same for 11g vs. 11n. Choosing 2GHz over 5GHz is something entirely different. If there is an AP which provides access to the same SSID via either 2GHz or 5GHz, iwn(4) might choose randomly (it's not entirely random, usually it's the first network detected, but close anyway). If you want to have influence on that process, you are able to by setting the appropriate options via ifconfig(8). Either something like *-ht* to disable 11n, or *channel* to restrict the device to a certain channel. -- Bernhard From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 17:54:43 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 25B80FE9 for ; Wed, 10 Oct 2012 17:54:43 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mx.techwires.net (mx.techwires.net [IPv6:2001:4d88:100f:1::3]) by mx1.freebsd.org (Postfix) with ESMTP id D83898FC0C for ; Wed, 10 Oct 2012 17:54:42 +0000 (UTC) Received: from amy.lab.techwires.net (dslb-088-067-206-241.pools.arcor-ip.net [88.67.206.241]) by mx.techwires.net (Postfix) with ESMTPSA id 10AA62963BF; Wed, 10 Oct 2012 19:54:42 +0200 (CEST) From: Bernhard Schmidt To: "Denise H. G." Subject: Re: What driver should I use for 'intel centrino wireless-N 2200 BGN'? Date: Wed, 10 Oct 2012 19:54:48 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.1-PRERELEASE; KDE/4.7.4; amd64; ; ) References: <86ehl96o4i.fsf@venux.xbsd.name> <86txu277vn.fsf@venux.xbsd.name> In-Reply-To: <86txu277vn.fsf@venux.xbsd.name> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201210101954.49000.bschmidt@techwires.net> Cc: freebsd-net@freebsd.org, Andreas Nilsson , Kevin Oberman 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 17:54:43 -0000 On Wednesday 10 October 2012 15:51:24 Denise H. G. wrote: > >>>>> none3@pci0:3:0:0: class=0x028000 card=0x42228086 chip=0x08918086 > >>>>> rev=0xc4 hdr=0x00 > >>>>> > >>>>> Is there a driver for that under FreeBSD 9.1-PRERELEASE? No, not yet. I'm having a hard figuring out the new firmware API for those new devices. Working on it.. > >> I tried to add some device ids into the source code of the drivers, but > >> with no luck. Maybe I am doing it the wrong way. > > > > The card ID in the code is 4220 and yours has is 4222. Edit > > /sys/dev/iwi/if_iwi.c and add: > > { 0x8086, 0x4222, "Intel(R) PRO/Wireless 2200BG" }, > > after line 123. Note the tiny difference in here ;) Intel(R) PRO/Wireless 2200BG vs. Intel Centrino Wireless-N 2200 BGN There are like 10 years in between. :) Just to clarify, the 0x4222 is for iwn(4), adding the IDs there is the first step, followed by a new firmware module and some glue code. I already thought about adding just the firmware but not the IDs yet, for others to tinker with. Issue is that this would generate regressions with already working cards, eg. 6230. So, eventually.. just not yet. -- Bernhard From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 18:31:51 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 5E62F95 for ; Wed, 10 Oct 2012 18:31:51 +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 E1C4B8FC18 for ; Wed, 10 Oct 2012 18:31:50 +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 q9AIVhUp086743; Wed, 10 Oct 2012 22:31:43 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9AIVho6086742; Wed, 10 Oct 2012 22:31:43 +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 22:31:43 +0400 From: Gleb Smirnoff To: Luigi Rizzo Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121010183143.GF34622@glebius.int.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121010124637.GA15522@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20121010124637.GA15522@onelab2.iet.unipi.it> 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 18:31:51 -0000 Luigi, On Wed, Oct 10, 2012 at 02:46:37PM +0200, Luigi Rizzo wrote: L> I am really grataful you are doing this. A few comments: L> L> + as a strategy, i would probably suggest (something you mostly seem to do already) L> that arithmetic comparisons (even if just for equality) always use the HOST format, L> so that at some point one needs to change == to > or < this does not cause L> subtle bugs. This includes comparison with 0 (there is 1-2 instances where L> we do x == 0 when x is in NET format. This might confuse the reader. Agreed. Converted these places to ntohs(). L> I would almost suggest the same for | and & though the chances that L> one changes | onto something that is endian-sensitive are null. I'd prefer to live these comparisons in net byte order, since I expect that ip->ip_off & htons(IP_DF) would be optimized by compiler to a constant comparison, while ntohs(ip->ip_off) & IP_DF can't be optimized. L> + i hope this change will be merged to STABLE as soon as we are confident L> that it is complete so we will have an easier time maintaining the code L> across branches. Not me to decide that. This change is continuation of a change that brought net byte order to pfil(9) hooks, thus merging should be made of both. Changing byte order for pfil(9) hooks is ABI breakage which isn't allowed in stable/*. L> Some comments inline (first one is probably a bug, the others L> are just suggestions) L> L> > Index: sys/netinet/raw_ip.c L> > =================================================================== L> > --- sys/netinet/raw_ip.c (revision 241370) L> > +++ sys/netinet/raw_ip.c (working copy) L> > @@ -292,6 +292,7 @@ L> > * not modify the packet except for some L> > * byte order swaps. L> > */ L> > + ip->ip_len = ntohs(ip->ip_len); L> > ip->ip_len += off; L> > L> > hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, L> L> this seems wrong, perhaps you want L> L> - ip->ip_len += off; L> + ip->ip_len = htons(ntohs(ip->ip_len) + off); Maxim Dounin also noticed this. This was done intentionally, but since two people are in doubt, I will look closer here. Historically BSD had supplied host byte order in raw sockets, but I suppose, for head/ this is no longer true for about a year. L> > Index: sys/netinet/ip_input.c L> > =================================================================== L> > --- sys/netinet/ip_input.c (revision 241370) L> > +++ sys/netinet/ip_input.c (working copy) L> > @@ -914,22 +904,21 @@ L> > * Adjust ip_len to not reflect header, L> > * convert offset of this to bytes. L> > */ L> > - ip->ip_len -= hlen; L> > - if (ip->ip_off & IP_MF) { L> > + ip->ip_len = htons(ntohs(ip->ip_len) - hlen); L> > + if (ip->ip_off & htons(IP_MF)) { L> > /* L> > * Make sure that fragments have a data length L> > * that's a non-zero multiple of 8 bytes. L> > */ L> > - if (ip->ip_len == 0 || (ip->ip_len & 0x7) != 0) { L> > + if (ip->ip_len == 0 || (ip->ip_len & htons(0x7)) != 0) { L> > IPSTAT_INC(ips_toosmall); /* XXX */ L> > goto dropfrag; L> > } L> > m->m_flags |= M_FRAG; L> > } else L> > m->m_flags &= ~M_FRAG; L> > - ip->ip_off <<= 3; L> > + ip->ip_off = htons(ntohs(ip->ip_off) << 3); L> > L> > - L> > /* L> > * Attempt reassembly; if it succeeds, proceed. L> > * ip_reass() will return a different mbuf. L> L> + above i would rather use a temp variable ip_len = ntohs(ip->ip_len) L> and retain the existing expression in native format. I'll look at that. L> + in the chunk below, maybe it makes sense for readability to L> use a couple of temp variables for ip->ip_off and ip->ip_len L> and adjust the values in *ip only at the end ? The chunk below is ip_reass() which is definitely not a modern optimized function. If someone wants to optimize it, he should start with something heavier than economize byte swapping operations. Regarding readability: just adding ntohs() all over in place I'm pretty sure that I did not break anything. Offloading values to temporary variables may introduce errors, since we are dealing with multiple packets here and we need carefully to update temporary variables any time we switch to another packet. I'd prefer to make the stack byte order swapping change as conservative as possible, and not try to optimize ip_reass(). -- Totus tuus, Glebius. From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 19:57:30 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CD31BECA for ; Wed, 10 Oct 2012 19:57:30 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8EBA98FC0C for ; Wed, 10 Oct 2012 19:57:30 +0000 (UTC) Received: by mail-oa0-f54.google.com with SMTP id n9so1271764oag.13 for ; Wed, 10 Oct 2012 12:57:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=iTOikb2XxvrkG6aCsxSayAnKlY6UrwTLvsPwwIxTfMc=; b=v/vRNuTyOlNtWiMYs5AbLgyvPlK89XJ3gw3anZ6Q0/iOwMaIyxQ8DnrWhUzMGy2c5H fAN70di4DxHUf8z6Cff4OG8as45E+r+SPvFlhjNfBpRV5YRYA0pkQkRfnpdXTQq9vCUX LthfRJb5Uq6GfeTL3FJI/9uayR5fTXpMiihE4VQYwL1g8BNCHmQnI6vBYRC2jBK+8KKE 4imPmSAFDdSLsvCP8oXwGNp0uQhe+dVBa78/bYFygpwzkcDyMXgewyQLPt3BYPvP8glU 2x2S47YQotfGmTuep9ePnpSTXEJ5jpkBCCCvl3WPEuJLO45VPNGjSTqpTv9UN21Upa0r jLug== MIME-Version: 1.0 Received: by 10.182.54.103 with SMTP id i7mr6580147obp.62.1349899049080; Wed, 10 Oct 2012 12:57:29 -0700 (PDT) Received: by 10.76.167.202 with HTTP; Wed, 10 Oct 2012 12:57:29 -0700 (PDT) Date: Wed, 10 Oct 2012 12:57:29 -0700 Message-ID: Subject: route add -inet6 ... -ifp $foo busted or developer error? From: Garrett Cooper To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 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 19:57:30 -0000 Trying to validate sanity for TAHI testing and the route.rmt remote handler script issues the route command in the following format when adding a route on the remote DUT: # route add -inet6 3ffe:: -prefixlen 64 -ifp bge0 route: writing to routing socket: Invalid argument add net 3ffe::: Invalid argument This isn't the way that things are done on FreeBSD 9.1 (at least -- haven't verified an older version like <= 6.x) with rc.d/routing: # route add -inet6 3ffe:: -prefixlen 64 -iface bge1 add net 3ffe::: gateway bge1 So.. I was wondering if this was developer error or if the -ifp flag is broken (my guess is the former, but I could be wrong). Also, if someone could better describe (succinctly) what -ifa is supposed to do, that would be great. The only explanation I could find is here [1] and here [2] (and both explanations are a bit ambiguous as to why one would have a single address assigned to more than one interface): In a change or add command where the destination and gateway are not suf- ficient to specify the route (as in the ISO case where several interfaces may have the same address), the -ifp or -ifa modifiers may be used to determine the interface or interface address. In cases where the gateway does not uniquely identify the output interface (for example, when several interfaces have the same address), you can use the -ifp ifname modifier to specify the interface by name. For example, -ifp lo0 associates the route with the lo0 interface. My guess is that they are suggesting carp(4) or pseudo-carp(4) like behavior (administratively down'ed, etc) with interfaces, but I wanted to absolutely sure that this is the case. Thanks! -Garrett 1. http://www.freebsd.org/cgi/man.cgi?query=route&apropos=0&sektion=0&manpath=FreeBSD+9.0-RELEASE&arch=default&format=html 2. http://www.opennet.ru/man.shtml?topic=route&category=1 From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 19:58:45 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 D312DF85 for ; Wed, 10 Oct 2012 19:58:45 +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 A960A8FC0A for ; Wed, 10 Oct 2012 19:58:44 +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 q9AJwgWE087215 for ; Wed, 10 Oct 2012 23:58:42 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9AJwgOW087214 for net@freebsd.org; Wed, 10 Oct 2012 23:58:42 +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 23:58:42 +0400 From: Gleb Smirnoff To: net@FreeBSD.org Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121010195842.GH34622@FreeBSD.org> References: <20121009154128.GU34622@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="HnQK338I3UIa/qiP" Content-Disposition: inline In-Reply-To: <20121009154128.GU34622@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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 19:58:45 -0000 --HnQK338I3UIa/qiP Content-Type: text/plain; charset=koi8-r Content-Disposition: inline On Tue, Oct 09, 2012 at 07:41:28PM +0400, Gleb Smirnoff wrote: T> this is a patch that switches entire IPv4 stack to network T> byte order. That means, that at any layer any module should T> expect IP header in network byte order. Any host byte order T> values can be stored in local variables only and are never stored T> into a packet itself. Update: - fresh patch against r241405, should apply to r241405 - fixed raw sockets` as Luigi and Max Dounin noticed, also fixed another issue with raw sockets, now work fine - tested with ospfd - fixed gre(4) - took into account Luigi's comments about using host byte order in any ==, <, > comparisons. Decided not to touch ip_reass(). -- Totus tuus, Glebius. --HnQK338I3UIa/qiP Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="IPv4.net-byte-order.diff" Index: sys/netinet/tcp_input.c =================================================================== --- sys/netinet/tcp_input.c (revision 241405) +++ sys/netinet/tcp_input.c (working copy) @@ -645,21 +645,19 @@ ip = mtod(m, struct ip *); ipov = (struct ipovly *)ip; th = (struct tcphdr *)((caddr_t)ip + off0); - tlen = ip->ip_len; + tlen = ntohs(ip->ip_len); if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) th->th_sum = m->m_pkthdr.csum_data; else th->th_sum = in_pseudo(ip->ip_src.s_addr, - ip->ip_dst.s_addr, - htonl(m->m_pkthdr.csum_data + - ip->ip_len + - IPPROTO_TCP)); + ip->ip_dst.s_addr, + htonl(m->m_pkthdr.csum_data + tlen + + IPPROTO_TCP)); th->th_sum ^= 0xffff; #ifdef TCPDEBUG - ipov->ih_len = (u_short)tlen; - ipov->ih_len = htons(ipov->ih_len); + ipov->ih_len = ip->ip_len; #endif } else { /* @@ -667,8 +665,7 @@ */ len = sizeof (struct ip) + tlen; bzero(ipov->ih_x1, sizeof(ipov->ih_x1)); - ipov->ih_len = (u_short)tlen; - ipov->ih_len = htons(ipov->ih_len); + ipov->ih_len = ip->ip_len; th->th_sum = in_cksum(m, len); } if (th->th_sum) { Index: sys/netinet/in.h =================================================================== --- sys/netinet/in.h (revision 241405) +++ sys/netinet/in.h (working copy) @@ -741,33 +741,6 @@ #define satosin(sa) ((struct sockaddr_in *)(sa)) #define sintosa(sin) ((struct sockaddr *)(sin)) #define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) - -/* - * Historically, BSD keeps ip_len and ip_off in host format - * when doing layer 3 processing, and this often requires - * to translate the format back and forth. - * To make the process explicit, we define a couple of macros - * that also take into account the fact that at some point - * we may want to keep those fields always in net format. - */ - -#if (BYTE_ORDER == BIG_ENDIAN) || defined(HAVE_NET_IPLEN) -#define SET_NET_IPLEN(p) do {} while (0) -#define SET_HOST_IPLEN(p) do {} while (0) -#else -#define SET_NET_IPLEN(p) do { \ - struct ip *h_ip = (p); \ - h_ip->ip_len = htons(h_ip->ip_len); \ - h_ip->ip_off = htons(h_ip->ip_off); \ - } while (0) - -#define SET_HOST_IPLEN(p) do { \ - struct ip *h_ip = (p); \ - h_ip->ip_len = ntohs(h_ip->ip_len); \ - h_ip->ip_off = ntohs(h_ip->ip_off); \ - } while (0) -#endif /* !HAVE_NET_IPLEN */ - #endif /* _KERNEL */ /* INET6 stuff */ Index: sys/netinet/tcp_subr.c =================================================================== --- sys/netinet/tcp_subr.c (revision 241405) +++ sys/netinet/tcp_subr.c (working copy) @@ -584,10 +584,10 @@ #ifdef INET { tlen += sizeof (struct tcpiphdr); - ip->ip_len = tlen; + ip->ip_len = htons(tlen); ip->ip_ttl = V_ip_defttl; if (V_path_mtu_discovery) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); } #endif m->m_len = tlen; @@ -1398,12 +1398,11 @@ /* * If no alternative MTU was * proposed, try the next smaller - * one. ip->ip_len has already - * been swapped in icmp_input(). + * one. */ if (!mtu) - mtu = ip_next_mtu(ip->ip_len, - 1); + mtu = ip_next_mtu( + ntohs(ip->ip_len), 1); if (mtu < V_tcp_minmss + sizeof(struct tcpiphdr)) mtu = V_tcp_minmss Index: sys/netinet/tcp_debug.c =================================================================== --- sys/netinet/tcp_debug.c (revision 241405) +++ sys/netinet/tcp_debug.c (working copy) @@ -175,11 +175,10 @@ #ifdef INET6 isipv6 ? ntohs(((struct ip6_hdr *)ipgen)->ip6_plen) : #endif - ((struct ip *)ipgen)->ip_len; + ntohs(((struct ip *)ipgen)->ip_len); if (act == TA_OUTPUT) { seq = ntohl(seq); ack = ntohl(ack); - len = ntohs((u_short)len); } if (act == TA_OUTPUT) len -= sizeof (struct tcphdr); Index: sys/netinet/tcp_syncache.c =================================================================== --- sys/netinet/tcp_syncache.c (revision 241405) +++ sys/netinet/tcp_syncache.c (working copy) @@ -1395,7 +1395,7 @@ ip = mtod(m, struct ip *); ip->ip_v = IPVERSION; ip->ip_hl = sizeof(struct ip) >> 2; - ip->ip_len = tlen; + ip->ip_len = htons(tlen); ip->ip_id = 0; ip->ip_off = 0; ip->ip_sum = 0; @@ -1413,7 +1413,7 @@ * 2) the SCF_UNREACH flag has been set */ if (V_path_mtu_discovery && ((sc->sc_flags & SCF_UNREACH) == 0)) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); th = (struct tcphdr *)(ip + 1); } @@ -1473,7 +1473,7 @@ ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) + optlen); else #endif - ip->ip_len += optlen; + ip->ip_len = htons(ntohs(ip->ip_len) + optlen); } else optlen = 0; Index: sys/netinet/sctp_input.c =================================================================== --- sys/netinet/sctp_input.c (revision 241405) +++ sys/netinet/sctp_input.c (working copy) @@ -6038,7 +6038,7 @@ dst.sin_len = sizeof(struct sockaddr_in); dst.sin_port = sh->dest_port; dst.sin_addr = ip->ip_dst; - length = ip->ip_len + iphlen; + length = ntohs(ip->ip_len) + iphlen; /* Validate mbuf chain length with IP payload length. */ if (SCTP_HEADER_LEN(m) != length) { SCTPDBG(SCTP_DEBUG_INPUT1, Index: sys/netinet/udp_usrreq.c =================================================================== --- sys/netinet/udp_usrreq.c (revision 241405) +++ sys/netinet/udp_usrreq.c (working copy) @@ -338,7 +338,7 @@ struct udphdr *uh; struct ifnet *ifp; struct inpcb *inp; - int len; + uint16_t len, ip_len; struct ip save_ip; struct sockaddr_in udp_in; #ifdef IPFIREWALL_FORWARD @@ -392,13 +392,13 @@ * reflect UDP length, drop. */ len = ntohs((u_short)uh->uh_ulen); - if (ip->ip_len != len) { - if (len > ip->ip_len || len < sizeof(struct udphdr)) { + ip_len = ntohs(ip->ip_len); + if (ip_len != len) { + if (len > ip_len || len < sizeof(struct udphdr)) { UDPSTAT_INC(udps_badlen); goto badunlocked; } - m_adj(m, len - ip->ip_len); - /* ip->ip_len = len; */ + m_adj(m, len - ip_len); } /* @@ -601,7 +601,7 @@ if (badport_bandlim(BANDLIM_ICMP_UNREACH) < 0) goto badunlocked; *ip = save_ip; - ip->ip_len += iphlen; + ip->ip_len = htons(ip_len + iphlen); icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); return; } @@ -1206,7 +1206,7 @@ struct ip *ip; ip = (struct ip *)&ui->ui_i; - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); } ipflags = 0; @@ -1233,7 +1233,7 @@ m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); } else ui->ui_sum = 0; - ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; + ((struct ip *)ui)->ip_len = htons(sizeof(struct udpiphdr) + len); ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */ ((struct ip *)ui)->ip_tos = tos; /* XXX */ UDPSTAT_INC(udps_opackets); @@ -1383,7 +1383,7 @@ m_adj(m, skip); ip = mtod(m, struct ip *); - ip->ip_len -= skip; + ip->ip_len = htons(ntohs(ip->ip_len) - skip); ip->ip_p = IPPROTO_ESP; /* Index: sys/netinet/ip_carp.c =================================================================== --- sys/netinet/ip_carp.c (revision 241405) +++ sys/netinet/ip_carp.c (working copy) @@ -783,9 +783,9 @@ ip->ip_v = IPVERSION; ip->ip_hl = sizeof(*ip) >> 2; ip->ip_tos = IPTOS_LOWDELAY; - ip->ip_len = len; + ip->ip_len = htons(len); ip->ip_id = ip_newid(); - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); ip->ip_ttl = CARP_DFLTTL; ip->ip_p = IPPROTO_CARP; ip->ip_sum = 0; Index: sys/netinet/raw_ip.c =================================================================== --- sys/netinet/raw_ip.c (revision 241405) +++ sys/netinet/raw_ip.c (working copy) @@ -292,7 +292,7 @@ * not modify the packet except for some * byte order swaps. */ - ip->ip_len += off; + ip->ip_len = htons(ip->ip_len) + off; hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask); @@ -449,11 +449,11 @@ ip = mtod(m, struct ip *); ip->ip_tos = inp->inp_ip_tos; if (inp->inp_flags & INP_DONTFRAG) - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); else ip->ip_off = 0; ip->ip_p = inp->inp_ip_p; - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); ip->ip_src = inp->inp_laddr; if (jailed(inp->inp_cred)) { /* @@ -504,6 +504,9 @@ if (ip->ip_id == 0) ip->ip_id = ip_newid(); + ip->ip_len = htons(ip->ip_len); + ip->ip_off = htons(ip->ip_off); + /* * XXX prevent ip_output from overwriting header fields. */ Index: sys/netinet/ip_divert.c =================================================================== --- sys/netinet/ip_divert.c (revision 241405) +++ sys/netinet/ip_divert.c (working copy) @@ -386,10 +386,6 @@ INP_RUNLOCK(inp); goto cantsend; } - - /* Convert fields to host order for ip_output() */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); break; #ifdef INET6 case IPV6_VERSION >> 4: Index: sys/netinet/sctp_usrreq.c =================================================================== --- sys/netinet/sctp_usrreq.c (revision 241405) +++ sys/netinet/sctp_usrreq.c (working copy) @@ -180,7 +180,7 @@ SCTP_TCB_UNLOCK(stcb); return; } - totsz = ip->ip_len; + totsz = ntohs(ip->ip_len); nxtsz = ntohs(icmph->icmp_nextmtu); if (nxtsz == 0) { Index: sys/netinet/ip_output.c =================================================================== --- sys/netinet/ip_output.c (revision 241405) +++ sys/netinet/ip_output.c (working copy) @@ -102,7 +102,6 @@ /* * IP output. The packet in mbuf chain m contains a skeletal IP * header (with len, off, ttl, proto, tos, src, dst). - * ip_len and ip_off are in host format. * The mbuf chain containing the packet will be freed. * The mbuf opt, if present, will not be freed. * If route ro is present and has ro_rt initialized, route lookup would be @@ -175,6 +174,8 @@ hlen = len; /* ip->ip_hl is updated above */ } ip = mtod(m, struct ip *); + ip_len = ntohs(ip->ip_len); + ip_off = ntohs(ip->ip_off); /* * Fill in IP header. If we are not allowing fragmentation, @@ -442,7 +443,7 @@ * packet or packet fragments, unless ALTQ is enabled on the given * interface in which case packetdrop should be done by queueing. */ - n = ip->ip_len / mtu + 1; /* how many fragments ? */ + n = ip_len / mtu + 1; /* how many fragments ? */ if ( #ifdef ALTQ (!ALTQ_IS_ENABLED(&ifp->if_snd)) && @@ -469,7 +470,7 @@ goto bad; } /* don't allow broadcast messages to be fragmented */ - if (ip->ip_len > mtu) { + if (ip_len > mtu) { error = EMSGSIZE; goto bad; } @@ -502,12 +503,6 @@ hlen = ip->ip_hl << 2; #endif /* IPSEC */ - /* - * To network byte order. pfil(9) hooks and ip_fragment() expect this. - */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - /* Jump over all PFIL processing if hooks are not active. */ if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; @@ -544,8 +539,6 @@ } else { if (ia != NULL) ifa_free(&ia->ia_ifa); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto again; /* Redo the routing table lookup. */ } } @@ -579,16 +572,11 @@ m_tag_delete(m, fwd_tag); if (ia != NULL) ifa_free(&ia->ia_ifa); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto again; } #endif /* IPFIREWALL_FORWARD */ passout: - ip_len = ntohs(ip->ip_len); - ip_off = ntohs(ip->ip_off); - /* 127/8 must not appear on wire - RFC1122. */ if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { @@ -1295,8 +1283,6 @@ * calls the output routine of the loopback "driver", but with an interface * pointer that might NOT be a loopback interface -- evil, but easier than * replicating that code here. - * - * IP header in host byte order. */ static void ip_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in *dst, @@ -1326,8 +1312,6 @@ * than the interface's MTU. Can this possibly matter? */ ip = mtod(copym, struct ip *); - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(copym, hlen); #if 1 /* XXX */ Index: sys/netinet/in_gif.c =================================================================== --- sys/netinet/in_gif.c (revision 241405) +++ sys/netinet/in_gif.c (working copy) @@ -192,7 +192,7 @@ iphdr.ip_p = proto; /* version will be set in ip_output() */ iphdr.ip_ttl = V_ip_gif_ttl; - iphdr.ip_len = m->m_pkthdr.len + sizeof(struct ip); + iphdr.ip_len = htons(m->m_pkthdr.len + sizeof(struct ip)); ip_ecn_ingress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED : ECN_NOCARE, &iphdr.ip_tos, &tos); Index: sys/netinet/ip_options.c =================================================================== --- sys/netinet/ip_options.c (revision 241405) +++ sys/netinet/ip_options.c (working copy) @@ -494,7 +494,7 @@ unsigned optlen; optlen = opt->m_len - sizeof(p->ipopt_dst); - if (optlen + ip->ip_len > IP_MAXPACKET) { + if (optlen + ntohs(ip->ip_len) > IP_MAXPACKET) { *phlen = 0; return (m); /* XXX should fail */ } @@ -527,7 +527,7 @@ *phlen = sizeof(struct ip) + optlen; ip->ip_v = IPVERSION; ip->ip_hl = *phlen >> 2; - ip->ip_len += optlen; + ip->ip_len = htons(ntohs(ip->ip_len) + optlen); return (m); } Index: sys/netinet/tcp_timewait.c =================================================================== --- sys/netinet/tcp_timewait.c (revision 241405) +++ sys/netinet/tcp_timewait.c (working copy) @@ -593,9 +593,9 @@ m->m_pkthdr.csum_flags = CSUM_TCP; th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(sizeof(struct tcphdr) + optlen + IPPROTO_TCP)); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); if (V_path_mtu_discovery) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); error = ip_output(m, inp->inp_options, NULL, ((tw->tw_so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), NULL, inp); Index: sys/netinet/tcp_output.c =================================================================== --- sys/netinet/tcp_output.c (revision 241405) +++ sys/netinet/tcp_output.c (working copy) @@ -1239,7 +1239,7 @@ struct route ro; bzero(&ro, sizeof(ro)); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); #ifdef INET6 if (tp->t_inpcb->inp_vflag & INP_IPV6PROTO) ip->ip_ttl = in6_selecthlim(tp->t_inpcb, NULL); @@ -1253,7 +1253,7 @@ * NB: Don't set DF on small MTU/MSS to have a safe fallback. */ if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); error = ip_output(m, tp->t_inpcb->inp_options, &ro, ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0, Index: sys/netinet/sctputil.c =================================================================== --- sys/netinet/sctputil.c (revision 241405) +++ sys/netinet/sctputil.c (working copy) @@ -6821,7 +6821,7 @@ switch (iph->ip_v) { #ifdef INET case IPVERSION: - iph->ip_len -= sizeof(struct udphdr); + iph->ip_len = ntohs(htons(iph->ip_len) - sizeof(struct udphdr)); sctp_input_with_port(m, off, port); break; #endif Index: sys/netinet/ip_input.c =================================================================== --- sys/netinet/ip_input.c (revision 241405) +++ sys/netinet/ip_input.c (working copy) @@ -390,9 +390,8 @@ m->m_flags &= ~M_FASTFWD_OURS; /* Set up some basics that will be used later. */ ip = mtod(m, struct ip *); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); hlen = ip->ip_hl << 2; + ip_len = ntohs(ip->ip_len); goto ours; } @@ -513,8 +512,6 @@ #ifdef IPFIREWALL_FORWARD if (m->m_flags & M_FASTFWD_OURS) { m->m_flags &= ~M_FASTFWD_OURS; - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto ours; } if ((dchg = (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL)) != 0) { @@ -523,20 +520,12 @@ * packets originally destined to us to some other directly * connected host. */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); ip_forward(m, dchg); return; } #endif /* IPFIREWALL_FORWARD */ passin: - /* - * From now and up to output pfil(9) processing in ip_output() - * the header is in host byte order. - */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); /* * Process options and, if not destined for us, @@ -732,20 +721,21 @@ * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. */ - if (ip->ip_off & (IP_MF | IP_OFFMASK)) { + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) { m = ip_reass(m); if (m == NULL) return; ip = mtod(m, struct ip *); /* Get the header length of the reassembled packet */ hlen = ip->ip_hl << 2; + ip_len = ntohs(ip->ip_len); } /* * Further protocols expect the packet length to be w/o the * IP header. */ - ip->ip_len -= hlen; + ip->ip_len = htons(ip_len - hlen); #ifdef IPSEC /* @@ -914,22 +904,21 @@ * Adjust ip_len to not reflect header, * convert offset of this to bytes. */ - ip->ip_len -= hlen; - if (ip->ip_off & IP_MF) { + ip->ip_len = htons(ntohs(ip->ip_len) - hlen); + if (ip->ip_off & htons(IP_MF)) { /* * Make sure that fragments have a data length * that's a non-zero multiple of 8 bytes. */ - if (ip->ip_len == 0 || (ip->ip_len & 0x7) != 0) { + if (ntohs(ip->ip_len) == 0 || (ntohs(ip->ip_len & 0x7) != 0)) { IPSTAT_INC(ips_toosmall); /* XXX */ goto dropfrag; } m->m_flags |= M_FRAG; } else m->m_flags &= ~M_FRAG; - ip->ip_off <<= 3; + ip->ip_off = htons(ntohs(ip->ip_off) << 3); - /* * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. @@ -1000,7 +989,7 @@ * Find a segment which begins after this one does. */ for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) - if (GETIP(q)->ip_off > ip->ip_off) + if (ntohs(GETIP(q)->ip_off) > ntohs(ip->ip_off)) break; /* @@ -1013,14 +1002,15 @@ * segment, then it's checksum is invalidated. */ if (p) { - i = GETIP(p)->ip_off + GETIP(p)->ip_len - ip->ip_off; + i = ntohs(GETIP(p)->ip_off) + ntohs(GETIP(p)->ip_len) - + ntohs(ip->ip_off); if (i > 0) { - if (i >= ip->ip_len) + if (i >= ntohs(ip->ip_len)) goto dropfrag; m_adj(m, i); m->m_pkthdr.csum_flags = 0; - ip->ip_off += i; - ip->ip_len -= i; + ip->ip_off = htons(ntohs(ip->ip_off) + i); + ip->ip_len = htons(ntohs(ip->ip_len) - i); } m->m_nextpkt = p->m_nextpkt; p->m_nextpkt = m; @@ -1033,12 +1023,13 @@ * While we overlap succeeding segments trim them or, * if they are completely covered, dequeue them. */ - for (; q != NULL && ip->ip_off + ip->ip_len > GETIP(q)->ip_off; - q = nq) { - i = (ip->ip_off + ip->ip_len) - GETIP(q)->ip_off; - if (i < GETIP(q)->ip_len) { - GETIP(q)->ip_len -= i; - GETIP(q)->ip_off += i; + for (; q != NULL && ntohs(ip->ip_off) + ntohs(ip->ip_len) > + ntohs(GETIP(q)->ip_off); q = nq) { + i = (ntohs(ip->ip_off) + ntohs(ip->ip_len)) - + ntohs(GETIP(q)->ip_off); + if (i < ntohs(GETIP(q)->ip_len)) { + GETIP(q)->ip_len = htons(ntohs(GETIP(q)->ip_len) - i); + GETIP(q)->ip_off = htons(ntohs(GETIP(q)->ip_off) + i); m_adj(q, i); q->m_pkthdr.csum_flags = 0; break; @@ -1062,14 +1053,14 @@ */ next = 0; for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) { - if (GETIP(q)->ip_off != next) { + if (ntohs(GETIP(q)->ip_off) != next) { if (fp->ipq_nfrags > V_maxfragsperpacket) { IPSTAT_ADD(ips_fragdropped, fp->ipq_nfrags); ip_freef(head, fp); } goto done; } - next += GETIP(q)->ip_len; + next += ntohs(GETIP(q)->ip_len); } /* Make sure the last packet didn't have the IP_MF flag */ if (p->m_flags & M_FRAG) { @@ -1125,7 +1116,7 @@ * packet; dequeue and discard fragment reassembly header. * Make header visible. */ - ip->ip_len = (ip->ip_hl << 2) + next; + ip->ip_len = htons((ip->ip_hl << 2) + next); ip->ip_src = fp->ipq_src; ip->ip_dst = fp->ipq_dst; TAILQ_REMOVE(head, fp, ipq_list); @@ -1365,8 +1356,6 @@ * * The srcrt parameter indicates whether the packet is being forwarded * via a source route. - * - * IP header in host byte order. */ void ip_forward(struct mbuf *m, int srcrt) @@ -1436,7 +1425,7 @@ mcopy = NULL; } if (mcopy != NULL) { - mcopy->m_len = min(ip->ip_len, M_TRAILINGSPACE(mcopy)); + mcopy->m_len = min(ntohs(ip->ip_len), M_TRAILINGSPACE(mcopy)); mcopy->m_pkthdr.len = mcopy->m_len; m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t)); } @@ -1564,7 +1553,7 @@ if (ia != NULL) mtu = ia->ia_ifp->if_mtu; else - mtu = ip_next_mtu(ip->ip_len, 0); + mtu = ip_next_mtu(ntohs(ip->ip_len), 0); } IPSTAT_INC(ips_cantfrag); break; Index: sys/netinet/siftr.c =================================================================== --- sys/netinet/siftr.c (revision 241405) +++ sys/netinet/siftr.c (working copy) @@ -952,7 +952,8 @@ * the mbuf cluster "at" at offset "offset" bytes from * the beginning of the "at" mbuf's data pointer. */ - th->th_sum = in_cksum_skip(*m, ip->ip_len, ip_hl); + th->th_sum = in_cksum_skip(*m, ntohs(ip->ip_len), + ip_hl); } /* Index: sys/netinet/ip_icmp.c =================================================================== --- sys/netinet/ip_icmp.c (revision 241405) +++ sys/netinet/ip_icmp.c (working copy) @@ -200,7 +200,7 @@ */ if (n->m_flags & M_DECRYPTED) goto freeit; - if (oip->ip_off & ~(IP_MF|IP_DF)) + if (oip->ip_off & htons(~(IP_MF|IP_DF))) goto freeit; if (n->m_flags & (M_BCAST|M_MCAST)) goto freeit; @@ -234,16 +234,17 @@ tcphlen = th->th_off << 2; if (tcphlen < sizeof(struct tcphdr)) goto freeit; - if (oip->ip_len < oiphlen + tcphlen) + if (ntohs(oip->ip_len) < oiphlen + tcphlen) goto freeit; if (oiphlen + tcphlen > n->m_len && n->m_next == NULL) goto stdreply; if (n->m_len < oiphlen + tcphlen && ((n = m_pullup(n, oiphlen + tcphlen)) == NULL)) goto freeit; - icmpelen = max(tcphlen, min(V_icmp_quotelen, oip->ip_len - oiphlen)); + icmpelen = max(tcphlen, min(V_icmp_quotelen, + ntohs(oip->ip_len) - oiphlen)); } else -stdreply: icmpelen = max(8, min(V_icmp_quotelen, oip->ip_len - oiphlen)); +stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); icmplen = min(oiphlen + icmpelen, nlen); if (icmplen < sizeof(struct ip)) @@ -293,8 +294,6 @@ */ m_copydata(n, 0, icmplen, (caddr_t)&icp->icmp_ip); nip = &icp->icmp_ip; - nip->ip_len = htons(nip->ip_len); - nip->ip_off = htons(nip->ip_off); /* * Set up ICMP message mbuf and copy old IP header (without options @@ -309,7 +308,7 @@ m->m_pkthdr.rcvif = n->m_pkthdr.rcvif; nip = mtod(m, struct ip *); bcopy((caddr_t)oip, (caddr_t)nip, sizeof(struct ip)); - nip->ip_len = m->m_len; + nip->ip_len = htons(m->m_len); nip->ip_v = IPVERSION; nip->ip_hl = 5; nip->ip_p = IPPROTO_ICMP; @@ -331,7 +330,7 @@ struct ip *ip = mtod(m, struct ip *); struct sockaddr_in icmpsrc, icmpdst, icmpgw; int hlen = off; - int icmplen = ip->ip_len; + int icmplen = ntohs(ip->ip_len); int i, code; void (*ctlfunc)(int, struct sockaddr *, void *); int fibnum; @@ -472,7 +471,6 @@ ICMPSTAT_INC(icps_badlen); goto freeit; } - icp->icmp_ip.ip_len = ntohs(icp->icmp_ip.ip_len); /* Discard ICMP's in response to multicast packets */ if (IN_MULTICAST(ntohl(icp->icmp_ip.ip_dst.s_addr))) goto badcode; @@ -565,7 +563,8 @@ } ifa_free(&ia->ia_ifa); reflect: - ip->ip_len += hlen; /* since ip_input deducts this */ + /* Since ip_input() deducts this. */ + ip->ip_len = htons(ntohs(ip->ip_len) + hlen); ICMPSTAT_INC(icps_reflect); ICMPSTAT_INC(icps_outhist[icp->icmp_type]); icmp_reflect(m); @@ -835,7 +834,7 @@ * Now strip out original options by copying rest of first * mbuf's data back, and adjust the IP length. */ - ip->ip_len -= optlen; + ip->ip_len = htons(ntohs(ip->ip_len) - optlen); ip->ip_v = IPVERSION; ip->ip_hl = 5; m->m_len -= optlen; @@ -869,7 +868,7 @@ m->m_len -= hlen; icp = mtod(m, struct icmp *); icp->icmp_cksum = 0; - icp->icmp_cksum = in_cksum(m, ip->ip_len - hlen); + icp->icmp_cksum = in_cksum(m, ntohs(ip->ip_len) - hlen); m->m_data -= hlen; m->m_len += hlen; m->m_pkthdr.rcvif = (struct ifnet *)0; Index: sys/netinet/ip_gre.c =================================================================== --- sys/netinet/ip_gre.c (revision 241405) +++ sys/netinet/ip_gre.c (working copy) @@ -274,12 +274,10 @@ /* * On FreeBSD, rip_input() supplies us with ip->ip_len - * already converted into host byteorder and also decreases - * it by the lengh of IP header, however, ip_input() expects - * that this field is in the original format (network byteorder - * and full size of IP packet), so that adjust accordingly. + * decreased by the lengh of IP header, however, ip_input() + * expects it to be full size of IP packet, so adjust accordingly. */ - ip->ip_len = htons(ip->ip_len + sizeof(struct ip) - msiz); + ip->ip_len = htons(ntohs(ip->ip_len) + sizeof(struct ip) - msiz); ip->ip_sum = 0; ip->ip_sum = in_cksum(m, (ip->ip_hl << 2)); Index: sys/netinet/ip_ipsec.c =================================================================== --- sys/netinet/ip_ipsec.c (revision 241405) +++ sys/netinet/ip_ipsec.c (working copy) @@ -264,7 +264,6 @@ { #ifdef IPSEC struct secpolicy *sp = NULL; - struct ip *ip = mtod(*m, struct ip *); struct tdb_ident *tdbi; struct m_tag *mtag; int s; @@ -332,9 +331,6 @@ } } - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - /* * Do delayed checksums now because we send before * this is done in the normal processing path. @@ -345,6 +341,8 @@ } #ifdef SCTP if ((*m)->m_pkthdr.csum_flags & CSUM_SCTP) { + struct ip *ip = mtod(*m, struct ip *); + sctp_delayed_cksum(*m, (uint32_t)(ip->ip_hl << 2)); (*m)->m_pkthdr.csum_flags &= ~CSUM_SCTP; } @@ -359,8 +357,6 @@ * IPsec processing and return without error. */ *error = 0; - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto done; } /* Index: sys/netinet/ip_mroute.c =================================================================== --- sys/netinet/ip_mroute.c (revision 241405) +++ sys/netinet/ip_mroute.c (working copy) @@ -1493,7 +1493,7 @@ { struct ip *ip = mtod(m, struct ip *); vifi_t vifi; - int plen = ip->ip_len; + int plen = ntohs(ip->ip_len); VIF_LOCK_ASSERT(); @@ -2376,10 +2376,7 @@ /* Take care of delayed checksums */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - /* XXX: in_delayed_cksum() expects net byte order */ - ip->ip_len = htons(ip->ip_len); in_delayed_cksum(m); - ip->ip_len = ntohs(ip->ip_len); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } @@ -2401,10 +2398,8 @@ /* Compute the MTU after the PIM Register encapsulation */ mtu = 0xffff - sizeof(pim_encap_iphdr) - sizeof(pim_encap_pimhdr); - if (ip->ip_len <= mtu) { + if (ntohs(ip->ip_len) <= mtu) { /* Turn the IP header into a valid one */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(mb_copy, ip->ip_hl << 2); } else { @@ -2509,7 +2504,8 @@ ip_outer = mtod(mb_first, struct ip *); *ip_outer = pim_encap_iphdr; ip_outer->ip_id = ip_newid(); - ip_outer->ip_len = len + sizeof(pim_encap_iphdr) + sizeof(pim_encap_pimhdr); + ip_outer->ip_len = htons(len + sizeof(pim_encap_iphdr) + + sizeof(pim_encap_pimhdr)); ip_outer->ip_src = V_viftable[vifi].v_lcl_addr; ip_outer->ip_dst = rt->mfc_rp; /* @@ -2517,8 +2513,8 @@ * IP_DF bit. */ ip_outer->ip_tos = ip->ip_tos; - if (ntohs(ip->ip_off) & IP_DF) - ip_outer->ip_off |= IP_DF; + if (ip->ip_off & htons(IP_DF)) + ip_outer->ip_off |= htons(IP_DF); pimhdr = (struct pim_encap_pimhdr *)((caddr_t)ip_outer + sizeof(pim_encap_iphdr)); *pimhdr = pim_encap_pimhdr; @@ -2571,7 +2567,7 @@ struct ip *ip = mtod(m, struct ip *); struct pim *pim; int minlen; - int datalen = ip->ip_len; + int datalen = ntohs(ip->ip_len); int ip_tos; int iphlen = off; Index: sys/netinet/sctp_output.c =================================================================== --- sys/netinet/sctp_output.c (revision 241405) +++ sys/netinet/sctp_output.c (working copy) @@ -3980,7 +3980,7 @@ tos_value |= sctp_get_ect(stcb); } if ((nofragment_flag) && (port == 0)) { - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); } else ip->ip_off = 0; @@ -3988,7 +3988,7 @@ ip->ip_id = ip_newid(); ip->ip_ttl = inp->ip_inp.inp.inp_ip_ttl; - ip->ip_len = packet_length; + ip->ip_len = htons(packet_length); ip->ip_tos = tos_value; if (port) { ip->ip_p = IPPROTO_UDP; @@ -10991,7 +10991,7 @@ udp->uh_sum = 0; } } - ip->ip_len = len; + ip->ip_len = htons(len); if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); Index: sys/netinet/igmp.c =================================================================== --- sys/netinet/igmp.c (revision 241405) +++ sys/netinet/igmp.c (working copy) @@ -1442,7 +1442,7 @@ ip = mtod(m, struct ip *); iphlen = off; - igmplen = ip->ip_len; + igmplen = ntohs(ip->ip_len); /* * Validate lengths. @@ -2225,7 +2225,7 @@ ip = mtod(m, struct ip *); ip->ip_tos = 0; - ip->ip_len = sizeof(struct ip) + sizeof(struct igmp); + ip->ip_len = htons(sizeof(struct ip) + sizeof(struct igmp)); ip->ip_off = 0; ip->ip_p = IPPROTO_IGMP; ip->ip_src.s_addr = INADDR_ANY; @@ -3522,8 +3522,8 @@ ip = mtod(m, struct ip *); ip->ip_tos = IPTOS_PREC_INTERNETCONTROL; - ip->ip_len = hdrlen + igmpreclen; - ip->ip_off = IP_DF; + ip->ip_len = htons(hdrlen + igmpreclen); + ip->ip_off = htons(IP_DF); ip->ip_p = IPPROTO_IGMP; ip->ip_sum = 0; Index: sys/netinet6/ip6_ipsec.c =================================================================== --- sys/netinet6/ip6_ipsec.c (revision 241405) +++ sys/netinet6/ip6_ipsec.c (working copy) @@ -295,15 +295,9 @@ */ #ifdef INET if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - struct ip *ip; - ipseclog((LOG_DEBUG, "%s: we do not support IPv4 over IPv6", __func__)); - /* XXX: in_delayed_cksum() expects net byte order */ - ip = mtod(*m, struct ip *); - ip->ip_len = htons(ip->ip_len); in_delayed_cksum(*m); - ip->ip_len = ntohs(ip->ip_len); (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } #endif Index: sys/netpfil/pf/pf.c =================================================================== --- sys/netpfil/pf/pf.c (revision 241405) +++ sys/netpfil/pf/pf.c (working copy) @@ -2252,8 +2252,8 @@ h->ip_v = 4; h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; - h->ip_off = V_path_mtu_discovery ? IP_DF : 0; - h->ip_len = len; + h->ip_off = V_path_mtu_discovery ? htons(IP_DF) : 0; + h->ip_len = htons(len); h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; @@ -2316,17 +2316,8 @@ switch (af) { #ifdef INET case AF_INET: - { - struct ip *ip; - - /* icmp_error() expects host byte ordering */ - ip = mtod(m0, struct ip *); - NTOHS(ip->ip_len); - NTOHS(ip->ip_off); - pfse->pfse_type = PFSE_ICMP; break; - } #endif /* INET */ #ifdef INET6 case AF_INET6: Index: sys/netpfil/pf/if_pfsync.c =================================================================== --- sys/netpfil/pf/if_pfsync.c (revision 241405) +++ sys/netpfil/pf/if_pfsync.c (working copy) @@ -1384,7 +1384,7 @@ ip->ip_hl = sizeof(sc->sc_template) >> 2; ip->ip_tos = IPTOS_LOWDELAY; /* len and id are set later. */ - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); ip->ip_ttl = PFSYNC_DFLTTL; ip->ip_p = IPPROTO_PFSYNC; ip->ip_src.s_addr = INADDR_ANY; @@ -1522,7 +1522,7 @@ bcopy(&sc->sc_template, ip, sizeof(*ip)); offset = sizeof(*ip); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); ip->ip_id = htons(ip_randomid()); /* build the pfsync header */ Index: sys/netpfil/ipfw/ip_fw_dynamic.c =================================================================== --- sys/netpfil/ipfw/ip_fw_dynamic.c (revision 241405) +++ sys/netpfil/ipfw/ip_fw_dynamic.c (working copy) @@ -1017,8 +1017,7 @@ h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; h->ip_off = 0; - /* ip_len must be in host format for ip_output */ - h->ip_len = len; + h->ip_len = htons(len); h->ip_ttl = V_ip_defttl; h->ip_sum = 0; break; Index: sys/netpfil/ipfw/ip_fw_pfil.c =================================================================== --- sys/netpfil/ipfw/ip_fw_pfil.c (revision 241405) +++ sys/netpfil/ipfw/ip_fw_pfil.c (working copy) @@ -431,7 +431,6 @@ int hlen; struct mbuf *reass; - SET_HOST_IPLEN(ip); /* ip_reass wants host order */ reass = ip_reass(clone); /* Reassemble packet. */ if (reass == NULL) return 0; /* not an error */ @@ -442,7 +441,6 @@ */ ip = mtod(reass, struct ip *); hlen = ip->ip_hl << 2; - SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Index: sys/netpfil/ipfw/ip_dn_io.c =================================================================== --- sys/netpfil/ipfw/ip_dn_io.c (revision 241405) +++ sys/netpfil/ipfw/ip_dn_io.c (working copy) @@ -658,13 +658,10 @@ switch (dst) { case DIR_OUT: - SET_HOST_IPLEN(mtod(m, struct ip *)); ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL); break ; case DIR_IN : - /* put header in network format for ip_input() */ - //SET_NET_IPLEN(mtod(m, struct ip *)); netisr_dispatch(NETISR_IP, m); break; Index: sys/netpfil/ipfw/ip_fw2.c =================================================================== --- sys/netpfil/ipfw/ip_fw2.c (revision 241405) +++ sys/netpfil/ipfw/ip_fw2.c (working copy) @@ -627,8 +627,6 @@ m_adj(m, args->L3offset); #endif if (code != ICMP_REJECT_RST) { /* Send an ICMP unreach */ - /* We need the IP header in host order for icmp_error(). */ - SET_HOST_IPLEN(ip); icmp_error(args->m, ICMP_UNREACH, code, 0L, 0); } else if (args->f_id.proto == IPPROTO_TCP) { struct tcphdr *const tcp = @@ -2418,11 +2416,6 @@ /* if not fragmented, go to next rule */ if ((ip_off & (IP_MF | IP_OFFMASK)) == 0) break; - /* - * ip_reass() expects len & off in host - * byte order. - */ - SET_HOST_IPLEN(ip); args->m = m = ip_reass(m); @@ -2436,7 +2429,6 @@ ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; - SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Index: sys/netipsec/ipsec.c =================================================================== --- sys/netipsec/ipsec.c (revision 241405) +++ sys/netipsec/ipsec.c (working copy) @@ -597,10 +597,9 @@ IPSEC_ASSERT(m != NULL, ("null mbuf")); IPSEC_ASSERT(m->m_pkthdr.len >= sizeof(struct ip),("packet too short")); - /* NB: ip_input() flips it into host endian. XXX Need more checking. */ if (m->m_len >= sizeof (struct ip)) { struct ip *ip = mtod(m, struct ip *); - if (ip->ip_off & (IP_MF | IP_OFFMASK)) + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) goto done; #ifdef _IP_VHL off = _IP_VHL_HL(ip->ip_vhl) << 2; @@ -612,7 +611,7 @@ struct ip ih; m_copydata(m, 0, sizeof (struct ip), (caddr_t) &ih); - if (ih.ip_off & (IP_MF | IP_OFFMASK)) + if (ih.ip_off & htons(IP_MF | IP_OFFMASK)) goto done; #ifdef _IP_VHL off = _IP_VHL_HL(ih.ip_vhl) << 2; Index: sys/netgraph/ng_ipfw.c =================================================================== --- sys/netgraph/ng_ipfw.c (revision 241405) +++ sys/netgraph/ng_ipfw.c (working copy) @@ -265,7 +265,6 @@ switch (ip->ip_v) { #ifdef INET case IPVERSION: - SET_HOST_IPLEN(ip); return (ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL)); #endif Index: sys/net/if_stf.c =================================================================== --- sys/net/if_stf.c (revision 241405) +++ sys/net/if_stf.c (working copy) @@ -523,7 +523,7 @@ bcopy(&in4, &ip->ip_dst, sizeof(ip->ip_dst)); ip->ip_p = IPPROTO_IPV6; ip->ip_ttl = ip_stf_ttl; - ip->ip_len = m->m_pkthdr.len; /*host order*/ + ip->ip_len = htons(m->m_pkthdr.len); if (ifp->if_flags & IFF_LINK1) ip_ecn_ingress(ECN_ALLOWED, &ip->ip_tos, &tos); else Index: sys/net/if_gre.c =================================================================== --- sys/net/if_gre.c (revision 241405) +++ sys/net/if_gre.c (working copy) @@ -356,7 +356,7 @@ * RFC2004 specifies that fragmented diagrams shouldn't * be encapsulated. */ - if (ip->ip_off & (IP_MF | IP_OFFMASK)) { + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) { _IF_DROP(&ifp->if_snd); m_freem(m); error = EINVAL; /* is there better errno? */ @@ -410,7 +410,7 @@ } ip = mtod(m, struct ip *); memcpy((caddr_t)(ip + 1), &mob_h, (unsigned)msiz); - ip->ip_len = ntohs(ip->ip_len) + msiz; + ip->ip_len = htons(ntohs(ip->ip_len) + msiz); } else { /* AF_INET */ _IF_DROP(&ifp->if_snd); m_freem(m); @@ -493,7 +493,7 @@ ((struct ip*)gh)->ip_ttl = GRE_TTL; ((struct ip*)gh)->ip_tos = gre_ip_tos; ((struct ip*)gh)->ip_id = gre_ip_id; - gh->gi_len = m->m_pkthdr.len; + gh->gi_len = htons(m->m_pkthdr.len); } ifp->if_opackets++; --HnQK338I3UIa/qiP-- From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 20:49:42 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 4C71D593 for ; Wed, 10 Oct 2012 20:49:42 +0000 (UTC) (envelope-from gnn@neville-neil.com) Received: from vps.hungerhost.com (vps.hungerhost.com [216.38.53.176]) by mx1.freebsd.org (Postfix) with ESMTP id 1DDAE8FC0A for ; Wed, 10 Oct 2012 20:49:41 +0000 (UTC) Received: from [209.249.190.124] (port=58602 helo=gnnmac.hudson-trading.com) by vps.hungerhost.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.80) (envelope-from ) id 1TM3Dp-0007OQ-9B for net@freebsd.org; Wed, 10 Oct 2012 16:49:41 -0400 From: George Neville-Neil Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: SFF 8472, aka what optic is plugged into my network card... Message-Id: Date: Wed, 10 Oct 2012 16:49:40 -0400 To: net@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) X-Mailer: Apple Mail (2.1499) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.hungerhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - neville-neil.com 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 20:49:42 -0000 Howdy, Modern 10G NICs have the ability to have different types of cables = plugged into them. There is a standard for the values contained in the cables which can be = read here: = http://www.10gtek.com/templates/wzten/pdf/SFF-8472-(Diagnostic%20Monitorin= g%20Interface).pdf It's probably the case that several NIC cards support changeable optics = on FreeBSD at this point. I know that Chelsio T4 cards do. I would like to put proper definitions = from this document into our source code. Does anyone have a preference for where and how = this is done? I figure something like net/sff8472.h would be the way to go. Comments? Best, George From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 20:56:41 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 7532F70F; Wed, 10 Oct 2012 20:56:41 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 2F5E38FC16; Wed, 10 Oct 2012 20:56:41 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 3990E7300A; Wed, 10 Oct 2012 23:17:00 +0200 (CEST) Date: Wed, 10 Oct 2012 23:17:00 +0200 From: Luigi Rizzo To: Gleb Smirnoff Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121010211700.GA20319@onelab2.iet.unipi.it> References: <20121009154128.GU34622@FreeBSD.org> <20121010124637.GA15522@onelab2.iet.unipi.it> <20121010183143.GF34622@glebius.int.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121010183143.GF34622@glebius.int.ru> User-Agent: Mutt/1.4.2.3i 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 20:56:41 -0000 On Wed, Oct 10, 2012 at 10:31:43PM +0400, Gleb Smirnoff wrote: > Luigi, > > On Wed, Oct 10, 2012 at 02:46:37PM +0200, Luigi Rizzo wrote: > L> I am really grataful you are doing this. A few comments: ... > L> > Index: sys/netinet/raw_ip.c > L> > =================================================================== > L> > --- sys/netinet/raw_ip.c (revision 241370) > L> > +++ sys/netinet/raw_ip.c (working copy) > L> > @@ -292,6 +292,7 @@ > L> > * not modify the packet except for some > L> > * byte order swaps. > L> > */ > L> > + ip->ip_len = ntohs(ip->ip_len); > L> > ip->ip_len += off; > L> > > L> > hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, > L> > L> this seems wrong, perhaps you want > L> > L> - ip->ip_len += off; > L> + ip->ip_len = htons(ntohs(ip->ip_len) + off); > > Maxim Dounin also noticed this. This was done intentionally, but since two > people are in doubt, I will look closer here. Historically BSD had supplied > host byte order in raw sockets, but I suppose, for head/ this is no longer > true for about a year. I was not aware of that. Then please add a comment either mentioning that the behaviour differs from historical, or that the packet format differs from the (new) standard kernel format in this particular case. cheers luigi From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 21:38:10 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 37225589 for ; Wed, 10 Oct 2012 21:38:10 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from outgoing.tristatelogic.com (segfault.tristatelogic.com [69.62.255.118]) by mx1.freebsd.org (Postfix) with ESMTP id 0CC128FC18 for ; Wed, 10 Oct 2012 21:38:09 +0000 (UTC) Received: from segfault-nmh-helo.tristatelogic.com (localhost [127.0.0.1]) by segfault.tristatelogic.com (Postfix) with ESMTP id 502E550840; Wed, 10 Oct 2012 14:38:09 -0700 (PDT) To: Bernhard Schmidt Subject: Re: Oops! (was: Support for Intel 5100 WiFi ?) In-Reply-To: <201210101938.01847.bschmidt@techwires.net> Date: Wed, 10 Oct 2012 14:38:09 -0700 Message-ID: <40913.1349905089@tristatelogic.com> From: "Ronald F. Guilmette" Cc: freebsd-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 21:38:10 -0000 Thanks Bernhard for all the additional info about the current state of the iwn driver. I still do have a couple more small questions however. First it really does appear to me that even when my iwm0 device is successfully connecting to an AP which has been set to do "N-only", the information that is displayed via "ifconfig -a" is still showing it as if it were communicating using 11g: >re0: flags=8802 metric 0 mtu 1500 > options=389b > ether 00:24:21:65:ad:a0 > nd6 options=29 > media: Ethernet autoselect (10baseT/UTP ) > status: no carrier >iwn0: flags=8843 metric 0 mtu 2290 > ether 00:22:fb:76:6d:18 > nd6 options=29 > media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng > status: associated >lo0: flags=8049 metric 0 mtu 16384 > options=3 > inet6 ::1 prefixlen 128 > inet6 fe80::1%lo0 prefixlen 64 scopeid 0xa > inet 127.0.0.1 netmask 0xff000000 > nd6 options=21 >wlan0: flags=8843 metric 0 mtu 1500 > ether 00:22:fb:76:6d:18 > inet 192.168.1.23 netmask 0xffffff00 broadcast 192.168.1.255 > inet6 fe80::222:fbff:fe76:6d18%wlan0 prefixlen 64 scopeid 0xb > nd6 options=29 > media: IEEE 802.11 Wireless Ethernet OFDM/24Mbps mode 11ng > status: associated > ssid ronair2-1 channel 11 (2462 MHz 11g ht/40-) bssid c0:c1:c0:8b:4b:f3 ^^^ > country US authmode WPA2/802.11i privacy ON deftxkey UNDEF > AES-CCM 2:128-bit txpower 15 bmiss 10 scanvalid 450 bgscan > bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 64 protmode CTS > ampdulimit 64k ampdudensity 8 -amsdutx amsdurx shortgi wme > roaming MANUAL Should I file a PR on this small problem/issue? Second, and again based on the output shown via "ifconfig -a", it appears to me that even when it is in `N' mode (and even when my AP is set to "auto" selection of either 40 or 20Mhz channels), the card is never managing to get above 54Mbps, tops (and often considerably less, as you can see above). So what am I doing wrong exactly? I had been trying some different equipment earlier, but in the same locations and at the same distance, and in that case I was routinely getting between 117Mbps and as much as 130Mbps... or anyway, so said dd-wrt. Ultimately, I want to stream HD out to the laptop that has the Intel 5100 in in, and thus, I really would like to get something above 54Mbps. And it seems to me that this _should_ be possible. (In theory, I should be able to get all of the way to 150Mbps, right?) So why can't I get my iwn0 device (Intel 5100) under FreeBSD going anywhere near that fast? Regards, rfg From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 22:26:54 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 21CAE795; Wed, 10 Oct 2012 22:26:54 +0000 (UTC) (envelope-from mdounin@mdounin.ru) Received: from mdounin.cust.ramtel.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mx1.freebsd.org (Postfix) with ESMTP id CACDF8FC0A; Wed, 10 Oct 2012 22:26:53 +0000 (UTC) Received: from mdounin.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mdounin.cust.ramtel.ru (Postfix) with ESMTP id EC4081703D; Thu, 11 Oct 2012 02:26:51 +0400 (MSK) Date: Thu, 11 Oct 2012 02:26:51 +0400 From: Maxim Dounin To: Gleb Smirnoff Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121010222651.GR40452@mdounin.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121010195842.GH34622@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121010195842.GH34622@FreeBSD.org> 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 22:26:54 -0000 Hello! On Wed, Oct 10, 2012 at 11:58:42PM +0400, Gleb Smirnoff wrote: > On Tue, Oct 09, 2012 at 07:41:28PM +0400, Gleb Smirnoff wrote: > T> this is a patch that switches entire IPv4 stack to network > T> byte order. That means, that at any layer any module should > T> expect IP header in network byte order. Any host byte order > T> values can be stored in local variables only and are never stored > T> into a packet itself. > > Update: > > - fresh patch against r241405, should apply to r241405 > - fixed raw sockets` as Luigi and Max Dounin noticed, also fixed > another issue with raw sockets, now work fine - tested with ospfd > - fixed gre(4) > - took into account Luigi's comments about using host byte order > in any ==, <, > comparisons. > > Decided not to touch ip_reass(). > > -- > Totus tuus, Glebius. [...] > --- sys/netinet/raw_ip.c (revision 241405) > +++ sys/netinet/raw_ip.c (working copy) > @@ -292,7 +292,7 @@ > * not modify the packet except for some > * byte order swaps. > */ > - ip->ip_len += off; > + ip->ip_len = htons(ip->ip_len) + off; This one is certainly wrong as it uses arithmetic with a number in network byte order. > > hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, > ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask); > @@ -449,11 +449,11 @@ > ip = mtod(m, struct ip *); > ip->ip_tos = inp->inp_ip_tos; > if (inp->inp_flags & INP_DONTFRAG) > - ip->ip_off = IP_DF; > + ip->ip_off = htons(IP_DF); > else > ip->ip_off = 0; > ip->ip_p = inp->inp_ip_p; > - ip->ip_len = m->m_pkthdr.len; > + ip->ip_len = htons(m->m_pkthdr.len); > ip->ip_src = inp->inp_laddr; > if (jailed(inp->inp_cred)) { > /* > @@ -504,6 +504,9 @@ > if (ip->ip_id == 0) > ip->ip_id = ip_newid(); > > + ip->ip_len = htons(ip->ip_len); > + ip->ip_off = htons(ip->ip_off); > + So the packet is expected to come into rip_output() from caller with ip_len/ip_off in host byte order, right? As already suggested - it would be good to add a comment explaining this. [...] -- Maxim Dounin From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 23:34:07 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 137E8EB9 for ; Wed, 10 Oct 2012 23:34:07 +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 DD5A08FC0C for ; Wed, 10 Oct 2012 23:34:05 +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 q9ANY4TM089088; Thu, 11 Oct 2012 03:34:04 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9ANY4kH089087; Thu, 11 Oct 2012 03:34:04 +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:34:04 +0400 From: Gleb Smirnoff To: Maxim Dounin Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121010233404.GI34622@glebius.int.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121010195842.GH34622@FreeBSD.org> <20121010222651.GR40452@mdounin.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="K/NRh952CO+2tg14" Content-Disposition: inline In-Reply-To: <20121010222651.GR40452@mdounin.ru> 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 23:34:07 -0000 --K/NRh952CO+2tg14 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Maxim, On Thu, Oct 11, 2012 at 02:26:51AM +0400, Maxim Dounin wrote: M> > --- sys/netinet/raw_ip.c (revision 241405) M> > +++ sys/netinet/raw_ip.c (working copy) M> > @@ -292,7 +292,7 @@ M> > * not modify the packet except for some M> > * byte order swaps. M> > */ M> > - ip->ip_len += off; M> > + ip->ip_len = htons(ip->ip_len) + off; M> M> This one is certainly wrong as it uses arithmetic with a number in M> network byte order. Ah, this is a typo certainly. Should be ntohs(). Code did work just because functions are symmetrical. Regenerated diff attached. M> > M> > hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, M> > ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask); M> > @@ -449,11 +449,11 @@ M> > ip = mtod(m, struct ip *); M> > ip->ip_tos = inp->inp_ip_tos; M> > if (inp->inp_flags & INP_DONTFRAG) M> > - ip->ip_off = IP_DF; M> > + ip->ip_off = htons(IP_DF); M> > else M> > ip->ip_off = 0; M> > ip->ip_p = inp->inp_ip_p; M> > - ip->ip_len = m->m_pkthdr.len; M> > + ip->ip_len = htons(m->m_pkthdr.len); M> > ip->ip_src = inp->inp_laddr; M> > if (jailed(inp->inp_cred)) { M> > /* 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. -- Totus tuus, Glebius. --K/NRh952CO+2tg14 Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="IPv4.net-byte-order.diff" Index: sys/netinet/tcp_input.c =================================================================== --- sys/netinet/tcp_input.c (revision 241405) +++ sys/netinet/tcp_input.c (working copy) @@ -645,21 +645,19 @@ ip = mtod(m, struct ip *); ipov = (struct ipovly *)ip; th = (struct tcphdr *)((caddr_t)ip + off0); - tlen = ip->ip_len; + tlen = ntohs(ip->ip_len); if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) th->th_sum = m->m_pkthdr.csum_data; else th->th_sum = in_pseudo(ip->ip_src.s_addr, - ip->ip_dst.s_addr, - htonl(m->m_pkthdr.csum_data + - ip->ip_len + - IPPROTO_TCP)); + ip->ip_dst.s_addr, + htonl(m->m_pkthdr.csum_data + tlen + + IPPROTO_TCP)); th->th_sum ^= 0xffff; #ifdef TCPDEBUG - ipov->ih_len = (u_short)tlen; - ipov->ih_len = htons(ipov->ih_len); + ipov->ih_len = ip->ip_len; #endif } else { /* @@ -667,8 +665,7 @@ */ len = sizeof (struct ip) + tlen; bzero(ipov->ih_x1, sizeof(ipov->ih_x1)); - ipov->ih_len = (u_short)tlen; - ipov->ih_len = htons(ipov->ih_len); + ipov->ih_len = ip->ip_len; th->th_sum = in_cksum(m, len); } if (th->th_sum) { Index: sys/netinet/in.h =================================================================== --- sys/netinet/in.h (revision 241405) +++ sys/netinet/in.h (working copy) @@ -741,33 +741,6 @@ #define satosin(sa) ((struct sockaddr_in *)(sa)) #define sintosa(sin) ((struct sockaddr *)(sin)) #define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) - -/* - * Historically, BSD keeps ip_len and ip_off in host format - * when doing layer 3 processing, and this often requires - * to translate the format back and forth. - * To make the process explicit, we define a couple of macros - * that also take into account the fact that at some point - * we may want to keep those fields always in net format. - */ - -#if (BYTE_ORDER == BIG_ENDIAN) || defined(HAVE_NET_IPLEN) -#define SET_NET_IPLEN(p) do {} while (0) -#define SET_HOST_IPLEN(p) do {} while (0) -#else -#define SET_NET_IPLEN(p) do { \ - struct ip *h_ip = (p); \ - h_ip->ip_len = htons(h_ip->ip_len); \ - h_ip->ip_off = htons(h_ip->ip_off); \ - } while (0) - -#define SET_HOST_IPLEN(p) do { \ - struct ip *h_ip = (p); \ - h_ip->ip_len = ntohs(h_ip->ip_len); \ - h_ip->ip_off = ntohs(h_ip->ip_off); \ - } while (0) -#endif /* !HAVE_NET_IPLEN */ - #endif /* _KERNEL */ /* INET6 stuff */ Index: sys/netinet/tcp_subr.c =================================================================== --- sys/netinet/tcp_subr.c (revision 241405) +++ sys/netinet/tcp_subr.c (working copy) @@ -584,10 +584,10 @@ #ifdef INET { tlen += sizeof (struct tcpiphdr); - ip->ip_len = tlen; + ip->ip_len = htons(tlen); ip->ip_ttl = V_ip_defttl; if (V_path_mtu_discovery) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); } #endif m->m_len = tlen; @@ -1398,12 +1398,11 @@ /* * If no alternative MTU was * proposed, try the next smaller - * one. ip->ip_len has already - * been swapped in icmp_input(). + * one. */ if (!mtu) - mtu = ip_next_mtu(ip->ip_len, - 1); + mtu = ip_next_mtu( + ntohs(ip->ip_len), 1); if (mtu < V_tcp_minmss + sizeof(struct tcpiphdr)) mtu = V_tcp_minmss Index: sys/netinet/tcp_debug.c =================================================================== --- sys/netinet/tcp_debug.c (revision 241405) +++ sys/netinet/tcp_debug.c (working copy) @@ -175,11 +175,10 @@ #ifdef INET6 isipv6 ? ntohs(((struct ip6_hdr *)ipgen)->ip6_plen) : #endif - ((struct ip *)ipgen)->ip_len; + ntohs(((struct ip *)ipgen)->ip_len); if (act == TA_OUTPUT) { seq = ntohl(seq); ack = ntohl(ack); - len = ntohs((u_short)len); } if (act == TA_OUTPUT) len -= sizeof (struct tcphdr); Index: sys/netinet/tcp_syncache.c =================================================================== --- sys/netinet/tcp_syncache.c (revision 241405) +++ sys/netinet/tcp_syncache.c (working copy) @@ -1395,7 +1395,7 @@ ip = mtod(m, struct ip *); ip->ip_v = IPVERSION; ip->ip_hl = sizeof(struct ip) >> 2; - ip->ip_len = tlen; + ip->ip_len = htons(tlen); ip->ip_id = 0; ip->ip_off = 0; ip->ip_sum = 0; @@ -1413,7 +1413,7 @@ * 2) the SCF_UNREACH flag has been set */ if (V_path_mtu_discovery && ((sc->sc_flags & SCF_UNREACH) == 0)) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); th = (struct tcphdr *)(ip + 1); } @@ -1473,7 +1473,7 @@ ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) + optlen); else #endif - ip->ip_len += optlen; + ip->ip_len = htons(ntohs(ip->ip_len) + optlen); } else optlen = 0; Index: sys/netinet/sctp_input.c =================================================================== --- sys/netinet/sctp_input.c (revision 241405) +++ sys/netinet/sctp_input.c (working copy) @@ -6038,7 +6038,7 @@ dst.sin_len = sizeof(struct sockaddr_in); dst.sin_port = sh->dest_port; dst.sin_addr = ip->ip_dst; - length = ip->ip_len + iphlen; + length = ntohs(ip->ip_len) + iphlen; /* Validate mbuf chain length with IP payload length. */ if (SCTP_HEADER_LEN(m) != length) { SCTPDBG(SCTP_DEBUG_INPUT1, Index: sys/netinet/udp_usrreq.c =================================================================== --- sys/netinet/udp_usrreq.c (revision 241405) +++ sys/netinet/udp_usrreq.c (working copy) @@ -338,7 +338,7 @@ struct udphdr *uh; struct ifnet *ifp; struct inpcb *inp; - int len; + uint16_t len, ip_len; struct ip save_ip; struct sockaddr_in udp_in; #ifdef IPFIREWALL_FORWARD @@ -392,13 +392,13 @@ * reflect UDP length, drop. */ len = ntohs((u_short)uh->uh_ulen); - if (ip->ip_len != len) { - if (len > ip->ip_len || len < sizeof(struct udphdr)) { + ip_len = ntohs(ip->ip_len); + if (ip_len != len) { + if (len > ip_len || len < sizeof(struct udphdr)) { UDPSTAT_INC(udps_badlen); goto badunlocked; } - m_adj(m, len - ip->ip_len); - /* ip->ip_len = len; */ + m_adj(m, len - ip_len); } /* @@ -601,7 +601,7 @@ if (badport_bandlim(BANDLIM_ICMP_UNREACH) < 0) goto badunlocked; *ip = save_ip; - ip->ip_len += iphlen; + ip->ip_len = htons(ip_len + iphlen); icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); return; } @@ -1206,7 +1206,7 @@ struct ip *ip; ip = (struct ip *)&ui->ui_i; - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); } ipflags = 0; @@ -1233,7 +1233,7 @@ m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); } else ui->ui_sum = 0; - ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; + ((struct ip *)ui)->ip_len = htons(sizeof(struct udpiphdr) + len); ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */ ((struct ip *)ui)->ip_tos = tos; /* XXX */ UDPSTAT_INC(udps_opackets); @@ -1383,7 +1383,7 @@ m_adj(m, skip); ip = mtod(m, struct ip *); - ip->ip_len -= skip; + ip->ip_len = htons(ntohs(ip->ip_len) - skip); ip->ip_p = IPPROTO_ESP; /* Index: sys/netinet/ip_carp.c =================================================================== --- sys/netinet/ip_carp.c (revision 241405) +++ sys/netinet/ip_carp.c (working copy) @@ -783,9 +783,9 @@ ip->ip_v = IPVERSION; ip->ip_hl = sizeof(*ip) >> 2; ip->ip_tos = IPTOS_LOWDELAY; - ip->ip_len = len; + ip->ip_len = htons(len); ip->ip_id = ip_newid(); - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); ip->ip_ttl = CARP_DFLTTL; ip->ip_p = IPPROTO_CARP; ip->ip_sum = 0; Index: sys/netinet/raw_ip.c =================================================================== --- sys/netinet/raw_ip.c (revision 241405) +++ sys/netinet/raw_ip.c (working copy) @@ -292,7 +292,7 @@ * not modify the packet except for some * byte order swaps. */ - ip->ip_len += off; + ip->ip_len = ntohs(ip->ip_len) + off; hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask); @@ -449,11 +449,11 @@ ip = mtod(m, struct ip *); ip->ip_tos = inp->inp_ip_tos; if (inp->inp_flags & INP_DONTFRAG) - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); else ip->ip_off = 0; ip->ip_p = inp->inp_ip_p; - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); ip->ip_src = inp->inp_laddr; if (jailed(inp->inp_cred)) { /* @@ -504,6 +504,9 @@ if (ip->ip_id == 0) ip->ip_id = ip_newid(); + ip->ip_len = htons(ip->ip_len); + ip->ip_off = htons(ip->ip_off); + /* * XXX prevent ip_output from overwriting header fields. */ Index: sys/netinet/ip_divert.c =================================================================== --- sys/netinet/ip_divert.c (revision 241405) +++ sys/netinet/ip_divert.c (working copy) @@ -386,10 +386,6 @@ INP_RUNLOCK(inp); goto cantsend; } - - /* Convert fields to host order for ip_output() */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); break; #ifdef INET6 case IPV6_VERSION >> 4: Index: sys/netinet/sctp_usrreq.c =================================================================== --- sys/netinet/sctp_usrreq.c (revision 241405) +++ sys/netinet/sctp_usrreq.c (working copy) @@ -180,7 +180,7 @@ SCTP_TCB_UNLOCK(stcb); return; } - totsz = ip->ip_len; + totsz = ntohs(ip->ip_len); nxtsz = ntohs(icmph->icmp_nextmtu); if (nxtsz == 0) { Index: sys/netinet/ip_output.c =================================================================== --- sys/netinet/ip_output.c (revision 241405) +++ sys/netinet/ip_output.c (working copy) @@ -102,7 +102,6 @@ /* * IP output. The packet in mbuf chain m contains a skeletal IP * header (with len, off, ttl, proto, tos, src, dst). - * ip_len and ip_off are in host format. * The mbuf chain containing the packet will be freed. * The mbuf opt, if present, will not be freed. * If route ro is present and has ro_rt initialized, route lookup would be @@ -175,6 +174,8 @@ hlen = len; /* ip->ip_hl is updated above */ } ip = mtod(m, struct ip *); + ip_len = ntohs(ip->ip_len); + ip_off = ntohs(ip->ip_off); /* * Fill in IP header. If we are not allowing fragmentation, @@ -442,7 +443,7 @@ * packet or packet fragments, unless ALTQ is enabled on the given * interface in which case packetdrop should be done by queueing. */ - n = ip->ip_len / mtu + 1; /* how many fragments ? */ + n = ip_len / mtu + 1; /* how many fragments ? */ if ( #ifdef ALTQ (!ALTQ_IS_ENABLED(&ifp->if_snd)) && @@ -469,7 +470,7 @@ goto bad; } /* don't allow broadcast messages to be fragmented */ - if (ip->ip_len > mtu) { + if (ip_len > mtu) { error = EMSGSIZE; goto bad; } @@ -502,12 +503,6 @@ hlen = ip->ip_hl << 2; #endif /* IPSEC */ - /* - * To network byte order. pfil(9) hooks and ip_fragment() expect this. - */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - /* Jump over all PFIL processing if hooks are not active. */ if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; @@ -544,8 +539,6 @@ } else { if (ia != NULL) ifa_free(&ia->ia_ifa); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto again; /* Redo the routing table lookup. */ } } @@ -579,16 +572,11 @@ m_tag_delete(m, fwd_tag); if (ia != NULL) ifa_free(&ia->ia_ifa); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto again; } #endif /* IPFIREWALL_FORWARD */ passout: - ip_len = ntohs(ip->ip_len); - ip_off = ntohs(ip->ip_off); - /* 127/8 must not appear on wire - RFC1122. */ if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { @@ -1295,8 +1283,6 @@ * calls the output routine of the loopback "driver", but with an interface * pointer that might NOT be a loopback interface -- evil, but easier than * replicating that code here. - * - * IP header in host byte order. */ static void ip_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in *dst, @@ -1326,8 +1312,6 @@ * than the interface's MTU. Can this possibly matter? */ ip = mtod(copym, struct ip *); - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(copym, hlen); #if 1 /* XXX */ Index: sys/netinet/in_gif.c =================================================================== --- sys/netinet/in_gif.c (revision 241405) +++ sys/netinet/in_gif.c (working copy) @@ -192,7 +192,7 @@ iphdr.ip_p = proto; /* version will be set in ip_output() */ iphdr.ip_ttl = V_ip_gif_ttl; - iphdr.ip_len = m->m_pkthdr.len + sizeof(struct ip); + iphdr.ip_len = htons(m->m_pkthdr.len + sizeof(struct ip)); ip_ecn_ingress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED : ECN_NOCARE, &iphdr.ip_tos, &tos); Index: sys/netinet/ip_options.c =================================================================== --- sys/netinet/ip_options.c (revision 241405) +++ sys/netinet/ip_options.c (working copy) @@ -494,7 +494,7 @@ unsigned optlen; optlen = opt->m_len - sizeof(p->ipopt_dst); - if (optlen + ip->ip_len > IP_MAXPACKET) { + if (optlen + ntohs(ip->ip_len) > IP_MAXPACKET) { *phlen = 0; return (m); /* XXX should fail */ } @@ -527,7 +527,7 @@ *phlen = sizeof(struct ip) + optlen; ip->ip_v = IPVERSION; ip->ip_hl = *phlen >> 2; - ip->ip_len += optlen; + ip->ip_len = htons(ntohs(ip->ip_len) + optlen); return (m); } Index: sys/netinet/tcp_timewait.c =================================================================== --- sys/netinet/tcp_timewait.c (revision 241405) +++ sys/netinet/tcp_timewait.c (working copy) @@ -593,9 +593,9 @@ m->m_pkthdr.csum_flags = CSUM_TCP; th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(sizeof(struct tcphdr) + optlen + IPPROTO_TCP)); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); if (V_path_mtu_discovery) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); error = ip_output(m, inp->inp_options, NULL, ((tw->tw_so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), NULL, inp); Index: sys/netinet/tcp_output.c =================================================================== --- sys/netinet/tcp_output.c (revision 241405) +++ sys/netinet/tcp_output.c (working copy) @@ -1239,7 +1239,7 @@ struct route ro; bzero(&ro, sizeof(ro)); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); #ifdef INET6 if (tp->t_inpcb->inp_vflag & INP_IPV6PROTO) ip->ip_ttl = in6_selecthlim(tp->t_inpcb, NULL); @@ -1253,7 +1253,7 @@ * NB: Don't set DF on small MTU/MSS to have a safe fallback. */ if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); error = ip_output(m, tp->t_inpcb->inp_options, &ro, ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0, Index: sys/netinet/sctputil.c =================================================================== --- sys/netinet/sctputil.c (revision 241405) +++ sys/netinet/sctputil.c (working copy) @@ -6821,7 +6821,7 @@ switch (iph->ip_v) { #ifdef INET case IPVERSION: - iph->ip_len -= sizeof(struct udphdr); + iph->ip_len = ntohs(htons(iph->ip_len) - sizeof(struct udphdr)); sctp_input_with_port(m, off, port); break; #endif Index: sys/netinet/ip_input.c =================================================================== --- sys/netinet/ip_input.c (revision 241405) +++ sys/netinet/ip_input.c (working copy) @@ -390,9 +390,8 @@ m->m_flags &= ~M_FASTFWD_OURS; /* Set up some basics that will be used later. */ ip = mtod(m, struct ip *); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); hlen = ip->ip_hl << 2; + ip_len = ntohs(ip->ip_len); goto ours; } @@ -513,8 +512,6 @@ #ifdef IPFIREWALL_FORWARD if (m->m_flags & M_FASTFWD_OURS) { m->m_flags &= ~M_FASTFWD_OURS; - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto ours; } if ((dchg = (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL)) != 0) { @@ -523,20 +520,12 @@ * packets originally destined to us to some other directly * connected host. */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); ip_forward(m, dchg); return; } #endif /* IPFIREWALL_FORWARD */ passin: - /* - * From now and up to output pfil(9) processing in ip_output() - * the header is in host byte order. - */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); /* * Process options and, if not destined for us, @@ -732,20 +721,21 @@ * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. */ - if (ip->ip_off & (IP_MF | IP_OFFMASK)) { + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) { m = ip_reass(m); if (m == NULL) return; ip = mtod(m, struct ip *); /* Get the header length of the reassembled packet */ hlen = ip->ip_hl << 2; + ip_len = ntohs(ip->ip_len); } /* * Further protocols expect the packet length to be w/o the * IP header. */ - ip->ip_len -= hlen; + ip->ip_len = htons(ip_len - hlen); #ifdef IPSEC /* @@ -914,22 +904,21 @@ * Adjust ip_len to not reflect header, * convert offset of this to bytes. */ - ip->ip_len -= hlen; - if (ip->ip_off & IP_MF) { + ip->ip_len = htons(ntohs(ip->ip_len) - hlen); + if (ip->ip_off & htons(IP_MF)) { /* * Make sure that fragments have a data length * that's a non-zero multiple of 8 bytes. */ - if (ip->ip_len == 0 || (ip->ip_len & 0x7) != 0) { + if (ntohs(ip->ip_len) == 0 || (ntohs(ip->ip_len & 0x7) != 0)) { IPSTAT_INC(ips_toosmall); /* XXX */ goto dropfrag; } m->m_flags |= M_FRAG; } else m->m_flags &= ~M_FRAG; - ip->ip_off <<= 3; + ip->ip_off = htons(ntohs(ip->ip_off) << 3); - /* * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. @@ -1000,7 +989,7 @@ * Find a segment which begins after this one does. */ for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) - if (GETIP(q)->ip_off > ip->ip_off) + if (ntohs(GETIP(q)->ip_off) > ntohs(ip->ip_off)) break; /* @@ -1013,14 +1002,15 @@ * segment, then it's checksum is invalidated. */ if (p) { - i = GETIP(p)->ip_off + GETIP(p)->ip_len - ip->ip_off; + i = ntohs(GETIP(p)->ip_off) + ntohs(GETIP(p)->ip_len) - + ntohs(ip->ip_off); if (i > 0) { - if (i >= ip->ip_len) + if (i >= ntohs(ip->ip_len)) goto dropfrag; m_adj(m, i); m->m_pkthdr.csum_flags = 0; - ip->ip_off += i; - ip->ip_len -= i; + ip->ip_off = htons(ntohs(ip->ip_off) + i); + ip->ip_len = htons(ntohs(ip->ip_len) - i); } m->m_nextpkt = p->m_nextpkt; p->m_nextpkt = m; @@ -1033,12 +1023,13 @@ * While we overlap succeeding segments trim them or, * if they are completely covered, dequeue them. */ - for (; q != NULL && ip->ip_off + ip->ip_len > GETIP(q)->ip_off; - q = nq) { - i = (ip->ip_off + ip->ip_len) - GETIP(q)->ip_off; - if (i < GETIP(q)->ip_len) { - GETIP(q)->ip_len -= i; - GETIP(q)->ip_off += i; + for (; q != NULL && ntohs(ip->ip_off) + ntohs(ip->ip_len) > + ntohs(GETIP(q)->ip_off); q = nq) { + i = (ntohs(ip->ip_off) + ntohs(ip->ip_len)) - + ntohs(GETIP(q)->ip_off); + if (i < ntohs(GETIP(q)->ip_len)) { + GETIP(q)->ip_len = htons(ntohs(GETIP(q)->ip_len) - i); + GETIP(q)->ip_off = htons(ntohs(GETIP(q)->ip_off) + i); m_adj(q, i); q->m_pkthdr.csum_flags = 0; break; @@ -1062,14 +1053,14 @@ */ next = 0; for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) { - if (GETIP(q)->ip_off != next) { + if (ntohs(GETIP(q)->ip_off) != next) { if (fp->ipq_nfrags > V_maxfragsperpacket) { IPSTAT_ADD(ips_fragdropped, fp->ipq_nfrags); ip_freef(head, fp); } goto done; } - next += GETIP(q)->ip_len; + next += ntohs(GETIP(q)->ip_len); } /* Make sure the last packet didn't have the IP_MF flag */ if (p->m_flags & M_FRAG) { @@ -1125,7 +1116,7 @@ * packet; dequeue and discard fragment reassembly header. * Make header visible. */ - ip->ip_len = (ip->ip_hl << 2) + next; + ip->ip_len = htons((ip->ip_hl << 2) + next); ip->ip_src = fp->ipq_src; ip->ip_dst = fp->ipq_dst; TAILQ_REMOVE(head, fp, ipq_list); @@ -1365,8 +1356,6 @@ * * The srcrt parameter indicates whether the packet is being forwarded * via a source route. - * - * IP header in host byte order. */ void ip_forward(struct mbuf *m, int srcrt) @@ -1436,7 +1425,7 @@ mcopy = NULL; } if (mcopy != NULL) { - mcopy->m_len = min(ip->ip_len, M_TRAILINGSPACE(mcopy)); + mcopy->m_len = min(ntohs(ip->ip_len), M_TRAILINGSPACE(mcopy)); mcopy->m_pkthdr.len = mcopy->m_len; m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t)); } @@ -1564,7 +1553,7 @@ if (ia != NULL) mtu = ia->ia_ifp->if_mtu; else - mtu = ip_next_mtu(ip->ip_len, 0); + mtu = ip_next_mtu(ntohs(ip->ip_len), 0); } IPSTAT_INC(ips_cantfrag); break; Index: sys/netinet/siftr.c =================================================================== --- sys/netinet/siftr.c (revision 241405) +++ sys/netinet/siftr.c (working copy) @@ -952,7 +952,8 @@ * the mbuf cluster "at" at offset "offset" bytes from * the beginning of the "at" mbuf's data pointer. */ - th->th_sum = in_cksum_skip(*m, ip->ip_len, ip_hl); + th->th_sum = in_cksum_skip(*m, ntohs(ip->ip_len), + ip_hl); } /* Index: sys/netinet/ip_icmp.c =================================================================== --- sys/netinet/ip_icmp.c (revision 241405) +++ sys/netinet/ip_icmp.c (working copy) @@ -200,7 +200,7 @@ */ if (n->m_flags & M_DECRYPTED) goto freeit; - if (oip->ip_off & ~(IP_MF|IP_DF)) + if (oip->ip_off & htons(~(IP_MF|IP_DF))) goto freeit; if (n->m_flags & (M_BCAST|M_MCAST)) goto freeit; @@ -234,16 +234,17 @@ tcphlen = th->th_off << 2; if (tcphlen < sizeof(struct tcphdr)) goto freeit; - if (oip->ip_len < oiphlen + tcphlen) + if (ntohs(oip->ip_len) < oiphlen + tcphlen) goto freeit; if (oiphlen + tcphlen > n->m_len && n->m_next == NULL) goto stdreply; if (n->m_len < oiphlen + tcphlen && ((n = m_pullup(n, oiphlen + tcphlen)) == NULL)) goto freeit; - icmpelen = max(tcphlen, min(V_icmp_quotelen, oip->ip_len - oiphlen)); + icmpelen = max(tcphlen, min(V_icmp_quotelen, + ntohs(oip->ip_len) - oiphlen)); } else -stdreply: icmpelen = max(8, min(V_icmp_quotelen, oip->ip_len - oiphlen)); +stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); icmplen = min(oiphlen + icmpelen, nlen); if (icmplen < sizeof(struct ip)) @@ -293,8 +294,6 @@ */ m_copydata(n, 0, icmplen, (caddr_t)&icp->icmp_ip); nip = &icp->icmp_ip; - nip->ip_len = htons(nip->ip_len); - nip->ip_off = htons(nip->ip_off); /* * Set up ICMP message mbuf and copy old IP header (without options @@ -309,7 +308,7 @@ m->m_pkthdr.rcvif = n->m_pkthdr.rcvif; nip = mtod(m, struct ip *); bcopy((caddr_t)oip, (caddr_t)nip, sizeof(struct ip)); - nip->ip_len = m->m_len; + nip->ip_len = htons(m->m_len); nip->ip_v = IPVERSION; nip->ip_hl = 5; nip->ip_p = IPPROTO_ICMP; @@ -331,7 +330,7 @@ struct ip *ip = mtod(m, struct ip *); struct sockaddr_in icmpsrc, icmpdst, icmpgw; int hlen = off; - int icmplen = ip->ip_len; + int icmplen = ntohs(ip->ip_len); int i, code; void (*ctlfunc)(int, struct sockaddr *, void *); int fibnum; @@ -472,7 +471,6 @@ ICMPSTAT_INC(icps_badlen); goto freeit; } - icp->icmp_ip.ip_len = ntohs(icp->icmp_ip.ip_len); /* Discard ICMP's in response to multicast packets */ if (IN_MULTICAST(ntohl(icp->icmp_ip.ip_dst.s_addr))) goto badcode; @@ -565,7 +563,8 @@ } ifa_free(&ia->ia_ifa); reflect: - ip->ip_len += hlen; /* since ip_input deducts this */ + /* Since ip_input() deducts this. */ + ip->ip_len = htons(ntohs(ip->ip_len) + hlen); ICMPSTAT_INC(icps_reflect); ICMPSTAT_INC(icps_outhist[icp->icmp_type]); icmp_reflect(m); @@ -835,7 +834,7 @@ * Now strip out original options by copying rest of first * mbuf's data back, and adjust the IP length. */ - ip->ip_len -= optlen; + ip->ip_len = htons(ntohs(ip->ip_len) - optlen); ip->ip_v = IPVERSION; ip->ip_hl = 5; m->m_len -= optlen; @@ -869,7 +868,7 @@ m->m_len -= hlen; icp = mtod(m, struct icmp *); icp->icmp_cksum = 0; - icp->icmp_cksum = in_cksum(m, ip->ip_len - hlen); + icp->icmp_cksum = in_cksum(m, ntohs(ip->ip_len) - hlen); m->m_data -= hlen; m->m_len += hlen; m->m_pkthdr.rcvif = (struct ifnet *)0; Index: sys/netinet/ip_gre.c =================================================================== --- sys/netinet/ip_gre.c (revision 241405) +++ sys/netinet/ip_gre.c (working copy) @@ -274,12 +274,10 @@ /* * On FreeBSD, rip_input() supplies us with ip->ip_len - * already converted into host byteorder and also decreases - * it by the lengh of IP header, however, ip_input() expects - * that this field is in the original format (network byteorder - * and full size of IP packet), so that adjust accordingly. + * decreased by the lengh of IP header, however, ip_input() + * expects it to be full size of IP packet, so adjust accordingly. */ - ip->ip_len = htons(ip->ip_len + sizeof(struct ip) - msiz); + ip->ip_len = htons(ntohs(ip->ip_len) + sizeof(struct ip) - msiz); ip->ip_sum = 0; ip->ip_sum = in_cksum(m, (ip->ip_hl << 2)); Index: sys/netinet/ip_ipsec.c =================================================================== --- sys/netinet/ip_ipsec.c (revision 241405) +++ sys/netinet/ip_ipsec.c (working copy) @@ -264,7 +264,6 @@ { #ifdef IPSEC struct secpolicy *sp = NULL; - struct ip *ip = mtod(*m, struct ip *); struct tdb_ident *tdbi; struct m_tag *mtag; int s; @@ -332,9 +331,6 @@ } } - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - /* * Do delayed checksums now because we send before * this is done in the normal processing path. @@ -345,6 +341,8 @@ } #ifdef SCTP if ((*m)->m_pkthdr.csum_flags & CSUM_SCTP) { + struct ip *ip = mtod(*m, struct ip *); + sctp_delayed_cksum(*m, (uint32_t)(ip->ip_hl << 2)); (*m)->m_pkthdr.csum_flags &= ~CSUM_SCTP; } @@ -359,8 +357,6 @@ * IPsec processing and return without error. */ *error = 0; - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto done; } /* Index: sys/netinet/ip_mroute.c =================================================================== --- sys/netinet/ip_mroute.c (revision 241405) +++ sys/netinet/ip_mroute.c (working copy) @@ -1493,7 +1493,7 @@ { struct ip *ip = mtod(m, struct ip *); vifi_t vifi; - int plen = ip->ip_len; + int plen = ntohs(ip->ip_len); VIF_LOCK_ASSERT(); @@ -2376,10 +2376,7 @@ /* Take care of delayed checksums */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - /* XXX: in_delayed_cksum() expects net byte order */ - ip->ip_len = htons(ip->ip_len); in_delayed_cksum(m); - ip->ip_len = ntohs(ip->ip_len); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } @@ -2401,10 +2398,8 @@ /* Compute the MTU after the PIM Register encapsulation */ mtu = 0xffff - sizeof(pim_encap_iphdr) - sizeof(pim_encap_pimhdr); - if (ip->ip_len <= mtu) { + if (ntohs(ip->ip_len) <= mtu) { /* Turn the IP header into a valid one */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(mb_copy, ip->ip_hl << 2); } else { @@ -2509,7 +2504,8 @@ ip_outer = mtod(mb_first, struct ip *); *ip_outer = pim_encap_iphdr; ip_outer->ip_id = ip_newid(); - ip_outer->ip_len = len + sizeof(pim_encap_iphdr) + sizeof(pim_encap_pimhdr); + ip_outer->ip_len = htons(len + sizeof(pim_encap_iphdr) + + sizeof(pim_encap_pimhdr)); ip_outer->ip_src = V_viftable[vifi].v_lcl_addr; ip_outer->ip_dst = rt->mfc_rp; /* @@ -2517,8 +2513,8 @@ * IP_DF bit. */ ip_outer->ip_tos = ip->ip_tos; - if (ntohs(ip->ip_off) & IP_DF) - ip_outer->ip_off |= IP_DF; + if (ip->ip_off & htons(IP_DF)) + ip_outer->ip_off |= htons(IP_DF); pimhdr = (struct pim_encap_pimhdr *)((caddr_t)ip_outer + sizeof(pim_encap_iphdr)); *pimhdr = pim_encap_pimhdr; @@ -2571,7 +2567,7 @@ struct ip *ip = mtod(m, struct ip *); struct pim *pim; int minlen; - int datalen = ip->ip_len; + int datalen = ntohs(ip->ip_len); int ip_tos; int iphlen = off; Index: sys/netinet/sctp_output.c =================================================================== --- sys/netinet/sctp_output.c (revision 241405) +++ sys/netinet/sctp_output.c (working copy) @@ -3980,7 +3980,7 @@ tos_value |= sctp_get_ect(stcb); } if ((nofragment_flag) && (port == 0)) { - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); } else ip->ip_off = 0; @@ -3988,7 +3988,7 @@ ip->ip_id = ip_newid(); ip->ip_ttl = inp->ip_inp.inp.inp_ip_ttl; - ip->ip_len = packet_length; + ip->ip_len = htons(packet_length); ip->ip_tos = tos_value; if (port) { ip->ip_p = IPPROTO_UDP; @@ -10991,7 +10991,7 @@ udp->uh_sum = 0; } } - ip->ip_len = len; + ip->ip_len = htons(len); if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); Index: sys/netinet/igmp.c =================================================================== --- sys/netinet/igmp.c (revision 241405) +++ sys/netinet/igmp.c (working copy) @@ -1442,7 +1442,7 @@ ip = mtod(m, struct ip *); iphlen = off; - igmplen = ip->ip_len; + igmplen = ntohs(ip->ip_len); /* * Validate lengths. @@ -2225,7 +2225,7 @@ ip = mtod(m, struct ip *); ip->ip_tos = 0; - ip->ip_len = sizeof(struct ip) + sizeof(struct igmp); + ip->ip_len = htons(sizeof(struct ip) + sizeof(struct igmp)); ip->ip_off = 0; ip->ip_p = IPPROTO_IGMP; ip->ip_src.s_addr = INADDR_ANY; @@ -3522,8 +3522,8 @@ ip = mtod(m, struct ip *); ip->ip_tos = IPTOS_PREC_INTERNETCONTROL; - ip->ip_len = hdrlen + igmpreclen; - ip->ip_off = IP_DF; + ip->ip_len = htons(hdrlen + igmpreclen); + ip->ip_off = htons(IP_DF); ip->ip_p = IPPROTO_IGMP; ip->ip_sum = 0; Index: sys/netinet6/ip6_ipsec.c =================================================================== --- sys/netinet6/ip6_ipsec.c (revision 241405) +++ sys/netinet6/ip6_ipsec.c (working copy) @@ -295,15 +295,9 @@ */ #ifdef INET if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - struct ip *ip; - ipseclog((LOG_DEBUG, "%s: we do not support IPv4 over IPv6", __func__)); - /* XXX: in_delayed_cksum() expects net byte order */ - ip = mtod(*m, struct ip *); - ip->ip_len = htons(ip->ip_len); in_delayed_cksum(*m); - ip->ip_len = ntohs(ip->ip_len); (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } #endif Index: sys/netpfil/pf/pf.c =================================================================== --- sys/netpfil/pf/pf.c (revision 241405) +++ sys/netpfil/pf/pf.c (working copy) @@ -2252,8 +2252,8 @@ h->ip_v = 4; h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; - h->ip_off = V_path_mtu_discovery ? IP_DF : 0; - h->ip_len = len; + h->ip_off = V_path_mtu_discovery ? htons(IP_DF) : 0; + h->ip_len = htons(len); h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; @@ -2316,17 +2316,8 @@ switch (af) { #ifdef INET case AF_INET: - { - struct ip *ip; - - /* icmp_error() expects host byte ordering */ - ip = mtod(m0, struct ip *); - NTOHS(ip->ip_len); - NTOHS(ip->ip_off); - pfse->pfse_type = PFSE_ICMP; break; - } #endif /* INET */ #ifdef INET6 case AF_INET6: Index: sys/netpfil/pf/if_pfsync.c =================================================================== --- sys/netpfil/pf/if_pfsync.c (revision 241405) +++ sys/netpfil/pf/if_pfsync.c (working copy) @@ -1384,7 +1384,7 @@ ip->ip_hl = sizeof(sc->sc_template) >> 2; ip->ip_tos = IPTOS_LOWDELAY; /* len and id are set later. */ - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); ip->ip_ttl = PFSYNC_DFLTTL; ip->ip_p = IPPROTO_PFSYNC; ip->ip_src.s_addr = INADDR_ANY; @@ -1522,7 +1522,7 @@ bcopy(&sc->sc_template, ip, sizeof(*ip)); offset = sizeof(*ip); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); ip->ip_id = htons(ip_randomid()); /* build the pfsync header */ Index: sys/netpfil/ipfw/ip_fw_dynamic.c =================================================================== --- sys/netpfil/ipfw/ip_fw_dynamic.c (revision 241405) +++ sys/netpfil/ipfw/ip_fw_dynamic.c (working copy) @@ -1017,8 +1017,7 @@ h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; h->ip_off = 0; - /* ip_len must be in host format for ip_output */ - h->ip_len = len; + h->ip_len = htons(len); h->ip_ttl = V_ip_defttl; h->ip_sum = 0; break; Index: sys/netpfil/ipfw/ip_fw_pfil.c =================================================================== --- sys/netpfil/ipfw/ip_fw_pfil.c (revision 241405) +++ sys/netpfil/ipfw/ip_fw_pfil.c (working copy) @@ -431,7 +431,6 @@ int hlen; struct mbuf *reass; - SET_HOST_IPLEN(ip); /* ip_reass wants host order */ reass = ip_reass(clone); /* Reassemble packet. */ if (reass == NULL) return 0; /* not an error */ @@ -442,7 +441,6 @@ */ ip = mtod(reass, struct ip *); hlen = ip->ip_hl << 2; - SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Index: sys/netpfil/ipfw/ip_dn_io.c =================================================================== --- sys/netpfil/ipfw/ip_dn_io.c (revision 241405) +++ sys/netpfil/ipfw/ip_dn_io.c (working copy) @@ -658,13 +658,10 @@ switch (dst) { case DIR_OUT: - SET_HOST_IPLEN(mtod(m, struct ip *)); ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL); break ; case DIR_IN : - /* put header in network format for ip_input() */ - //SET_NET_IPLEN(mtod(m, struct ip *)); netisr_dispatch(NETISR_IP, m); break; Index: sys/netpfil/ipfw/ip_fw2.c =================================================================== --- sys/netpfil/ipfw/ip_fw2.c (revision 241405) +++ sys/netpfil/ipfw/ip_fw2.c (working copy) @@ -627,8 +627,6 @@ m_adj(m, args->L3offset); #endif if (code != ICMP_REJECT_RST) { /* Send an ICMP unreach */ - /* We need the IP header in host order for icmp_error(). */ - SET_HOST_IPLEN(ip); icmp_error(args->m, ICMP_UNREACH, code, 0L, 0); } else if (args->f_id.proto == IPPROTO_TCP) { struct tcphdr *const tcp = @@ -2418,11 +2416,6 @@ /* if not fragmented, go to next rule */ if ((ip_off & (IP_MF | IP_OFFMASK)) == 0) break; - /* - * ip_reass() expects len & off in host - * byte order. - */ - SET_HOST_IPLEN(ip); args->m = m = ip_reass(m); @@ -2436,7 +2429,6 @@ ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; - SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Index: sys/netipsec/ipsec.c =================================================================== --- sys/netipsec/ipsec.c (revision 241405) +++ sys/netipsec/ipsec.c (working copy) @@ -597,10 +597,9 @@ IPSEC_ASSERT(m != NULL, ("null mbuf")); IPSEC_ASSERT(m->m_pkthdr.len >= sizeof(struct ip),("packet too short")); - /* NB: ip_input() flips it into host endian. XXX Need more checking. */ if (m->m_len >= sizeof (struct ip)) { struct ip *ip = mtod(m, struct ip *); - if (ip->ip_off & (IP_MF | IP_OFFMASK)) + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) goto done; #ifdef _IP_VHL off = _IP_VHL_HL(ip->ip_vhl) << 2; @@ -612,7 +611,7 @@ struct ip ih; m_copydata(m, 0, sizeof (struct ip), (caddr_t) &ih); - if (ih.ip_off & (IP_MF | IP_OFFMASK)) + if (ih.ip_off & htons(IP_MF | IP_OFFMASK)) goto done; #ifdef _IP_VHL off = _IP_VHL_HL(ih.ip_vhl) << 2; Index: sys/netgraph/ng_ipfw.c =================================================================== --- sys/netgraph/ng_ipfw.c (revision 241405) +++ sys/netgraph/ng_ipfw.c (working copy) @@ -265,7 +265,6 @@ switch (ip->ip_v) { #ifdef INET case IPVERSION: - SET_HOST_IPLEN(ip); return (ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL)); #endif Index: sys/net/if_stf.c =================================================================== --- sys/net/if_stf.c (revision 241405) +++ sys/net/if_stf.c (working copy) @@ -523,7 +523,7 @@ bcopy(&in4, &ip->ip_dst, sizeof(ip->ip_dst)); ip->ip_p = IPPROTO_IPV6; ip->ip_ttl = ip_stf_ttl; - ip->ip_len = m->m_pkthdr.len; /*host order*/ + ip->ip_len = htons(m->m_pkthdr.len); if (ifp->if_flags & IFF_LINK1) ip_ecn_ingress(ECN_ALLOWED, &ip->ip_tos, &tos); else Index: sys/net/if_gre.c =================================================================== --- sys/net/if_gre.c (revision 241405) +++ sys/net/if_gre.c (working copy) @@ -356,7 +356,7 @@ * RFC2004 specifies that fragmented diagrams shouldn't * be encapsulated. */ - if (ip->ip_off & (IP_MF | IP_OFFMASK)) { + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) { _IF_DROP(&ifp->if_snd); m_freem(m); error = EINVAL; /* is there better errno? */ @@ -410,7 +410,7 @@ } ip = mtod(m, struct ip *); memcpy((caddr_t)(ip + 1), &mob_h, (unsigned)msiz); - ip->ip_len = ntohs(ip->ip_len) + msiz; + ip->ip_len = htons(ntohs(ip->ip_len) + msiz); } else { /* AF_INET */ _IF_DROP(&ifp->if_snd); m_freem(m); @@ -493,7 +493,7 @@ ((struct ip*)gh)->ip_ttl = GRE_TTL; ((struct ip*)gh)->ip_tos = gre_ip_tos; ((struct ip*)gh)->ip_id = gre_ip_id; - gh->gi_len = m->m_pkthdr.len; + gh->gi_len = htons(m->m_pkthdr.len); } ifp->if_opackets++; --K/NRh952CO+2tg14-- From owner-freebsd-net@FreeBSD.ORG Wed Oct 10 23:45:52 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 B01175AF; Wed, 10 Oct 2012 23:45:52 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 69B448FC1A; Wed, 10 Oct 2012 23:45:52 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 708207300A; Thu, 11 Oct 2012 02:06:11 +0200 (CEST) Date: Thu, 11 Oct 2012 02:06:11 +0200 From: Luigi Rizzo To: Gleb Smirnoff Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121011000611.GA22083@onelab2.iet.unipi.it> References: <20121009154128.GU34622@FreeBSD.org> <20121010195842.GH34622@FreeBSD.org> <20121010222651.GR40452@mdounin.ru> <20121010233404.GI34622@glebius.int.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121010233404.GI34622@glebius.int.ru> User-Agent: Mutt/1.4.2.3i 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:45:52 -0000 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 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. From owner-freebsd-net@FreeBSD.ORG Thu Oct 11 01:23:56 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E1102225 for ; Thu, 11 Oct 2012 01:23:56 +0000 (UTC) (envelope-from darcsis@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id A844A8FC0C for ; Thu, 11 Oct 2012 01:23:56 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so1322835pad.13 for ; Wed, 10 Oct 2012 18:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:x-envelope-to :mail-followup-to:date:message-id:mime-version:content-type; bh=Pi2w09mCM16cHLBoNedjQE8uc+Ca7SlFSQV6rnspfyQ=; b=E23wvadANjeh4qBG6MkzxTrk7o6JI6o+F4jKgGY/Uy/pxe3kg3+hubluoHn9GeHM9T G66MIu1oapzsyTBZFKgllZE9CPO14GrX3GSGwnLOGpPLAi4BVXm5R0hqtbNj4fsspbEs bPffk+InZMizeX2jUR3XAWVARC3MSHClo8zZqFLXR9Z4glDfuX4bbGNCV75wloyMMTMq 44GHOs++hkWS7Z0RB2V0UkT8KC3VzCthL2/750KxGvRb2ZI1cyoMbKNmSkl9PAXlhmN6 PxDW42pVrQl8CyHUf8aLGWxpbTsq/zz45RGJNiJJr1ugaG6glBRN7n2RWvroU0HNeZbL 3mjA== Received: by 10.68.218.101 with SMTP id pf5mr78909857pbc.60.1349918636105; Wed, 10 Oct 2012 18:23:56 -0700 (PDT) Received: from localhost ([125.34.64.49]) by mx.google.com with ESMTPS id kr4sm1828569pbc.76.2012.10.10.18.23.50 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 10 Oct 2012 18:23:54 -0700 (PDT) From: darcsis@gmail.com (Denise H. G.) To: Bernhard Schmidt Subject: Re: What driver should I use for 'intel centrino wireless-N 2200 BGN'? In-Reply-To: <201210101954.49000.bschmidt@techwires.net> (Bernhard Schmidt's message of "Wed, 10 Oct 2012 19:54:48 +0200") References: <86ehl96o4i.fsf@venux.xbsd.name> <86txu277vn.fsf@venux.xbsd.name> <201210101954.49000.bschmidt@techwires.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (berkeley-unix) X-Envelope-To: bschmidt@techwires.net Mail-Followup-To: Bernhard Schmidt , freebsd-net@freebsd.org, Kevin Oberman , Andreas Nilsson Date: Thu, 11 Oct 2012 09:23:45 +0800 Message-ID: <86sj9l3iou.fsf@venux.xbsd.name> MIME-Version: 1.0 Content-Type: text/plain Cc: freebsd-net@freebsd.org, Andreas Nilsson , Kevin Oberman 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: Thu, 11 Oct 2012 01:23:56 -0000 On 2012/10/11 at 01:54, Bernhard Schmidt wrote: > > On Wednesday 10 October 2012 15:51:24 Denise H. G. wrote: >> >>>>> none3@pci0:3:0:0: class=0x028000 card=0x42228086 chip=0x08918086 >> >>>>> rev=0xc4 hdr=0x00 >> >>>>> >> >>>>> Is there a driver for that under FreeBSD 9.1-PRERELEASE? > > No, not yet. I'm having a hard figuring out the new firmware API for > those new devices. Working on it.. > >> >> I tried to add some device ids into the source code of the drivers, but >> >> with no luck. Maybe I am doing it the wrong way. >> > >> > The card ID in the code is 4220 and yours has is 4222. Edit >> > /sys/dev/iwi/if_iwi.c and add: >> > { 0x8086, 0x4222, "Intel(R) PRO/Wireless 2200BG" }, >> > after line 123. > > Note the tiny difference in here ;) > > Intel(R) PRO/Wireless 2200BG > vs. > Intel Centrino Wireless-N 2200 BGN > > There are like 10 years in between. :) > > Just to clarify, the 0x4222 is for iwn(4), adding the IDs there is the > first step, followed by a new firmware module and some glue code. > > I already thought about adding just the firmware but not the IDs yet, > for others to tinker with. Issue is that this would generate > regressions with already working cards, eg. 6230. So, eventually.. > just not yet. > Thanks for clarifying! hope it would not be too long before it works! > -- > Bernhard > From owner-freebsd-net@FreeBSD.ORG Thu Oct 11 02:07:14 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 C63D2A2A; Thu, 11 Oct 2012 02:07:14 +0000 (UTC) (envelope-from mdounin@mdounin.ru) Received: from mdounin.cust.ramtel.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mx1.freebsd.org (Postfix) with ESMTP id 78AC88FC1B; Thu, 11 Oct 2012 02:07:14 +0000 (UTC) Received: from mdounin.ru (mdounin.cust.ramtel.ru [81.19.69.81]) by mdounin.cust.ramtel.ru (Postfix) with ESMTP id E0C0C1702D; Thu, 11 Oct 2012 06:07:12 +0400 (MSK) Date: Thu, 11 Oct 2012 06:07:12 +0400 From: Maxim Dounin To: Gleb Smirnoff Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121011020712.GU40452@mdounin.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121010195842.GH34622@FreeBSD.org> <20121010222651.GR40452@mdounin.ru> <20121010233404.GI34622@glebius.int.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121010233404.GI34622@glebius.int.ru> 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: Thu, 11 Oct 2012 02:07:14 -0000 Hello! On Thu, Oct 11, 2012 at 03:34:04AM +0400, Gleb Smirnoff wrote: [...] > 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. As I already pointed out (in an off-list message), many consider this as a "known bug" in many OSes instead. E.g. here is a quote from /usr/ports/net/openospfd/files/patch-ospfd_packet.c patch: @@ -70,7 +70,12 @@ ip_hdr.ip_v = IPVERSION; ip_hdr.ip_hl = sizeof(ip_hdr) >> 2; ip_hdr.ip_tos = IPTOS_PREC_INTERNETCONTROL; +#if defined(__FreeBSD__) || defined(__NetBSD__) + /* FreeBSD/NetBSD wants the length in the native host byte order. */ + ip_hdr.ip_len = len + sizeof(ip_hdr); +#else ip_hdr.ip_len = htons(len + sizeof(ip_hdr)); +#endif I would suggests it at least deserves a comment, and probably API change/fix too. [...] > --- sys/netinet/raw_ip.c (revision 241405) > +++ sys/netinet/raw_ip.c (working copy) > @@ -292,7 +292,7 @@ > * not modify the packet except for some > * byte order swaps. > */ > - ip->ip_len += off; > + ip->ip_len = ntohs(ip->ip_len) + off; So, you've moved a switch to host byteorder into rip_input(). What about ip->ip_off then? Note that this may also need some adjustments for protocols which use rip_output() but not rip_input() (or vice versa). [...] -- Maxim Dounin From owner-freebsd-net@FreeBSD.ORG Thu Oct 11 07:28:10 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4E0E5986 for ; Thu, 11 Oct 2012 07:28:10 +0000 (UTC) (envelope-from rnderr@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id C1B928FC14 for ; Thu, 11 Oct 2012 07:28:09 +0000 (UTC) Received: by mail-ee0-f54.google.com with SMTP id c50so935604eek.13 for ; Thu, 11 Oct 2012 00:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=+z/j3vyhhR5QJQFcz0RXFs9mm9yGiiRQEhMk6yGPplA=; b=M+ui8wR4DmTGhZgx2KAzW+zJkKUZQF4c3yhGf6H2w2ESS0Y6kKRC8kOJzP1lBwjf2g /d8g4vulsJUfTm9fVBojq+T71VlQ1O2CWwCScaslZ9JBn06atobUNQ0V25ippmaAot4B 16+13yp7Ugkk25DomsRhECcrWBegaXD0BYKus0vulU/gs7biDSejmp88Y8aiUsfMohfi LvQFx0wDE5UUFC0ijEHtKbU9Jr+n60K41dDMRuLsqqC/Zs/Ttdt1bbbooY80FWq73k4l 7P1gHO9mhlfFVp8v4Bdom1z9nQmE5rWxky8uYbFG6aspwTVYHtyN2cEv4S6x4s0GRFPN 2nzw== MIME-Version: 1.0 Received: by 10.14.207.5 with SMTP id m5mr37220331eeo.22.1349940488656; Thu, 11 Oct 2012 00:28:08 -0700 (PDT) Received: by 10.14.202.132 with HTTP; Thu, 11 Oct 2012 00:28:08 -0700 (PDT) Date: Thu, 11 Oct 2012 13:28:08 +0600 Message-ID: Subject: bridging VLANs on one interface From: Alexander Rnderr To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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: Thu, 11 Oct 2012 07:28:10 -0000 Hello. I want bridging VLANs on igb1. When i add vlan667 to bridge0 network down. "tcpdump -pni vlan200"/"tcpdump -pni vlan667" show only STP. What's wrong? _________ ___FreeBSD___ | | |200--- | | Switch | trunk(vlan 200 & 667) ---> | | PF,ipfw | | | |667---________| | | |________| access(vlan 667) --->Linux rc.conf: #vlan ifconfig_igb1="up" vlans_igb1="vlan200 vlan667" create_args_vlan200="vlan 200" create_args_vlan667="vlan 667" ifconfig_vlan200="inet x.x.41.98/24 up" ifconfig_vlan667="ether 00:25:90:60:50:52 up" #bridge cloned_interfaces="bridge0" ifconfig_bridge0="addm vlan200" defaultrouter="x.x.41.1" # ifconfig igb1: flags=8943 metric 0 mtu 1500 options=401bb ether 00:25:90:60:50:51 inet6 fe80::225:90ff:fe60:5051%igb1 prefixlen 64 scopeid 0x2 nd6 options=29 media: Ethernet autoselect (1000baseT ) status: active lo0: flags=8049 metric 0 mtu 16384 options=3 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5 inet 127.0.0.1 netmask 0xff000000 nd6 options=21 bridge0: flags=8843 metric 0 mtu 1500 ether 02:55:56:ec:90:00 nd6 options=29 id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200 root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0 member: vlan200 flags=153 ifmaxaddr 0 port 7 priority 128 path cost 55 vlan200: flags=8943 metric 0 mtu 1500 options=103 ether 00:25:90:60:50:51 inet6 fe80::225:90ff:fe60:5051%vlan200 prefixlen 64 scopeid 0x7 inet x.x.41.98 netmask 0xffffff00 broadcast x.x.41.255 nd6 options=29 media: Ethernet autoselect (1000baseT ) status: active vlan: 200 parent interface: igb1 vlan667: flags=8843 metric 0 mtu 1500 options=103 ether 00:25:90:60:50:52 inet6 fe80::225:90ff:fe60:5051%vlan667 prefixlen 64 scopeid 0x8 nd6 options=29 media: Ethernet autoselect (1000baseT ) status: active vlan: 667 parent interface: igb1 From owner-freebsd-net@FreeBSD.ORG Thu Oct 11 07:42:15 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 7F9CDCED for ; Thu, 11 Oct 2012 07:42:15 +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 EDD178FC14 for ; Thu, 11 Oct 2012 07:42:14 +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 q9B7gDTv091378; Thu, 11 Oct 2012 11:42:13 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9B7gDdD091377; Thu, 11 Oct 2012 11:42:13 +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 11:42:13 +0400 From: Gleb Smirnoff To: Maxim Dounin Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121011074213.GA89655@glebius.int.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121010195842.GH34622@FreeBSD.org> <20121010222651.GR40452@mdounin.ru> <20121010233404.GI34622@glebius.int.ru> <20121011020712.GU40452@mdounin.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20121011020712.GU40452@mdounin.ru> 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: Thu, 11 Oct 2012 07:42:15 -0000 On Thu, Oct 11, 2012 at 06:07:12AM +0400, Maxim Dounin wrote: M> > This is de facto standard for raw sockets in most OS-es. Byte order M> > in raw socket is host. And this is the same behavior we had before M> > the patch. So no reason for extra comments. M> M> As I already pointed out (in an off-list message), many consider M> this as a "known bug" in many OSes instead. M> M> E.g. here is a quote from /usr/ports/net/openospfd/files/patch-ospfd_packet.c M> patch: M> M> @@ -70,7 +70,12 @@ M> ip_hdr.ip_v = IPVERSION; M> ip_hdr.ip_hl = sizeof(ip_hdr) >> 2; M> ip_hdr.ip_tos = IPTOS_PREC_INTERNETCONTROL; M> +#if defined(__FreeBSD__) || defined(__NetBSD__) M> + /* FreeBSD/NetBSD wants the length in the native host byte order. */ M> + ip_hdr.ip_len = len + sizeof(ip_hdr); M> +#else M> ip_hdr.ip_len = htons(len + sizeof(ip_hdr)); M> +#endif M> M> I would suggests it at least deserves a comment, and probably API M> change/fix too. I'm okay with comment, but not changes here. At least no ABI cnahge in context of discussed change of byte ordering inside stack. Right now situation is the following: OS order hlen strip on input FreeBSD 9.x host + FreeBSD 10 host - Linux host - NetBSD host + OpenBSD ???[*] - Dragonfly net + [*] According to quagga sources order in OpenBSD is host, but according to you quote of openospfd it is net. According to raw_ip.c itself it is net. Probably OpenBSD switched to net and since quagga isn't supported on it. So, preserving host order keeps us in sync with older FreeBSD, NetBSD and Linux. -- Totus tuus, Glebius. From owner-freebsd-net@FreeBSD.ORG Thu Oct 11 15:39:40 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C29DAE12 for ; Thu, 11 Oct 2012 15:39:40 +0000 (UTC) (envelope-from remi.pauchet@netasq.com) Received: from work.netasq.com (gwlille.netasq.com [91.212.116.1]) by mx1.freebsd.org (Postfix) with ESMTP id A4D748FC0A for ; Thu, 11 Oct 2012 15:39:39 +0000 (UTC) Received: from [10.2.9.2] (unknown [91.212.116.2]) by work.netasq.com (Postfix) with ESMTPSA id F34D327047B3 for ; Thu, 11 Oct 2012 17:39:34 +0200 (CEST) From: =?iso-8859-1?Q?R=E9mi_Pauchet?= Content-Type: multipart/signed; boundary="Apple-Mail=_CF9F00B2-8EDD-4172-84AA-677963DE3D35"; protocol="application/pkcs7-signature"; micalg=sha1 Subject: ixgbe and ixgbevf drivers are not working in virtualization environment Date: Thu, 11 Oct 2012 17:39:33 +0200 Message-Id: <792D5931-19E7-4239-A3E8-5D2BC90F03FD@netasq.com> To: freebsd-net@freebsd.org Mime-Version: 1.0 (Apple Message framework v1283) X-Mailer: Apple Mail (2.1283) X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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: Thu, 11 Oct 2012 15:39:40 -0000 --Apple-Mail=_CF9F00B2-8EDD-4172-84AA-677963DE3D35 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Hi, I'm trying to use the ixgbe (10Gb) driver in a FreeBSD virtual machine = on an esxi 5 using DirectPath (PCI Passthrough) and the card is = detected, but I can't get a link (status: no carrier) ix0: = mem 0xd2420000-0xd243ffff,0xd2400000-0xd2403fff irq 18 at device 0.0 on = pci3 ix0: flags=3D8802 metric 0 mtu 1500 = options=3D401bb ether 00:e0:ed:1c:99:4e nd6 options=3D29 media: Ethernet autoselect status: no carrier I have also tested with XenServer 6, using SR-IOV (ixgbevf driver) with = the same result: the driver is loading, but no link detected. In both case (VMWare DirectPath and XenServer SR-IOV), I tested Linux = with success. The card is an Intel 82599EB, the motherboard is an Intel X58 = (supermicro X8ST3) with a Xeon W3680 and I've tested FreeBSD 8.3 and 9.0 I've found a forum thread with the same issue: = http://forums.freebsd.org/showthread.php?t=3D29855 and no answer :) Please find in attachment the dmesg (boot -v) with the ix driver = compiled with DEBUG flags using vmware. Can anyone provide feedback about this issue ? Regards, R=E9mi Pauchet --Apple-Mail=_CF9F00B2-8EDD-4172-84AA-677963DE3D35-- From owner-freebsd-net@FreeBSD.ORG Thu Oct 11 16:25:19 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 10395A84 for ; Thu, 11 Oct 2012 16:25:19 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id AD6988FC12 for ; Thu, 11 Oct 2012 16:25:18 +0000 (UTC) Received: by mail-vc0-f182.google.com with SMTP id fw7so3086379vcb.13 for ; Thu, 11 Oct 2012 09:25:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=pAgF+yyoUI5w12kxXwN1jWD0K5NbgQTxkFsa7xaDIjY=; b=W2W8OFuGAszqzLJi80Wid1PctwDAB0nURertp6sqbYfjY+z70OwTWUY5TvuyTA8kO/ mKS8eWHQEpHHQ3npwwTFIq2euuGFOmm6xVL0oQled6P5gLnEzKejgzY0rUtI0lgLscrB IfJWWqLX8F6Dx8Xrcd5EjAnKEYDUGVvLsAk6vycKs0BCY4HpmsHnemLaV0BySLT/E7C8 oaC9S3bDqtT00iIxSsbGDYTQNv14cR9373NFq95yztMiggQ95yRSwFOR9b4JD7ysHYZF EZqTLNkLXvodDgWv+3OaGdRmH10sWPPVSJSMJsbwgk3NZ1K9KE8jiGYpzXWrbUhs/M87 BrFA== MIME-Version: 1.0 Received: by 10.58.0.7 with SMTP id 7mr822748vea.18.1349972717776; Thu, 11 Oct 2012 09:25:17 -0700 (PDT) Received: by 10.58.68.8 with HTTP; Thu, 11 Oct 2012 09:25:17 -0700 (PDT) In-Reply-To: <792D5931-19E7-4239-A3E8-5D2BC90F03FD@netasq.com> References: <792D5931-19E7-4239-A3E8-5D2BC90F03FD@netasq.com> Date: Thu, 11 Oct 2012 09:25:17 -0700 Message-ID: Subject: Re: ixgbe and ixgbevf drivers are not working in virtualization environment From: Jack Vogel To: =?ISO-8859-1?Q?R=E9mi_Pauchet?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-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: Thu, 11 Oct 2012 16:25:19 -0000 The ixgbe device will not get link until you have run init, so assign it an address or just do an ifconfig up. I have never used the driver using a passthru type setup but I believe its been done successfully if memory serves. Jack On Thu, Oct 11, 2012 at 8:39 AM, R=E9mi Pauchet wr= ote: > Hi, > > I'm trying to use the ixgbe (10Gb) driver in a FreeBSD virtual machine on > an esxi 5 using DirectPath (PCI Passthrough) and the card is detected, bu= t > I can't get a link (status: no carrier) > > ix0: me= m > 0xd2420000-0xd243ffff,0xd2400000-0xd2403fff irq 18 at device 0.0 on pci3 > > ix0: flags=3D8802 metric 0 mtu 1500 > > options=3D401bb > ether 00:e0:ed:1c:99:4e > nd6 options=3D29 > media: Ethernet autoselect > status: no carrier > > I have also tested with XenServer 6, using SR-IOV (ixgbevf driver) with > the same result: the driver is loading, but no link detected. > > In both case (VMWare DirectPath and XenServer SR-IOV), I tested Linux wit= h > success. > > > The card is an Intel 82599EB, the motherboard is an Intel X58 (supermicro > X8ST3) with a Xeon W3680 and I've tested FreeBSD 8.3 and 9.0 > > I've found a forum thread with the same issue: > http://forums.freebsd.org/showthread.php?t=3D29855 and no answer :) > > > Please find in attachment the dmesg (boot -v) with the ix driver compiled > with DEBUG flags using vmware. > > > Can anyone provide feedback about this issue ? > > Regards, > R=E9mi Pauchet > > > From owner-freebsd-net@FreeBSD.ORG Thu Oct 11 16:25:45 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D73FCB2F for ; Thu, 11 Oct 2012 16:25:45 +0000 (UTC) (envelope-from lars@netapp.com) Received: from mx2.netapp.com (mx2.netapp.com [216.240.18.37]) by mx1.freebsd.org (Postfix) with ESMTP id AF3AF8FC18 for ; Thu, 11 Oct 2012 16:25:45 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.80,573,1344236400"; d="p7s'?scan'208";a="699896212" Received: from smtp2.corp.netapp.com ([10.57.159.114]) by mx2-out.netapp.com with ESMTP; 11 Oct 2012 09:25:45 -0700 Received: from vmwexceht01-prd.hq.netapp.com (exchsmtp.hq.netapp.com [10.106.76.239]) by smtp2.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q9BGPjDC004025 for ; Thu, 11 Oct 2012 09:25:45 -0700 (PDT) Received: from SACEXCMBX01-PRD.hq.netapp.com ([169.254.2.216]) by vmwexceht01-prd.hq.netapp.com ([10.106.76.239]) with mapi id 14.02.0318.001; Thu, 11 Oct 2012 09:25:44 -0700 From: "Eggert, Lars" To: "freebsd-net@freebsd.org" Subject: FreeBSD & bufferbloat? Thread-Topic: FreeBSD & bufferbloat? Thread-Index: AQHNp80PUm1N4M9P0kqMMwoBU4cTbg== Date: Thu, 11 Oct 2012 16:25:44 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.104.60.114] Content-Type: multipart/signed; boundary="Apple-Mail=_90F17341-890E-40DD-8E2B-C0157034A6BB"; protocol="application/pkcs7-signature"; micalg=sha1 MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 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: Thu, 11 Oct 2012 16:25:45 -0000 --Apple-Mail=_90F17341-890E-40DD-8E2B-C0157034A6BB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, is anyone in BSD-land working on de-bufferbloating the kernel, similar = to what the Linux folks are currently doing? Lars= --Apple-Mail=_90F17341-890E-40DD-8E2B-C0157034A6BB-- From owner-freebsd-net@FreeBSD.ORG Thu Oct 11 17:50:21 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 52CB32A9 for ; Thu, 11 Oct 2012 17:50:21 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id 20AE68FC0A for ; Thu, 11 Oct 2012 17:50:21 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so2178790pad.13 for ; Thu, 11 Oct 2012 10:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Ob8G9+yHZFCFQSMkBCOtsTiS6dnQf+bumlQK9owdN7Q=; b=NRpZWEO8yKzBSaA/G5uJjFxhkWrH8vuWYXrV//LIk+lpZx3ePjHrlfvwzPvCiHkuKp d4jwkYPWWQF/YatE+bhIlu++1agYpE2y2gkcCWVgjkMeVxSkp1WZ+2IqFSgRCUEuDT1V +KaXIW6/13nnXOL0X6HNTCYzOawBOGb7MU4w4GtdWDFDhDdNaxdT916NckYlZqLZLPML Ax9paDdIThgC3KmM4DesoOoF9Cgke5BubK4tTd+P4E1b2mAlkv8miI9TeHzGUdjAu1Sm +YSMw0dyQFRXOXzpbh02R/zdGhu3bnYZUa9D156YWfJTMgttxkyTdCrVHFESBkmFhlZu ZkIQ== MIME-Version: 1.0 Received: by 10.66.74.40 with SMTP id q8mr4191738pav.29.1349977820634; Thu, 11 Oct 2012 10:50:20 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.146.233 with HTTP; Thu, 11 Oct 2012 10:50:20 -0700 (PDT) In-Reply-To: <40913.1349905089@tristatelogic.com> References: <201210101938.01847.bschmidt@techwires.net> <40913.1349905089@tristatelogic.com> Date: Thu, 11 Oct 2012 10:50:20 -0700 X-Google-Sender-Auth: ckEMSLWT5JsEkfCU-DsEEr8gTQM Message-ID: Subject: Re: Oops! (was: Support for Intel 5100 WiFi ?) From: Adrian Chadd To: "Ronald F. Guilmette" Content-Type: text/plain; charset=ISO-8859-1 Cc: Bernhard Schmidt , freebsd-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: Thu, 11 Oct 2012 17:50:21 -0000 What's the output of 'ifconfig wlanX list sta'? Adrian On 10 October 2012 14:38, Ronald F. Guilmette wrote: > > > Thanks Bernhard for all the additional info about the current state > of the iwn driver. > > I still do have a couple more small questions however. > > First it really does appear to me that even when my iwm0 device is > successfully connecting to an AP which has been set to do "N-only", > the information that is displayed via "ifconfig -a" is still showing > it as if it were communicating using 11g: > >>re0: flags=8802 metric 0 mtu 1500 >> options=389b >> ether 00:24:21:65:ad:a0 >> nd6 options=29 >> media: Ethernet autoselect (10baseT/UTP ) >> status: no carrier >>iwn0: flags=8843 metric 0 mtu 2290 >> ether 00:22:fb:76:6d:18 >> nd6 options=29 >> media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng >> status: associated >>lo0: flags=8049 metric 0 mtu 16384 >> options=3 >> inet6 ::1 prefixlen 128 >> inet6 fe80::1%lo0 prefixlen 64 scopeid 0xa >> inet 127.0.0.1 netmask 0xff000000 >> nd6 options=21 >>wlan0: flags=8843 metric 0 mtu 1500 >> ether 00:22:fb:76:6d:18 >> inet 192.168.1.23 netmask 0xffffff00 broadcast 192.168.1.255 >> inet6 fe80::222:fbff:fe76:6d18%wlan0 prefixlen 64 scopeid 0xb >> nd6 options=29 >> media: IEEE 802.11 Wireless Ethernet OFDM/24Mbps mode 11ng >> status: associated >> ssid ronair2-1 channel 11 (2462 MHz 11g ht/40-) bssid c0:c1:c0:8b:4b:f3 > ^^^ >> country US authmode WPA2/802.11i privacy ON deftxkey UNDEF >> AES-CCM 2:128-bit txpower 15 bmiss 10 scanvalid 450 bgscan >> bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 64 protmode CTS >> ampdulimit 64k ampdudensity 8 -amsdutx amsdurx shortgi wme >> roaming MANUAL > > Should I file a PR on this small problem/issue? > > Second, and again based on the output shown via "ifconfig -a", it > appears to me that even when it is in `N' mode (and even when my AP is > set to "auto" selection of either 40 or 20Mhz channels), the card > is never managing to get above 54Mbps, tops (and often considerably less, > as you can see above). > > So what am I doing wrong exactly? I had been trying some different equipment > earlier, but in the same locations and at the same distance, and in that case > I was routinely getting between 117Mbps and as much as 130Mbps... or anyway, > so said dd-wrt. > > Ultimately, I want to stream HD out to the laptop that has the Intel 5100 > in in, and thus, I really would like to get something above 54Mbps. And > it seems to me that this _should_ be possible. (In theory, I should be able > to get all of the way to 150Mbps, right?) So why can't I get my iwn0 device > (Intel 5100) under FreeBSD going anywhere near that fast? > > > Regards, > rfg > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" From owner-freebsd-net@FreeBSD.ORG Thu Oct 11 23:11:29 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E9C735B; Thu, 11 Oct 2012 23:11:29 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from outgoing.tristatelogic.com (segfault.tristatelogic.com [69.62.255.118]) by mx1.freebsd.org (Postfix) with ESMTP id 7B3BC8FC08; Thu, 11 Oct 2012 23:11:29 +0000 (UTC) Received: from segfault-nmh-helo.tristatelogic.com (localhost [127.0.0.1]) by segfault.tristatelogic.com (Postfix) with ESMTP id D1E6750840; Thu, 11 Oct 2012 16:11:21 -0700 (PDT) To: Adrian Chadd Subject: Re: Oops! (was: Support for Intel 5100 WiFi ?) In-Reply-To: Date: Thu, 11 Oct 2012 16:11:21 -0700 Message-ID: <71855.1349997081@tristatelogic.com> From: "Ronald F. Guilmette" Cc: Bernhard Schmidt , freebsd-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: Thu, 11 Oct 2012 23:11:29 -0000 In message , you wrote: >What's the output of 'ifconfig wlanX list sta'? % ifconfig wlan0 list sta ADDR AID CHAN RATE RSSI IDLE TXSEQ RXSEQ CAPS FLAG c0:c1:c0:8b:4b:f3 1 11 36M 11.5 0 85 37120 EP AQEHTRS RSN HTCAP WPS WME From owner-freebsd-net@FreeBSD.ORG Thu Oct 11 23:37:45 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id 7EA124ED; Thu, 11 Oct 2012 23:37:45 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from dhcp170-36-red.yandex.net (freefall.freebsd.org [8.8.178.135]) by mx2.freebsd.org (Postfix) with ESMTP id 927F51A5F4B; Wed, 10 Oct 2012 18:38:15 +0000 (UTC) Message-ID: <5075C05E.9070800@FreeBSD.org> Date: Wed, 10 Oct 2012 22:37:18 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120627 Thunderbird/13.0.1 MIME-Version: 1.0 To: Guy Helmer Subject: Re: 8.3: kernel panic in bpf.c catchpacket() References: <4B5399BF-4EE0-4182-8297-3BB97C4AA884@gmail.com> <59F9A36E-3DB2-4F6F-BB2A-A4C9DA76A70C@gmail.com> In-Reply-To: <59F9A36E-3DB2-4F6F-BB2A-A4C9DA76A70C@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org, FreeBSD Stable 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: Thu, 11 Oct 2012 23:37:45 -0000 On 10.10.2012 00:36, Guy Helmer wrote: > > On Oct 8, 2012, at 8:09 AM, Guy Helmer wrote: > >> I'm seeing a consistent new kernel panic in FreeBSD 8.3: >> I'm not seeing how bd_sbuf would be NULL here. Any ideas? > > Since I've not had any replies, I hope nobody minds if I reply with more information. > > This panic seems to be occasionally triggered now that my user land code is changing the packet filter a while after the bpd device has been opened and an initial packet filter was set (previously, my code did not change the filter after it was initially set). > > I'm focusing on bpf_setf() since that seems to be the place that could be tickling a problem, and I see that bpf_setf() calls reset_d(d) to clear the hold buffer. I have manually verified that the BPFD lock is held during the call to reset_d(), and the lock is held every other place that the buffers are manipulated, so I haven't been able to find any place that seems vulnerable to losing one of the bpf buffers. Still searching, but any help would be appreciated. Can you please check this code on -current? Locking has changed quite significantly some time ago, so there is good chance that you can get rid of this panic (or discover different one which is really "new") :). > > Guy > > _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org" > -- WBR, Alexander From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 00:21:17 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 9D2F72D6; Fri, 12 Oct 2012 00:21:17 +0000 (UTC) (envelope-from cochard@gmail.com) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by mx1.freebsd.org (Postfix) with ESMTP id EEAE58FC0A; Fri, 12 Oct 2012 00:21:16 +0000 (UTC) Received: by mail-wi0-f178.google.com with SMTP id hr7so66653wib.13 for ; Thu, 11 Oct 2012 17:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=xNSXdimHMHnWI3MnvOQbd5VbjZoq1TiPM0ch33Ce/oc=; b=g4ztNlZgvaO2vzP+LPZW3nBDF7djPnzDcNg7o+Cqq2EHtcx5N7d1zfMBSGvmJST57p RSCqDar07T1S3E7X7twSZyc0iQhJolPcimGicmm6QsN42hWbH+vCGYWRaHVYTqfOl0s/ 81AgUBxPvb3UM6rD03lUSz6hbxM8x721ea7waywxXb1G/k6tVK9gzVok8b/rs7qgexlq R0fTVmkHtLCnol5Cr2k7vmcN0w72T9K8Jd0pCcyH6k35G9VUP2A3ztttzAIGnAwuX163 tke0rauyDdm/YnVFq0qfgSpd4QyiDDQbCQAm0lt8b10vZ/02PX8jYK7rYt8IpVaEEUn1 Olzg== Received: by 10.216.204.72 with SMTP id g50mr1494426weo.142.1350001275779; Thu, 11 Oct 2012 17:21:15 -0700 (PDT) MIME-Version: 1.0 Sender: cochard@gmail.com Received: by 10.223.157.200 with HTTP; Thu, 11 Oct 2012 17:20:55 -0700 (PDT) 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> From: =?ISO-8859-1?Q?Olivier_Cochard=2DLabb=E9?= Date: Fri, 12 Oct 2012 02:20:55 +0200 X-Google-Sender-Auth: Xjxftw9t-oGe6GEl4jihr84V5pg Message-ID: Subject: Re: [CFT/Review] net byte order for AF_INET To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 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: Fri, 12 Oct 2012 00:21:17 -0000 I've done some tests with this net byte ordered(NBO) patch: - I've compiled 2 i386 images of BSD Router Project (current branch rev241418): One with the patch, and the other without the patch [1] - I've run my "full-features testing lab" under VirtualBox [2] using theses images. Here are the differences: - I can't SSH to and between the NBO-patched-FreeBSD; - Lot's of messages "in_cksum_skip: out of data by 28560/23460" on the non-patched FreeBSD (R2 and R3 on the diagram in [2]) - PPTP tunnel (net/mpd5) didn't works on the NBO-patched-FreeBSD; Regards, Olivier [1] http://gugus69.free.fr/freebsd/netbyteorder/ [2] http://bsdrp.net/documentation/examples/maximum_bsdrp_features_lab From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 01:24:29 2012 Return-Path: Delivered-To: net@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id 38BB6688 for ; Fri, 12 Oct 2012 01:24:29 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from dhcp170-36-red.yandex.net (freefall.freebsd.org [8.8.178.135]) by mx2.freebsd.org (Postfix) with ESMTP id F302CB56F2 for ; Thu, 11 Oct 2012 12:52:47 +0000 (UTC) Message-ID: <5076C0E3.9050803@FreeBSD.org> Date: Thu, 11 Oct 2012 16:51:47 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120627 Thunderbird/13.0.1 MIME-Version: 1.0 To: net@freebsd.org Subject: [PATCH] IPv6 and ICMP6 redirects - routing performance Content-Type: multipart/mixed; boundary="------------000302010301040001090109" 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: Fri, 12 Oct 2012 01:24:29 -0000 This is a multi-part message in MIME format. --------------000302010301040001090109 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello list! Currently there are some unnecessary code residing in netinet6/in6_rmx.c causing performance degradation for IPv6 forwarding. Initially it was merged from netinet/in_rmx.c but it seems it is totally unused now due to different approach used in IPv6 redirects. Code calls mtx_lock() on rte per each routing lookup in in6_matroute(). Initially I plan to make someting like r241406 for IPv6, but after some investigation I found that no one is currently setting RTF_DYNAMIC flag for IPv6 routes. the question is: can we remove this entirely (patch attached) or we still needs some parts of this due to incomplete RFC 4861 implementation? -- WBR, Alexander --------------000302010301040001090109 Content-Type: text/plain; charset=UTF-8; name="no_matroute6.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="no_matroute6.diff" Index: sys/netinet6/in6_rmx.c =================================================================== --- sys/netinet6/in6_rmx.c (revision 241408) +++ sys/netinet6/in6_rmx.c (working copy) @@ -111,8 +111,6 @@ extern int in6_inithead(void **head, int off); extern int in6_detachhead(void **head, int off); #endif -#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */ - /* * Do what we need to do when inserting a route. */ @@ -183,42 +181,8 @@ in6_addroute(void *v_arg, void *n_arg, struct radi return (ret); } -/* - * This code is the inverse of in6_clsroute: on first reference, if we - * were managing the route, stop doing so and set the expiration timer - * back off again. - */ -static struct radix_node * -in6_matroute(void *v_arg, struct radix_node_head *head) -{ - struct radix_node *rn = rn_match(v_arg, head); - struct rtentry *rt = (struct rtentry *)rn; - - if (rt) { - RT_LOCK(rt); - if (rt->rt_flags & RTPRF_OURS) { - rt->rt_flags &= ~RTPRF_OURS; - rt->rt_rmx.rmx_expire = 0; - } - RT_UNLOCK(rt); - } - return rn; -} - SYSCTL_DECL(_net_inet6_ip6); -static VNET_DEFINE(int, rtq_reallyold6) = 60*60; - /* one hour is ``really old'' */ -#define V_rtq_reallyold6 VNET(rtq_reallyold6) -SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTEXPIRE, rtexpire, CTLFLAG_RW, - &VNET_NAME(rtq_reallyold6) , 0, ""); - -static VNET_DEFINE(int, rtq_minreallyold6) = 10; - /* never automatically crank down to less */ -#define V_rtq_minreallyold6 VNET(rtq_minreallyold6) -SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_RTMINEXPIRE, rtminexpire, CTLFLAG_RW, - &VNET_NAME(rtq_minreallyold6) , 0, ""); - static VNET_DEFINE(int, rtq_toomany6) = 128; /* 128 cached routes is ``too many'' */ #define V_rtq_toomany6 VNET(rtq_toomany6) @@ -236,122 +200,6 @@ struct rtqk_arg { }; /* - * Get rid of old routes. When draining, this deletes everything, even when - * the timeout is not expired yet. When updating, this makes sure that - * nothing has a timeout longer than the current value of rtq_reallyold6. - */ -static int -in6_rtqkill(struct radix_node *rn, void *rock) -{ - struct rtqk_arg *ap = rock; - struct rtentry *rt = (struct rtentry *)rn; - int err; - - RADIX_NODE_HEAD_WLOCK_ASSERT(ap->rnh); - - if (rt->rt_flags & RTPRF_OURS) { - ap->found++; - - if (ap->draining || rt->rt_rmx.rmx_expire <= time_uptime) { - if (rt->rt_refcnt > 0) - panic("rtqkill route really not free"); - - err = in6_rtrequest(RTM_DELETE, - (struct sockaddr *)rt_key(rt), - rt->rt_gateway, rt_mask(rt), - rt->rt_flags|RTF_RNH_LOCKED, 0, - rt->rt_fibnum); - if (err) { - log(LOG_WARNING, "in6_rtqkill: error %d", err); - } else { - ap->killed++; - } - } else { - if (ap->updating - && (rt->rt_rmx.rmx_expire - time_uptime - > V_rtq_reallyold6)) { - rt->rt_rmx.rmx_expire = time_uptime - + V_rtq_reallyold6; - } - ap->nextstop = lmin(ap->nextstop, - rt->rt_rmx.rmx_expire); - } - } - - return 0; -} - -#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */ -static VNET_DEFINE(int, rtq_timeout6) = RTQ_TIMEOUT; -static VNET_DEFINE(struct callout, rtq_timer6); - -#define V_rtq_timeout6 VNET(rtq_timeout6) -#define V_rtq_timer6 VNET(rtq_timer6) - -static void -in6_rtqtimo_one(struct radix_node_head *rnh) -{ - struct rtqk_arg arg; - static time_t last_adjusted_timeout = 0; - - arg.found = arg.killed = 0; - arg.rnh = rnh; - arg.nextstop = time_uptime + V_rtq_timeout6; - arg.draining = arg.updating = 0; - RADIX_NODE_HEAD_LOCK(rnh); - rnh->rnh_walktree(rnh, in6_rtqkill, &arg); - RADIX_NODE_HEAD_UNLOCK(rnh); - - /* - * Attempt to be somewhat dynamic about this: - * If there are ``too many'' routes sitting around taking up space, - * then crank down the timeout, and see if we can't make some more - * go away. However, we make sure that we will never adjust more - * than once in rtq_timeout6 seconds, to keep from cranking down too - * hard. - */ - if ((arg.found - arg.killed > V_rtq_toomany6) - && (time_uptime - last_adjusted_timeout >= V_rtq_timeout6) - && V_rtq_reallyold6 > V_rtq_minreallyold6) { - V_rtq_reallyold6 = 2*V_rtq_reallyold6 / 3; - if (V_rtq_reallyold6 < V_rtq_minreallyold6) { - V_rtq_reallyold6 = V_rtq_minreallyold6; - } - - last_adjusted_timeout = time_uptime; -#ifdef DIAGNOSTIC - log(LOG_DEBUG, "in6_rtqtimo: adjusted rtq_reallyold6 to %d", - V_rtq_reallyold6); -#endif - arg.found = arg.killed = 0; - arg.updating = 1; - RADIX_NODE_HEAD_LOCK(rnh); - rnh->rnh_walktree(rnh, in6_rtqkill, &arg); - RADIX_NODE_HEAD_UNLOCK(rnh); - } -} - -static void -in6_rtqtimo(void *rock) -{ - CURVNET_SET_QUIET((struct vnet *) rock); - struct radix_node_head *rnh; - struct timeval atv; - u_int fibnum; - - for (fibnum = 0; fibnum < rt_numfibs; fibnum++) { - rnh = rt_tables_get_rnh(fibnum, AF_INET6); - if (rnh != NULL) - in6_rtqtimo_one(rnh); - } - - atv.tv_usec = 0; - atv.tv_sec = V_rtq_timeout6; - callout_reset(&V_rtq_timer6, tvtohz(&atv), in6_rtqtimo, rock); - CURVNET_RESTORE(); -} - -/* * Age old PMTUs. */ struct mtuex_arg { @@ -440,12 +288,9 @@ in6_inithead(void **head, int off) rnh = *head; rnh->rnh_addaddr = in6_addroute; - rnh->rnh_matchaddr = in6_matroute; if (V__in6_rt_was_here == 0) { - callout_init(&V_rtq_timer6, CALLOUT_MPSAFE); callout_init(&V_rtq_mtutimer, CALLOUT_MPSAFE); - in6_rtqtimo(curvnet); /* kick off timeout first time */ in6_mtutimo(curvnet); /* kick off timeout first time */ V__in6_rt_was_here = 1; } @@ -458,7 +303,6 @@ int in6_detachhead(void **head, int off) { - callout_drain(&V_rtq_timer6); callout_drain(&V_rtq_mtutimer); return (1); } --------------000302010301040001090109-- From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 04:45:20 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 19948185 for ; Fri, 12 Oct 2012 04:45:20 +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 6B8018FC08 for ; Fri, 12 Oct 2012 04:45:19 +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 q9C4jGI3098583; Fri, 12 Oct 2012 08:45:16 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9C4jGOd098582; Fri, 12 Oct 2012 08:45:16 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 12 Oct 2012 08:45:16 +0400 From: Gleb Smirnoff To: Olivier Cochard-Labb? Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121012044516.GJ89655@glebius.int.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121010195842.GH34622@FreeBSD.org> <20121010222651.GR40452@mdounin.ru> <20121010233404.GI34622@glebius.int.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0" 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: Fri, 12 Oct 2012 04:45:20 -0000 --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Olivier, thanks for help! On Fri, Oct 12, 2012 at 02:20:55AM +0200, Olivier Cochard-Labb? wrote: O> I've done some tests with this net byte ordered(NBO) patch: O> - I've compiled 2 i386 images of BSD Router Project (current branch O> rev241418): One with the patch, and the other without the patch [1] O> - I've run my "full-features testing lab" under VirtualBox [2] using O> theses images. O> O> Here are the differences: O> - I can't SSH to and between the NBO-patched-FreeBSD; O> - Lot's of messages "in_cksum_skip: out of data by 28560/23460" on the O> non-patched FreeBSD (R2 and R3 on the diagram in [2]) O> - PPTP tunnel (net/mpd5) didn't works on the NBO-patched-FreeBSD; Not working SSH suprises me :( PPTP not, since not tested yet. Can you please apply attached patch to sys/i386/i386/in_cksum.c? It will print backtrace once the invariant failed. -- Totus tuus, Glebius. --6TrnltStXW4iwmi0 Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="in_cksum.c.diff" Index: in_cksum.c =================================================================== --- in_cksum.c (revision 241405) +++ in_cksum.c (working copy) @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -257,6 +258,7 @@ * reorder operations, this will generally take place in parallel with * other calculations. */ +static int once = 1; u_short in_cksum_skip(m, len, skip) struct mbuf *m; @@ -477,8 +479,13 @@ su.c[0] = *(char *)w; } - if (len) + if (len) { + if (once) { + kdb_backtrace(); + once = 0; + } printf("%s: out of data by %d\n", __func__, len); + } if (mlen == -1) { /* The last mbuf has odd # of bytes. Follow the standard (the odd byte is shifted left by 8 bits) */ --6TrnltStXW4iwmi0-- From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 07:39:08 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 77A5077A for ; Fri, 12 Oct 2012 07:39:08 +0000 (UTC) (envelope-from remi.pauchet@netasq.com) Received: from work.netasq.com (gwlille.netasq.com [91.212.116.1]) by mx1.freebsd.org (Postfix) with ESMTP id ECCC78FC12 for ; Fri, 12 Oct 2012 07:39:07 +0000 (UTC) Received: from [10.2.9.2] (unknown [91.212.116.2]) by work.netasq.com (Postfix) with ESMTPSA id CAAA32704ACA; Fri, 12 Oct 2012 09:39:00 +0200 (CEST) Subject: Re: ixgbe and ixgbevf drivers are not working in virtualization environment Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: multipart/signed; boundary="Apple-Mail=_50966ACF-B5F3-4459-8A0B-B5B7E190FCF3"; protocol="application/pkcs7-signature"; micalg=sha1 From: =?iso-8859-1?Q?R=E9mi_Pauchet?= In-Reply-To: Date: Fri, 12 Oct 2012 09:38:59 +0200 Message-Id: References: <792D5931-19E7-4239-A3E8-5D2BC90F03FD@netasq.com> To: Jack Vogel X-Mailer: Apple Mail (2.1283) X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-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: Fri, 12 Oct 2012 07:39:08 -0000 --Apple-Mail=_50966ACF-B5F3-4459-8A0B-B5B7E190FCF3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Hi, Unfortunately not: ix0: flags=3D8843 metric 0 mtu = 1500 = options=3D401bb ether 00:e0:ed:1c:99:4e inet 172.16.255.254 netmask 0xffff0000 broadcast 172.16.255.255 inet6 fe80::2e0:edff:fe1c:994e%ix0 prefixlen 64 scopeid 0x2=20 nd6 options=3D29 media: Ethernet autoselect status: no carrier ix1: flags=3D8843 metric 0 mtu = 1500 = options=3D401bb ether 00:e0:ed:1c:99:4f inet 172.17.255.254 netmask 0xffff0000 broadcast 172.17.255.255 inet6 fe80::2e0:edff:fe1c:994f%ix1 prefixlen 64 scopeid 0x3=20 nd6 options=3D29 media: Ethernet autoselect status: no carrier Regards, R=E9mi Le 11 oct. 2012 =E0 18:25, Jack Vogel a =E9crit : > The ixgbe device will not get link until you have run init, so assign = it an address or just do an ifconfig up. >=20 > I have never used the driver using a passthru type setup but I believe = its been done successfully if > memory serves. >=20 > Jack >=20 >=20 > On Thu, Oct 11, 2012 at 8:39 AM, R=E9mi Pauchet = wrote: > Hi, >=20 > I'm trying to use the ixgbe (10Gb) driver in a FreeBSD virtual machine = on an esxi 5 using DirectPath (PCI Passthrough) and the card is = detected, but I can't get a link (status: no carrier) >=20 > ix0: = mem 0xd2420000-0xd243ffff,0xd2400000-0xd2403fff irq 18 at device 0.0 on = pci3 >=20 > ix0: flags=3D8802 metric 0 mtu 1500 > = options=3D401bb > ether 00:e0:ed:1c:99:4e > nd6 options=3D29 > media: Ethernet autoselect > status: no carrier >=20 > I have also tested with XenServer 6, using SR-IOV (ixgbevf driver) = with the same result: the driver is loading, but no link detected. >=20 > In both case (VMWare DirectPath and XenServer SR-IOV), I tested Linux = with success. >=20 >=20 > The card is an Intel 82599EB, the motherboard is an Intel X58 = (supermicro X8ST3) with a Xeon W3680 and I've tested FreeBSD 8.3 and 9.0 >=20 > I've found a forum thread with the same issue: = http://forums.freebsd.org/showthread.php?t=3D29855 and no answer :) >=20 >=20 > Please find in attachment the dmesg (boot -v) with the ix driver = compiled with DEBUG flags using vmware. >=20 >=20 > Can anyone provide feedback about this issue ? >=20 > Regards, > R=E9mi Pauchet >=20 >=20 >=20 --Apple-Mail=_50966ACF-B5F3-4459-8A0B-B5B7E190FCF3-- From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 10:13:16 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 2EF00EE5 for ; Fri, 12 Oct 2012 10:13:16 +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 E70AC8FC14 for ; Fri, 12 Oct 2012 10:13:14 +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 q9CADBY2000747; Fri, 12 Oct 2012 14:13:11 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9CADB4q000746; Fri, 12 Oct 2012 14:13:11 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 12 Oct 2012 14:13:11 +0400 From: Gleb Smirnoff To: Olivier Cochard-Labb? Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121012101311.GT89655@glebius.int.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121010195842.GH34622@FreeBSD.org> <20121010222651.GR40452@mdounin.ru> <20121010233404.GI34622@glebius.int.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="wzJLGUyc3ArbnUjN" 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: Fri, 12 Oct 2012 10:13:16 -0000 --wzJLGUyc3ArbnUjN Content-Type: text/plain; charset=koi8-r Content-Disposition: inline On Fri, Oct 12, 2012 at 02:20:55AM +0200, Olivier Cochard-Labb? wrote: O> I've done some tests with this net byte ordered(NBO) patch: O> - I've compiled 2 i386 images of BSD Router Project (current branch O> rev241418): One with the patch, and the other without the patch [1] O> - I've run my "full-features testing lab" under VirtualBox [2] using O> theses images. O> O> Here are the differences: O> - I can't SSH to and between the NBO-patched-FreeBSD; O> - Lot's of messages "in_cksum_skip: out of data by 28560/23460" on the O> non-patched FreeBSD (R2 and R3 on the diagram in [2]) O> - PPTP tunnel (net/mpd5) didn't works on the NBO-patched-FreeBSD; I see, TCP checksums didn't work. Here is updated patch that fixes that. -- Totus tuus, Glebius. --wzJLGUyc3ArbnUjN Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="IPv4.net-byte-order.diff" Index: sys/netinet/tcp_input.c =================================================================== --- sys/netinet/tcp_input.c (revision 241481) +++ sys/netinet/tcp_input.c (working copy) @@ -528,9 +528,6 @@ { struct tcphdr *th = NULL; struct ip *ip = NULL; -#ifdef INET - struct ipovly *ipov; -#endif struct inpcb *inp = NULL; struct tcpcb *tp = NULL; struct socket *so = NULL; @@ -643,32 +640,27 @@ } } ip = mtod(m, struct ip *); - ipov = (struct ipovly *)ip; th = (struct tcphdr *)((caddr_t)ip + off0); - tlen = ip->ip_len; + tlen = ntohs(ip->ip_len); if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) th->th_sum = m->m_pkthdr.csum_data; else th->th_sum = in_pseudo(ip->ip_src.s_addr, - ip->ip_dst.s_addr, - htonl(m->m_pkthdr.csum_data + - ip->ip_len + - IPPROTO_TCP)); + ip->ip_dst.s_addr, + htonl(m->m_pkthdr.csum_data + tlen + + IPPROTO_TCP)); th->th_sum ^= 0xffff; -#ifdef TCPDEBUG - ipov->ih_len = (u_short)tlen; - ipov->ih_len = htons(ipov->ih_len); -#endif } else { + struct ipovly *ipov = (struct ipovly *)ip; + /* * Checksum extended TCP header and data. */ - len = sizeof (struct ip) + tlen; + len = off0 + tlen; bzero(ipov->ih_x1, sizeof(ipov->ih_x1)); - ipov->ih_len = (u_short)tlen; - ipov->ih_len = htons(ipov->ih_len); + ipov->ih_len = htons(tlen); th->th_sum = in_cksum(m, len); } if (th->th_sum) { @@ -721,7 +713,6 @@ return; } ip = mtod(m, struct ip *); - ipov = (struct ipovly *)ip; th = (struct tcphdr *)((caddr_t)ip + off0); } } Index: sys/netinet/in.h =================================================================== --- sys/netinet/in.h (revision 241481) +++ sys/netinet/in.h (working copy) @@ -741,33 +741,6 @@ #define satosin(sa) ((struct sockaddr_in *)(sa)) #define sintosa(sin) ((struct sockaddr *)(sin)) #define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) - -/* - * Historically, BSD keeps ip_len and ip_off in host format - * when doing layer 3 processing, and this often requires - * to translate the format back and forth. - * To make the process explicit, we define a couple of macros - * that also take into account the fact that at some point - * we may want to keep those fields always in net format. - */ - -#if (BYTE_ORDER == BIG_ENDIAN) || defined(HAVE_NET_IPLEN) -#define SET_NET_IPLEN(p) do {} while (0) -#define SET_HOST_IPLEN(p) do {} while (0) -#else -#define SET_NET_IPLEN(p) do { \ - struct ip *h_ip = (p); \ - h_ip->ip_len = htons(h_ip->ip_len); \ - h_ip->ip_off = htons(h_ip->ip_off); \ - } while (0) - -#define SET_HOST_IPLEN(p) do { \ - struct ip *h_ip = (p); \ - h_ip->ip_len = ntohs(h_ip->ip_len); \ - h_ip->ip_off = ntohs(h_ip->ip_off); \ - } while (0) -#endif /* !HAVE_NET_IPLEN */ - #endif /* _KERNEL */ /* INET6 stuff */ Index: sys/netinet/tcp_subr.c =================================================================== --- sys/netinet/tcp_subr.c (revision 241481) +++ sys/netinet/tcp_subr.c (working copy) @@ -584,10 +584,10 @@ #ifdef INET { tlen += sizeof (struct tcpiphdr); - ip->ip_len = tlen; + ip->ip_len = htons(tlen); ip->ip_ttl = V_ip_defttl; if (V_path_mtu_discovery) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); } #endif m->m_len = tlen; @@ -1398,12 +1398,11 @@ /* * If no alternative MTU was * proposed, try the next smaller - * one. ip->ip_len has already - * been swapped in icmp_input(). + * one. */ if (!mtu) - mtu = ip_next_mtu(ip->ip_len, - 1); + mtu = ip_next_mtu( + ntohs(ip->ip_len), 1); if (mtu < V_tcp_minmss + sizeof(struct tcpiphdr)) mtu = V_tcp_minmss Index: sys/netinet/tcp_debug.c =================================================================== --- sys/netinet/tcp_debug.c (revision 241481) +++ sys/netinet/tcp_debug.c (working copy) @@ -175,11 +175,10 @@ #ifdef INET6 isipv6 ? ntohs(((struct ip6_hdr *)ipgen)->ip6_plen) : #endif - ((struct ip *)ipgen)->ip_len; + ntohs(((struct ip *)ipgen)->ip_len); if (act == TA_OUTPUT) { seq = ntohl(seq); ack = ntohl(ack); - len = ntohs((u_short)len); } if (act == TA_OUTPUT) len -= sizeof (struct tcphdr); Index: sys/netinet/tcp_syncache.c =================================================================== --- sys/netinet/tcp_syncache.c (revision 241481) +++ sys/netinet/tcp_syncache.c (working copy) @@ -1395,7 +1395,7 @@ ip = mtod(m, struct ip *); ip->ip_v = IPVERSION; ip->ip_hl = sizeof(struct ip) >> 2; - ip->ip_len = tlen; + ip->ip_len = htons(tlen); ip->ip_id = 0; ip->ip_off = 0; ip->ip_sum = 0; @@ -1413,7 +1413,7 @@ * 2) the SCF_UNREACH flag has been set */ if (V_path_mtu_discovery && ((sc->sc_flags & SCF_UNREACH) == 0)) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); th = (struct tcphdr *)(ip + 1); } @@ -1473,7 +1473,7 @@ ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) + optlen); else #endif - ip->ip_len += optlen; + ip->ip_len = htons(ntohs(ip->ip_len) + optlen); } else optlen = 0; Index: sys/netinet/sctp_input.c =================================================================== --- sys/netinet/sctp_input.c (revision 241481) +++ sys/netinet/sctp_input.c (working copy) @@ -6038,7 +6038,7 @@ dst.sin_len = sizeof(struct sockaddr_in); dst.sin_port = sh->dest_port; dst.sin_addr = ip->ip_dst; - length = ip->ip_len + iphlen; + length = ntohs(ip->ip_len) + iphlen; /* Validate mbuf chain length with IP payload length. */ if (SCTP_HEADER_LEN(m) != length) { SCTPDBG(SCTP_DEBUG_INPUT1, Index: sys/netinet/udp_usrreq.c =================================================================== --- sys/netinet/udp_usrreq.c (revision 241481) +++ sys/netinet/udp_usrreq.c (working copy) @@ -338,7 +338,7 @@ struct udphdr *uh; struct ifnet *ifp; struct inpcb *inp; - int len; + uint16_t len, ip_len; struct ip save_ip; struct sockaddr_in udp_in; #ifdef IPFIREWALL_FORWARD @@ -392,13 +392,13 @@ * reflect UDP length, drop. */ len = ntohs((u_short)uh->uh_ulen); - if (ip->ip_len != len) { - if (len > ip->ip_len || len < sizeof(struct udphdr)) { + ip_len = ntohs(ip->ip_len); + if (ip_len != len) { + if (len > ip_len || len < sizeof(struct udphdr)) { UDPSTAT_INC(udps_badlen); goto badunlocked; } - m_adj(m, len - ip->ip_len); - /* ip->ip_len = len; */ + m_adj(m, len - ip_len); } /* @@ -601,7 +601,7 @@ if (badport_bandlim(BANDLIM_ICMP_UNREACH) < 0) goto badunlocked; *ip = save_ip; - ip->ip_len += iphlen; + ip->ip_len = htons(ip_len + iphlen); icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); return; } @@ -1206,7 +1206,7 @@ struct ip *ip; ip = (struct ip *)&ui->ui_i; - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); } ipflags = 0; @@ -1233,7 +1233,7 @@ m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); } else ui->ui_sum = 0; - ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; + ((struct ip *)ui)->ip_len = htons(sizeof(struct udpiphdr) + len); ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */ ((struct ip *)ui)->ip_tos = tos; /* XXX */ UDPSTAT_INC(udps_opackets); @@ -1383,7 +1383,7 @@ m_adj(m, skip); ip = mtod(m, struct ip *); - ip->ip_len -= skip; + ip->ip_len = htons(ntohs(ip->ip_len) - skip); ip->ip_p = IPPROTO_ESP; /* Index: sys/netinet/ip_carp.c =================================================================== --- sys/netinet/ip_carp.c (revision 241481) +++ sys/netinet/ip_carp.c (working copy) @@ -783,9 +783,9 @@ ip->ip_v = IPVERSION; ip->ip_hl = sizeof(*ip) >> 2; ip->ip_tos = IPTOS_LOWDELAY; - ip->ip_len = len; + ip->ip_len = htons(len); ip->ip_id = ip_newid(); - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); ip->ip_ttl = CARP_DFLTTL; ip->ip_p = IPPROTO_CARP; ip->ip_sum = 0; Index: sys/netinet/raw_ip.c =================================================================== --- sys/netinet/raw_ip.c (revision 241481) +++ sys/netinet/raw_ip.c (working copy) @@ -292,7 +292,8 @@ * not modify the packet except for some * byte order swaps. */ - ip->ip_len += off; + ip->ip_len = ntohs(ip->ip_len) + off; + ip->ip_off = ntohs(ip->ip_off); hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask); @@ -449,11 +450,11 @@ ip = mtod(m, struct ip *); ip->ip_tos = inp->inp_ip_tos; if (inp->inp_flags & INP_DONTFRAG) - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); else - ip->ip_off = 0; + ip->ip_off = htons(0); ip->ip_p = inp->inp_ip_p; - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); ip->ip_src = inp->inp_laddr; if (jailed(inp->inp_cred)) { /* @@ -505,6 +506,12 @@ ip->ip_id = ip_newid(); /* + * Applications on raw sockets expect host byte order. + */ + ip->ip_len = htons(ip->ip_len); + ip->ip_off = htons(ip->ip_off); + + /* * XXX prevent ip_output from overwriting header fields. */ flags |= IP_RAWOUTPUT; Index: sys/netinet/ip_divert.c =================================================================== --- sys/netinet/ip_divert.c (revision 241481) +++ sys/netinet/ip_divert.c (working copy) @@ -386,10 +386,6 @@ INP_RUNLOCK(inp); goto cantsend; } - - /* Convert fields to host order for ip_output() */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); break; #ifdef INET6 case IPV6_VERSION >> 4: Index: sys/netinet/sctp_usrreq.c =================================================================== --- sys/netinet/sctp_usrreq.c (revision 241481) +++ sys/netinet/sctp_usrreq.c (working copy) @@ -180,7 +180,7 @@ SCTP_TCB_UNLOCK(stcb); return; } - totsz = ip->ip_len; + totsz = ntohs(ip->ip_len); nxtsz = ntohs(icmph->icmp_nextmtu); if (nxtsz == 0) { Index: sys/netinet/ip_output.c =================================================================== --- sys/netinet/ip_output.c (revision 241481) +++ sys/netinet/ip_output.c (working copy) @@ -102,7 +102,6 @@ /* * IP output. The packet in mbuf chain m contains a skeletal IP * header (with len, off, ttl, proto, tos, src, dst). - * ip_len and ip_off are in host format. * The mbuf chain containing the packet will be freed. * The mbuf opt, if present, will not be freed. * If route ro is present and has ro_rt initialized, route lookup would be @@ -175,6 +174,8 @@ hlen = len; /* ip->ip_hl is updated above */ } ip = mtod(m, struct ip *); + ip_len = ntohs(ip->ip_len); + ip_off = ntohs(ip->ip_off); /* * Fill in IP header. If we are not allowing fragmentation, @@ -442,7 +443,7 @@ * packet or packet fragments, unless ALTQ is enabled on the given * interface in which case packetdrop should be done by queueing. */ - n = ip->ip_len / mtu + 1; /* how many fragments ? */ + n = ip_len / mtu + 1; /* how many fragments ? */ if ( #ifdef ALTQ (!ALTQ_IS_ENABLED(&ifp->if_snd)) && @@ -469,7 +470,7 @@ goto bad; } /* don't allow broadcast messages to be fragmented */ - if (ip->ip_len > mtu) { + if (ip_len > mtu) { error = EMSGSIZE; goto bad; } @@ -502,12 +503,6 @@ hlen = ip->ip_hl << 2; #endif /* IPSEC */ - /* - * To network byte order. pfil(9) hooks and ip_fragment() expect this. - */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - /* Jump over all PFIL processing if hooks are not active. */ if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; @@ -544,8 +539,6 @@ } else { if (ia != NULL) ifa_free(&ia->ia_ifa); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto again; /* Redo the routing table lookup. */ } } @@ -579,16 +572,11 @@ m_tag_delete(m, fwd_tag); if (ia != NULL) ifa_free(&ia->ia_ifa); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto again; } #endif /* IPFIREWALL_FORWARD */ passout: - ip_len = ntohs(ip->ip_len); - ip_off = ntohs(ip->ip_off); - /* 127/8 must not appear on wire - RFC1122. */ if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { @@ -1295,8 +1283,6 @@ * calls the output routine of the loopback "driver", but with an interface * pointer that might NOT be a loopback interface -- evil, but easier than * replicating that code here. - * - * IP header in host byte order. */ static void ip_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in *dst, @@ -1326,8 +1312,6 @@ * than the interface's MTU. Can this possibly matter? */ ip = mtod(copym, struct ip *); - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(copym, hlen); #if 1 /* XXX */ Index: sys/netinet/in_gif.c =================================================================== --- sys/netinet/in_gif.c (revision 241481) +++ sys/netinet/in_gif.c (working copy) @@ -192,7 +192,7 @@ iphdr.ip_p = proto; /* version will be set in ip_output() */ iphdr.ip_ttl = V_ip_gif_ttl; - iphdr.ip_len = m->m_pkthdr.len + sizeof(struct ip); + iphdr.ip_len = htons(m->m_pkthdr.len + sizeof(struct ip)); ip_ecn_ingress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED : ECN_NOCARE, &iphdr.ip_tos, &tos); Index: sys/netinet/ip_options.c =================================================================== --- sys/netinet/ip_options.c (revision 241481) +++ sys/netinet/ip_options.c (working copy) @@ -490,7 +490,7 @@ unsigned optlen; optlen = opt->m_len - sizeof(p->ipopt_dst); - if (optlen + ip->ip_len > IP_MAXPACKET) { + if (optlen + ntohs(ip->ip_len) > IP_MAXPACKET) { *phlen = 0; return (m); /* XXX should fail */ } @@ -523,7 +523,7 @@ *phlen = sizeof(struct ip) + optlen; ip->ip_v = IPVERSION; ip->ip_hl = *phlen >> 2; - ip->ip_len += optlen; + ip->ip_len = htons(ntohs(ip->ip_len) + optlen); return (m); } Index: sys/netinet/tcp_timewait.c =================================================================== --- sys/netinet/tcp_timewait.c (revision 241481) +++ sys/netinet/tcp_timewait.c (working copy) @@ -593,9 +593,9 @@ m->m_pkthdr.csum_flags = CSUM_TCP; th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(sizeof(struct tcphdr) + optlen + IPPROTO_TCP)); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); if (V_path_mtu_discovery) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); error = ip_output(m, inp->inp_options, NULL, ((tw->tw_so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), NULL, inp); Index: sys/netinet/tcp_output.c =================================================================== --- sys/netinet/tcp_output.c (revision 241481) +++ sys/netinet/tcp_output.c (working copy) @@ -1239,7 +1239,7 @@ struct route ro; bzero(&ro, sizeof(ro)); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); #ifdef INET6 if (tp->t_inpcb->inp_vflag & INP_IPV6PROTO) ip->ip_ttl = in6_selecthlim(tp->t_inpcb, NULL); @@ -1253,7 +1253,7 @@ * NB: Don't set DF on small MTU/MSS to have a safe fallback. */ if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); error = ip_output(m, tp->t_inpcb->inp_options, &ro, ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0, Index: sys/netinet/sctputil.c =================================================================== --- sys/netinet/sctputil.c (revision 241481) +++ sys/netinet/sctputil.c (working copy) @@ -6821,7 +6821,7 @@ switch (iph->ip_v) { #ifdef INET case IPVERSION: - iph->ip_len -= sizeof(struct udphdr); + iph->ip_len = ntohs(htons(iph->ip_len) - sizeof(struct udphdr)); sctp_input_with_port(m, off, port); break; #endif Index: sys/netinet/ip_input.c =================================================================== --- sys/netinet/ip_input.c (revision 241481) +++ sys/netinet/ip_input.c (working copy) @@ -390,9 +390,8 @@ m->m_flags &= ~M_FASTFWD_OURS; /* Set up some basics that will be used later. */ ip = mtod(m, struct ip *); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); hlen = ip->ip_hl << 2; + ip_len = ntohs(ip->ip_len); goto ours; } @@ -513,8 +512,6 @@ #ifdef IPFIREWALL_FORWARD if (m->m_flags & M_FASTFWD_OURS) { m->m_flags &= ~M_FASTFWD_OURS; - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto ours; } if ((dchg = (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL)) != 0) { @@ -523,20 +520,12 @@ * packets originally destined to us to some other directly * connected host. */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); ip_forward(m, dchg); return; } #endif /* IPFIREWALL_FORWARD */ passin: - /* - * From now and up to output pfil(9) processing in ip_output() - * the header is in host byte order. - */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); /* * Process options and, if not destined for us, @@ -732,20 +721,21 @@ * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. */ - if (ip->ip_off & (IP_MF | IP_OFFMASK)) { + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) { m = ip_reass(m); if (m == NULL) return; ip = mtod(m, struct ip *); /* Get the header length of the reassembled packet */ hlen = ip->ip_hl << 2; + ip_len = ntohs(ip->ip_len); } /* * Further protocols expect the packet length to be w/o the * IP header. */ - ip->ip_len -= hlen; + ip->ip_len = htons(ip_len - hlen); #ifdef IPSEC /* @@ -914,22 +904,21 @@ * Adjust ip_len to not reflect header, * convert offset of this to bytes. */ - ip->ip_len -= hlen; - if (ip->ip_off & IP_MF) { + ip->ip_len = htons(ntohs(ip->ip_len) - hlen); + if (ip->ip_off & htons(IP_MF)) { /* * Make sure that fragments have a data length * that's a non-zero multiple of 8 bytes. */ - if (ip->ip_len == 0 || (ip->ip_len & 0x7) != 0) { + if (ntohs(ip->ip_len) == 0 || (ntohs(ip->ip_len & 0x7) != 0)) { IPSTAT_INC(ips_toosmall); /* XXX */ goto dropfrag; } m->m_flags |= M_FRAG; } else m->m_flags &= ~M_FRAG; - ip->ip_off <<= 3; + ip->ip_off = htons(ntohs(ip->ip_off) << 3); - /* * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. @@ -1000,7 +989,7 @@ * Find a segment which begins after this one does. */ for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) - if (GETIP(q)->ip_off > ip->ip_off) + if (ntohs(GETIP(q)->ip_off) > ntohs(ip->ip_off)) break; /* @@ -1013,14 +1002,15 @@ * segment, then it's checksum is invalidated. */ if (p) { - i = GETIP(p)->ip_off + GETIP(p)->ip_len - ip->ip_off; + i = ntohs(GETIP(p)->ip_off) + ntohs(GETIP(p)->ip_len) - + ntohs(ip->ip_off); if (i > 0) { - if (i >= ip->ip_len) + if (i >= ntohs(ip->ip_len)) goto dropfrag; m_adj(m, i); m->m_pkthdr.csum_flags = 0; - ip->ip_off += i; - ip->ip_len -= i; + ip->ip_off = htons(ntohs(ip->ip_off) + i); + ip->ip_len = htons(ntohs(ip->ip_len) - i); } m->m_nextpkt = p->m_nextpkt; p->m_nextpkt = m; @@ -1033,12 +1023,13 @@ * While we overlap succeeding segments trim them or, * if they are completely covered, dequeue them. */ - for (; q != NULL && ip->ip_off + ip->ip_len > GETIP(q)->ip_off; - q = nq) { - i = (ip->ip_off + ip->ip_len) - GETIP(q)->ip_off; - if (i < GETIP(q)->ip_len) { - GETIP(q)->ip_len -= i; - GETIP(q)->ip_off += i; + for (; q != NULL && ntohs(ip->ip_off) + ntohs(ip->ip_len) > + ntohs(GETIP(q)->ip_off); q = nq) { + i = (ntohs(ip->ip_off) + ntohs(ip->ip_len)) - + ntohs(GETIP(q)->ip_off); + if (i < ntohs(GETIP(q)->ip_len)) { + GETIP(q)->ip_len = htons(ntohs(GETIP(q)->ip_len) - i); + GETIP(q)->ip_off = htons(ntohs(GETIP(q)->ip_off) + i); m_adj(q, i); q->m_pkthdr.csum_flags = 0; break; @@ -1062,14 +1053,14 @@ */ next = 0; for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) { - if (GETIP(q)->ip_off != next) { + if (ntohs(GETIP(q)->ip_off) != next) { if (fp->ipq_nfrags > V_maxfragsperpacket) { IPSTAT_ADD(ips_fragdropped, fp->ipq_nfrags); ip_freef(head, fp); } goto done; } - next += GETIP(q)->ip_len; + next += ntohs(GETIP(q)->ip_len); } /* Make sure the last packet didn't have the IP_MF flag */ if (p->m_flags & M_FRAG) { @@ -1125,7 +1116,7 @@ * packet; dequeue and discard fragment reassembly header. * Make header visible. */ - ip->ip_len = (ip->ip_hl << 2) + next; + ip->ip_len = htons((ip->ip_hl << 2) + next); ip->ip_src = fp->ipq_src; ip->ip_dst = fp->ipq_dst; TAILQ_REMOVE(head, fp, ipq_list); @@ -1365,8 +1356,6 @@ * * The srcrt parameter indicates whether the packet is being forwarded * via a source route. - * - * IP header in host byte order. */ void ip_forward(struct mbuf *m, int srcrt) @@ -1436,7 +1425,7 @@ mcopy = NULL; } if (mcopy != NULL) { - mcopy->m_len = min(ip->ip_len, M_TRAILINGSPACE(mcopy)); + mcopy->m_len = min(ntohs(ip->ip_len), M_TRAILINGSPACE(mcopy)); mcopy->m_pkthdr.len = mcopy->m_len; m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t)); } @@ -1564,7 +1553,7 @@ if (ia != NULL) mtu = ia->ia_ifp->if_mtu; else - mtu = ip_next_mtu(ip->ip_len, 0); + mtu = ip_next_mtu(ntohs(ip->ip_len), 0); } IPSTAT_INC(ips_cantfrag); break; Index: sys/netinet/siftr.c =================================================================== --- sys/netinet/siftr.c (revision 241481) +++ sys/netinet/siftr.c (working copy) @@ -952,7 +952,8 @@ * the mbuf cluster "at" at offset "offset" bytes from * the beginning of the "at" mbuf's data pointer. */ - th->th_sum = in_cksum_skip(*m, ip->ip_len, ip_hl); + th->th_sum = in_cksum_skip(*m, ntohs(ip->ip_len), + ip_hl); } /* Index: sys/netinet/ip_icmp.c =================================================================== --- sys/netinet/ip_icmp.c (revision 241481) +++ sys/netinet/ip_icmp.c (working copy) @@ -229,7 +229,7 @@ */ if (n->m_flags & M_DECRYPTED) goto freeit; - if (oip->ip_off & ~(IP_MF|IP_DF)) + if (oip->ip_off & htons(~(IP_MF|IP_DF))) goto freeit; if (n->m_flags & (M_BCAST|M_MCAST)) goto freeit; @@ -263,16 +263,17 @@ tcphlen = th->th_off << 2; if (tcphlen < sizeof(struct tcphdr)) goto freeit; - if (oip->ip_len < oiphlen + tcphlen) + if (ntohs(oip->ip_len) < oiphlen + tcphlen) goto freeit; if (oiphlen + tcphlen > n->m_len && n->m_next == NULL) goto stdreply; if (n->m_len < oiphlen + tcphlen && ((n = m_pullup(n, oiphlen + tcphlen)) == NULL)) goto freeit; - icmpelen = max(tcphlen, min(V_icmp_quotelen, oip->ip_len - oiphlen)); + icmpelen = max(tcphlen, min(V_icmp_quotelen, + ntohs(oip->ip_len) - oiphlen)); } else -stdreply: icmpelen = max(8, min(V_icmp_quotelen, oip->ip_len - oiphlen)); +stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); icmplen = min(oiphlen + icmpelen, nlen); if (icmplen < sizeof(struct ip)) @@ -322,8 +323,6 @@ */ m_copydata(n, 0, icmplen, (caddr_t)&icp->icmp_ip); nip = &icp->icmp_ip; - nip->ip_len = htons(nip->ip_len); - nip->ip_off = htons(nip->ip_off); /* * Set up ICMP message mbuf and copy old IP header (without options @@ -338,7 +337,7 @@ m->m_pkthdr.rcvif = n->m_pkthdr.rcvif; nip = mtod(m, struct ip *); bcopy((caddr_t)oip, (caddr_t)nip, sizeof(struct ip)); - nip->ip_len = m->m_len; + nip->ip_len = htons(m->m_len); nip->ip_v = IPVERSION; nip->ip_hl = 5; nip->ip_p = IPPROTO_ICMP; @@ -360,7 +359,7 @@ struct ip *ip = mtod(m, struct ip *); struct sockaddr_in icmpsrc, icmpdst, icmpgw; int hlen = off; - int icmplen = ip->ip_len; + int icmplen = ntohs(ip->ip_len); int i, code; void (*ctlfunc)(int, struct sockaddr *, void *); int fibnum; @@ -501,7 +500,6 @@ ICMPSTAT_INC(icps_badlen); goto freeit; } - icp->icmp_ip.ip_len = ntohs(icp->icmp_ip.ip_len); /* Discard ICMP's in response to multicast packets */ if (IN_MULTICAST(ntohl(icp->icmp_ip.ip_dst.s_addr))) goto badcode; @@ -594,7 +592,8 @@ } ifa_free(&ia->ia_ifa); reflect: - ip->ip_len += hlen; /* since ip_input deducts this */ + /* Since ip_input() deducts this. */ + ip->ip_len = htons(ntohs(ip->ip_len) + hlen); ICMPSTAT_INC(icps_reflect); ICMPSTAT_INC(icps_outhist[icp->icmp_type]); icmp_reflect(m); @@ -864,7 +863,7 @@ * Now strip out original options by copying rest of first * mbuf's data back, and adjust the IP length. */ - ip->ip_len -= optlen; + ip->ip_len = htons(ntohs(ip->ip_len) - optlen); ip->ip_v = IPVERSION; ip->ip_hl = 5; m->m_len -= optlen; @@ -898,7 +897,7 @@ m->m_len -= hlen; icp = mtod(m, struct icmp *); icp->icmp_cksum = 0; - icp->icmp_cksum = in_cksum(m, ip->ip_len - hlen); + icp->icmp_cksum = in_cksum(m, ntohs(ip->ip_len) - hlen); m->m_data -= hlen; m->m_len += hlen; m->m_pkthdr.rcvif = (struct ifnet *)0; Index: sys/netinet/ip_gre.c =================================================================== --- sys/netinet/ip_gre.c (revision 241481) +++ sys/netinet/ip_gre.c (working copy) @@ -274,12 +274,10 @@ /* * On FreeBSD, rip_input() supplies us with ip->ip_len - * already converted into host byteorder and also decreases - * it by the lengh of IP header, however, ip_input() expects - * that this field is in the original format (network byteorder - * and full size of IP packet), so that adjust accordingly. + * decreased by the lengh of IP header, however, ip_input() + * expects it to be full size of IP packet, so adjust accordingly. */ - ip->ip_len = htons(ip->ip_len + sizeof(struct ip) - msiz); + ip->ip_len = htons(ntohs(ip->ip_len) + sizeof(struct ip) - msiz); ip->ip_sum = 0; ip->ip_sum = in_cksum(m, (ip->ip_hl << 2)); Index: sys/netinet/ip_ipsec.c =================================================================== --- sys/netinet/ip_ipsec.c (revision 241481) +++ sys/netinet/ip_ipsec.c (working copy) @@ -264,7 +264,6 @@ { #ifdef IPSEC struct secpolicy *sp = NULL; - struct ip *ip = mtod(*m, struct ip *); struct tdb_ident *tdbi; struct m_tag *mtag; int s; @@ -332,9 +331,6 @@ } } - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - /* * Do delayed checksums now because we send before * this is done in the normal processing path. @@ -345,6 +341,8 @@ } #ifdef SCTP if ((*m)->m_pkthdr.csum_flags & CSUM_SCTP) { + struct ip *ip = mtod(*m, struct ip *); + sctp_delayed_cksum(*m, (uint32_t)(ip->ip_hl << 2)); (*m)->m_pkthdr.csum_flags &= ~CSUM_SCTP; } @@ -359,8 +357,6 @@ * IPsec processing and return without error. */ *error = 0; - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto done; } /* Index: sys/netinet/ip_mroute.c =================================================================== --- sys/netinet/ip_mroute.c (revision 241481) +++ sys/netinet/ip_mroute.c (working copy) @@ -1493,7 +1493,7 @@ { struct ip *ip = mtod(m, struct ip *); vifi_t vifi; - int plen = ip->ip_len; + int plen = ntohs(ip->ip_len); VIF_LOCK_ASSERT(); @@ -2376,10 +2376,7 @@ /* Take care of delayed checksums */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - /* XXX: in_delayed_cksum() expects net byte order */ - ip->ip_len = htons(ip->ip_len); in_delayed_cksum(m); - ip->ip_len = ntohs(ip->ip_len); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } @@ -2401,10 +2398,8 @@ /* Compute the MTU after the PIM Register encapsulation */ mtu = 0xffff - sizeof(pim_encap_iphdr) - sizeof(pim_encap_pimhdr); - if (ip->ip_len <= mtu) { + if (ntohs(ip->ip_len) <= mtu) { /* Turn the IP header into a valid one */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(mb_copy, ip->ip_hl << 2); } else { @@ -2509,7 +2504,8 @@ ip_outer = mtod(mb_first, struct ip *); *ip_outer = pim_encap_iphdr; ip_outer->ip_id = ip_newid(); - ip_outer->ip_len = len + sizeof(pim_encap_iphdr) + sizeof(pim_encap_pimhdr); + ip_outer->ip_len = htons(len + sizeof(pim_encap_iphdr) + + sizeof(pim_encap_pimhdr)); ip_outer->ip_src = V_viftable[vifi].v_lcl_addr; ip_outer->ip_dst = rt->mfc_rp; /* @@ -2517,8 +2513,8 @@ * IP_DF bit. */ ip_outer->ip_tos = ip->ip_tos; - if (ntohs(ip->ip_off) & IP_DF) - ip_outer->ip_off |= IP_DF; + if (ip->ip_off & htons(IP_DF)) + ip_outer->ip_off |= htons(IP_DF); pimhdr = (struct pim_encap_pimhdr *)((caddr_t)ip_outer + sizeof(pim_encap_iphdr)); *pimhdr = pim_encap_pimhdr; @@ -2571,7 +2567,7 @@ struct ip *ip = mtod(m, struct ip *); struct pim *pim; int minlen; - int datalen = ip->ip_len; + int datalen = ntohs(ip->ip_len); int ip_tos; int iphlen = off; Index: sys/netinet/sctp_output.c =================================================================== --- sys/netinet/sctp_output.c (revision 241481) +++ sys/netinet/sctp_output.c (working copy) @@ -3980,7 +3980,7 @@ tos_value |= sctp_get_ect(stcb); } if ((nofragment_flag) && (port == 0)) { - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); } else ip->ip_off = 0; @@ -3988,7 +3988,7 @@ ip->ip_id = ip_newid(); ip->ip_ttl = inp->ip_inp.inp.inp_ip_ttl; - ip->ip_len = packet_length; + ip->ip_len = htons(packet_length); ip->ip_tos = tos_value; if (port) { ip->ip_p = IPPROTO_UDP; @@ -10991,7 +10991,7 @@ udp->uh_sum = 0; } } - ip->ip_len = len; + ip->ip_len = htons(len); if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); Index: sys/netinet/igmp.c =================================================================== --- sys/netinet/igmp.c (revision 241481) +++ sys/netinet/igmp.c (working copy) @@ -1442,7 +1442,7 @@ ip = mtod(m, struct ip *); iphlen = off; - igmplen = ip->ip_len; + igmplen = ntohs(ip->ip_len); /* * Validate lengths. @@ -2225,7 +2225,7 @@ ip = mtod(m, struct ip *); ip->ip_tos = 0; - ip->ip_len = sizeof(struct ip) + sizeof(struct igmp); + ip->ip_len = htons(sizeof(struct ip) + sizeof(struct igmp)); ip->ip_off = 0; ip->ip_p = IPPROTO_IGMP; ip->ip_src.s_addr = INADDR_ANY; @@ -3522,8 +3522,8 @@ ip = mtod(m, struct ip *); ip->ip_tos = IPTOS_PREC_INTERNETCONTROL; - ip->ip_len = hdrlen + igmpreclen; - ip->ip_off = IP_DF; + ip->ip_len = htons(hdrlen + igmpreclen); + ip->ip_off = htons(IP_DF); ip->ip_p = IPPROTO_IGMP; ip->ip_sum = 0; Index: sys/i386/i386/in_cksum.c =================================================================== --- sys/i386/i386/in_cksum.c (revision 241481) +++ sys/i386/i386/in_cksum.c (working copy) @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -257,6 +258,7 @@ * reorder operations, this will generally take place in parallel with * other calculations. */ +static int once = 1; u_short in_cksum_skip(m, len, skip) struct mbuf *m; @@ -477,8 +479,13 @@ su.c[0] = *(char *)w; } - if (len) + if (len) { + if (once) { + kdb_backtrace(); + once = 0; + } printf("%s: out of data by %d\n", __func__, len); + } if (mlen == -1) { /* The last mbuf has odd # of bytes. Follow the standard (the odd byte is shifted left by 8 bits) */ Index: sys/netinet6/ip6_ipsec.c =================================================================== --- sys/netinet6/ip6_ipsec.c (revision 241481) +++ sys/netinet6/ip6_ipsec.c (working copy) @@ -295,15 +295,9 @@ */ #ifdef INET if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - struct ip *ip; - ipseclog((LOG_DEBUG, "%s: we do not support IPv4 over IPv6", __func__)); - /* XXX: in_delayed_cksum() expects net byte order */ - ip = mtod(*m, struct ip *); - ip->ip_len = htons(ip->ip_len); in_delayed_cksum(*m); - ip->ip_len = ntohs(ip->ip_len); (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } #endif Index: sys/netpfil/pf/pf.c =================================================================== --- sys/netpfil/pf/pf.c (revision 241481) +++ sys/netpfil/pf/pf.c (working copy) @@ -2252,8 +2252,8 @@ h->ip_v = 4; h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; - h->ip_off = V_path_mtu_discovery ? IP_DF : 0; - h->ip_len = len; + h->ip_off = V_path_mtu_discovery ? htons(IP_DF) : 0; + h->ip_len = htons(len); h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; @@ -2316,17 +2316,8 @@ switch (af) { #ifdef INET case AF_INET: - { - struct ip *ip; - - /* icmp_error() expects host byte ordering */ - ip = mtod(m0, struct ip *); - NTOHS(ip->ip_len); - NTOHS(ip->ip_off); - pfse->pfse_type = PFSE_ICMP; break; - } #endif /* INET */ #ifdef INET6 case AF_INET6: Index: sys/netpfil/pf/if_pfsync.c =================================================================== --- sys/netpfil/pf/if_pfsync.c (revision 241481) +++ sys/netpfil/pf/if_pfsync.c (working copy) @@ -1384,7 +1384,7 @@ ip->ip_hl = sizeof(sc->sc_template) >> 2; ip->ip_tos = IPTOS_LOWDELAY; /* len and id are set later. */ - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); ip->ip_ttl = PFSYNC_DFLTTL; ip->ip_p = IPPROTO_PFSYNC; ip->ip_src.s_addr = INADDR_ANY; @@ -1522,7 +1522,7 @@ bcopy(&sc->sc_template, ip, sizeof(*ip)); offset = sizeof(*ip); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); ip->ip_id = htons(ip_randomid()); /* build the pfsync header */ Index: sys/netpfil/ipfw/ip_fw_dynamic.c =================================================================== --- sys/netpfil/ipfw/ip_fw_dynamic.c (revision 241481) +++ sys/netpfil/ipfw/ip_fw_dynamic.c (working copy) @@ -1017,8 +1017,7 @@ h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; h->ip_off = 0; - /* ip_len must be in host format for ip_output */ - h->ip_len = len; + h->ip_len = htons(len); h->ip_ttl = V_ip_defttl; h->ip_sum = 0; break; Index: sys/netpfil/ipfw/ip_fw_pfil.c =================================================================== --- sys/netpfil/ipfw/ip_fw_pfil.c (revision 241481) +++ sys/netpfil/ipfw/ip_fw_pfil.c (working copy) @@ -431,7 +431,6 @@ int hlen; struct mbuf *reass; - SET_HOST_IPLEN(ip); /* ip_reass wants host order */ reass = ip_reass(clone); /* Reassemble packet. */ if (reass == NULL) return 0; /* not an error */ @@ -442,7 +441,6 @@ */ ip = mtod(reass, struct ip *); hlen = ip->ip_hl << 2; - SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Index: sys/netpfil/ipfw/ip_dn_io.c =================================================================== --- sys/netpfil/ipfw/ip_dn_io.c (revision 241481) +++ sys/netpfil/ipfw/ip_dn_io.c (working copy) @@ -658,13 +658,10 @@ switch (dst) { case DIR_OUT: - SET_HOST_IPLEN(mtod(m, struct ip *)); ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL); break ; case DIR_IN : - /* put header in network format for ip_input() */ - //SET_NET_IPLEN(mtod(m, struct ip *)); netisr_dispatch(NETISR_IP, m); break; Index: sys/netpfil/ipfw/ip_fw2.c =================================================================== --- sys/netpfil/ipfw/ip_fw2.c (revision 241481) +++ sys/netpfil/ipfw/ip_fw2.c (working copy) @@ -627,8 +627,6 @@ m_adj(m, args->L3offset); #endif if (code != ICMP_REJECT_RST) { /* Send an ICMP unreach */ - /* We need the IP header in host order for icmp_error(). */ - SET_HOST_IPLEN(ip); icmp_error(args->m, ICMP_UNREACH, code, 0L, 0); } else if (args->f_id.proto == IPPROTO_TCP) { struct tcphdr *const tcp = @@ -2418,11 +2416,6 @@ /* if not fragmented, go to next rule */ if ((ip_off & (IP_MF | IP_OFFMASK)) == 0) break; - /* - * ip_reass() expects len & off in host - * byte order. - */ - SET_HOST_IPLEN(ip); args->m = m = ip_reass(m); @@ -2436,7 +2429,6 @@ ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; - SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Index: sys/netipsec/ipsec.c =================================================================== --- sys/netipsec/ipsec.c (revision 241481) +++ sys/netipsec/ipsec.c (working copy) @@ -597,10 +597,9 @@ IPSEC_ASSERT(m != NULL, ("null mbuf")); IPSEC_ASSERT(m->m_pkthdr.len >= sizeof(struct ip),("packet too short")); - /* NB: ip_input() flips it into host endian. XXX Need more checking. */ if (m->m_len >= sizeof (struct ip)) { struct ip *ip = mtod(m, struct ip *); - if (ip->ip_off & (IP_MF | IP_OFFMASK)) + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) goto done; #ifdef _IP_VHL off = _IP_VHL_HL(ip->ip_vhl) << 2; @@ -612,7 +611,7 @@ struct ip ih; m_copydata(m, 0, sizeof (struct ip), (caddr_t) &ih); - if (ih.ip_off & (IP_MF | IP_OFFMASK)) + if (ih.ip_off & htons(IP_MF | IP_OFFMASK)) goto done; #ifdef _IP_VHL off = _IP_VHL_HL(ih.ip_vhl) << 2; Index: sys/amd64/amd64/in_cksum.c =================================================================== --- sys/amd64/amd64/in_cksum.c (revision 241481) +++ sys/amd64/amd64/in_cksum.c (working copy) @@ -227,6 +227,10 @@ clen += mlen; len -= mlen; } + + if (len) + printf("%s: len off by %u bytes\n", __func__, len); + REDUCE16; return (~sum & 0xffff); } Index: sys/netgraph/ng_ipfw.c =================================================================== --- sys/netgraph/ng_ipfw.c (revision 241481) +++ sys/netgraph/ng_ipfw.c (working copy) @@ -265,7 +265,6 @@ switch (ip->ip_v) { #ifdef INET case IPVERSION: - SET_HOST_IPLEN(ip); return (ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL)); #endif Index: sys/net/if_stf.c =================================================================== --- sys/net/if_stf.c (revision 241481) +++ sys/net/if_stf.c (working copy) @@ -523,7 +523,7 @@ bcopy(&in4, &ip->ip_dst, sizeof(ip->ip_dst)); ip->ip_p = IPPROTO_IPV6; ip->ip_ttl = ip_stf_ttl; - ip->ip_len = m->m_pkthdr.len; /*host order*/ + ip->ip_len = htons(m->m_pkthdr.len); if (ifp->if_flags & IFF_LINK1) ip_ecn_ingress(ECN_ALLOWED, &ip->ip_tos, &tos); else Index: sys/net/if_gre.c =================================================================== --- sys/net/if_gre.c (revision 241481) +++ sys/net/if_gre.c (working copy) @@ -356,7 +356,7 @@ * RFC2004 specifies that fragmented diagrams shouldn't * be encapsulated. */ - if (ip->ip_off & (IP_MF | IP_OFFMASK)) { + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) { _IF_DROP(&ifp->if_snd); m_freem(m); error = EINVAL; /* is there better errno? */ @@ -410,7 +410,7 @@ } ip = mtod(m, struct ip *); memcpy((caddr_t)(ip + 1), &mob_h, (unsigned)msiz); - ip->ip_len = ntohs(ip->ip_len) + msiz; + ip->ip_len = htons(ntohs(ip->ip_len) + msiz); } else { /* AF_INET */ _IF_DROP(&ifp->if_snd); m_freem(m); @@ -493,7 +493,7 @@ ((struct ip*)gh)->ip_ttl = GRE_TTL; ((struct ip*)gh)->ip_tos = gre_ip_tos; ((struct ip*)gh)->ip_id = gre_ip_id; - gh->gi_len = m->m_pkthdr.len; + gh->gi_len = htons(m->m_pkthdr.len); } ifp->if_opackets++; --wzJLGUyc3ArbnUjN-- From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 12:46:43 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 6FA52F26 for ; Fri, 12 Oct 2012 12:46:43 +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 C27BA8FC08 for ; Fri, 12 Oct 2012 12:46:42 +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 q9CCkeZt001601 for ; Fri, 12 Oct 2012 16:46:40 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9CCket6001600 for net@freebsd.org; Fri, 12 Oct 2012 16:46:40 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 12 Oct 2012 16:46:40 +0400 From: Gleb Smirnoff To: net@FreeBSD.org Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121012124640.GW89655@FreeBSD.org> References: <20121009154128.GU34622@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20121009154128.GU34622@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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: Fri, 12 Oct 2012 12:46:43 -0000 Latest version of patch for further review and testing Changelog: - Fixed TCP checksums - Added comment about raw sockets byte ordering. - More explicit htons(0), when assigning ip_off field. -- Totus tuus, Glebius. From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 12:47:12 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 224E9FFD for ; Fri, 12 Oct 2012 12:47:12 +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 EF2C28FC19 for ; Fri, 12 Oct 2012 12:47:10 +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 q9CCl974001616 for ; Fri, 12 Oct 2012 16:47:09 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9CCl9Pt001615 for net@freebsd.org; Fri, 12 Oct 2012 16:47:09 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 12 Oct 2012 16:47:09 +0400 From: Gleb Smirnoff To: net@FreeBSD.org Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121012124709.GX89655@FreeBSD.org> References: <20121009154128.GU34622@FreeBSD.org> <20121012124640.GW89655@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Izn7cH1Com+I3R9J" Content-Disposition: inline In-Reply-To: <20121012124640.GW89655@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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: Fri, 12 Oct 2012 12:47:12 -0000 --Izn7cH1Com+I3R9J Content-Type: text/plain; charset=koi8-r Content-Disposition: inline On Fri, Oct 12, 2012 at 04:46:40PM +0400, Gleb Smirnoff wrote: T> Latest version of patch for further review and testing T> Changelog: T> - Fixed TCP checksums T> - Added comment about raw sockets byte ordering. T> - More explicit htons(0), when assigning ip_off field. Forgot attachment :( -- Totus tuus, Glebius. --Izn7cH1Com+I3R9J Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="IPv4.net-byte-order.diff" Index: sys/netinet/tcp_input.c =================================================================== --- sys/netinet/tcp_input.c (revision 241481) +++ sys/netinet/tcp_input.c (working copy) @@ -528,9 +528,6 @@ { struct tcphdr *th = NULL; struct ip *ip = NULL; -#ifdef INET - struct ipovly *ipov; -#endif struct inpcb *inp = NULL; struct tcpcb *tp = NULL; struct socket *so = NULL; @@ -643,32 +640,27 @@ } } ip = mtod(m, struct ip *); - ipov = (struct ipovly *)ip; th = (struct tcphdr *)((caddr_t)ip + off0); - tlen = ip->ip_len; + tlen = ntohs(ip->ip_len); if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) th->th_sum = m->m_pkthdr.csum_data; else th->th_sum = in_pseudo(ip->ip_src.s_addr, - ip->ip_dst.s_addr, - htonl(m->m_pkthdr.csum_data + - ip->ip_len + - IPPROTO_TCP)); + ip->ip_dst.s_addr, + htonl(m->m_pkthdr.csum_data + tlen + + IPPROTO_TCP)); th->th_sum ^= 0xffff; -#ifdef TCPDEBUG - ipov->ih_len = (u_short)tlen; - ipov->ih_len = htons(ipov->ih_len); -#endif } else { + struct ipovly *ipov = (struct ipovly *)ip; + /* * Checksum extended TCP header and data. */ - len = sizeof (struct ip) + tlen; + len = off0 + tlen; bzero(ipov->ih_x1, sizeof(ipov->ih_x1)); - ipov->ih_len = (u_short)tlen; - ipov->ih_len = htons(ipov->ih_len); + ipov->ih_len = htons(tlen); th->th_sum = in_cksum(m, len); } if (th->th_sum) { @@ -721,7 +713,6 @@ return; } ip = mtod(m, struct ip *); - ipov = (struct ipovly *)ip; th = (struct tcphdr *)((caddr_t)ip + off0); } } Index: sys/netinet/in.h =================================================================== --- sys/netinet/in.h (revision 241481) +++ sys/netinet/in.h (working copy) @@ -741,33 +741,6 @@ #define satosin(sa) ((struct sockaddr_in *)(sa)) #define sintosa(sin) ((struct sockaddr *)(sin)) #define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) - -/* - * Historically, BSD keeps ip_len and ip_off in host format - * when doing layer 3 processing, and this often requires - * to translate the format back and forth. - * To make the process explicit, we define a couple of macros - * that also take into account the fact that at some point - * we may want to keep those fields always in net format. - */ - -#if (BYTE_ORDER == BIG_ENDIAN) || defined(HAVE_NET_IPLEN) -#define SET_NET_IPLEN(p) do {} while (0) -#define SET_HOST_IPLEN(p) do {} while (0) -#else -#define SET_NET_IPLEN(p) do { \ - struct ip *h_ip = (p); \ - h_ip->ip_len = htons(h_ip->ip_len); \ - h_ip->ip_off = htons(h_ip->ip_off); \ - } while (0) - -#define SET_HOST_IPLEN(p) do { \ - struct ip *h_ip = (p); \ - h_ip->ip_len = ntohs(h_ip->ip_len); \ - h_ip->ip_off = ntohs(h_ip->ip_off); \ - } while (0) -#endif /* !HAVE_NET_IPLEN */ - #endif /* _KERNEL */ /* INET6 stuff */ Index: sys/netinet/tcp_subr.c =================================================================== --- sys/netinet/tcp_subr.c (revision 241481) +++ sys/netinet/tcp_subr.c (working copy) @@ -584,10 +584,10 @@ #ifdef INET { tlen += sizeof (struct tcpiphdr); - ip->ip_len = tlen; + ip->ip_len = htons(tlen); ip->ip_ttl = V_ip_defttl; if (V_path_mtu_discovery) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); } #endif m->m_len = tlen; @@ -1398,12 +1398,11 @@ /* * If no alternative MTU was * proposed, try the next smaller - * one. ip->ip_len has already - * been swapped in icmp_input(). + * one. */ if (!mtu) - mtu = ip_next_mtu(ip->ip_len, - 1); + mtu = ip_next_mtu( + ntohs(ip->ip_len), 1); if (mtu < V_tcp_minmss + sizeof(struct tcpiphdr)) mtu = V_tcp_minmss Index: sys/netinet/tcp_debug.c =================================================================== --- sys/netinet/tcp_debug.c (revision 241481) +++ sys/netinet/tcp_debug.c (working copy) @@ -175,11 +175,10 @@ #ifdef INET6 isipv6 ? ntohs(((struct ip6_hdr *)ipgen)->ip6_plen) : #endif - ((struct ip *)ipgen)->ip_len; + ntohs(((struct ip *)ipgen)->ip_len); if (act == TA_OUTPUT) { seq = ntohl(seq); ack = ntohl(ack); - len = ntohs((u_short)len); } if (act == TA_OUTPUT) len -= sizeof (struct tcphdr); Index: sys/netinet/tcp_syncache.c =================================================================== --- sys/netinet/tcp_syncache.c (revision 241481) +++ sys/netinet/tcp_syncache.c (working copy) @@ -1395,7 +1395,7 @@ ip = mtod(m, struct ip *); ip->ip_v = IPVERSION; ip->ip_hl = sizeof(struct ip) >> 2; - ip->ip_len = tlen; + ip->ip_len = htons(tlen); ip->ip_id = 0; ip->ip_off = 0; ip->ip_sum = 0; @@ -1413,7 +1413,7 @@ * 2) the SCF_UNREACH flag has been set */ if (V_path_mtu_discovery && ((sc->sc_flags & SCF_UNREACH) == 0)) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); th = (struct tcphdr *)(ip + 1); } @@ -1473,7 +1473,7 @@ ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) + optlen); else #endif - ip->ip_len += optlen; + ip->ip_len = htons(ntohs(ip->ip_len) + optlen); } else optlen = 0; Index: sys/netinet/sctp_input.c =================================================================== --- sys/netinet/sctp_input.c (revision 241481) +++ sys/netinet/sctp_input.c (working copy) @@ -6038,7 +6038,7 @@ dst.sin_len = sizeof(struct sockaddr_in); dst.sin_port = sh->dest_port; dst.sin_addr = ip->ip_dst; - length = ip->ip_len + iphlen; + length = ntohs(ip->ip_len) + iphlen; /* Validate mbuf chain length with IP payload length. */ if (SCTP_HEADER_LEN(m) != length) { SCTPDBG(SCTP_DEBUG_INPUT1, Index: sys/netinet/udp_usrreq.c =================================================================== --- sys/netinet/udp_usrreq.c (revision 241481) +++ sys/netinet/udp_usrreq.c (working copy) @@ -338,7 +338,7 @@ struct udphdr *uh; struct ifnet *ifp; struct inpcb *inp; - int len; + uint16_t len, ip_len; struct ip save_ip; struct sockaddr_in udp_in; #ifdef IPFIREWALL_FORWARD @@ -392,13 +392,13 @@ * reflect UDP length, drop. */ len = ntohs((u_short)uh->uh_ulen); - if (ip->ip_len != len) { - if (len > ip->ip_len || len < sizeof(struct udphdr)) { + ip_len = ntohs(ip->ip_len); + if (ip_len != len) { + if (len > ip_len || len < sizeof(struct udphdr)) { UDPSTAT_INC(udps_badlen); goto badunlocked; } - m_adj(m, len - ip->ip_len); - /* ip->ip_len = len; */ + m_adj(m, len - ip_len); } /* @@ -601,7 +601,7 @@ if (badport_bandlim(BANDLIM_ICMP_UNREACH) < 0) goto badunlocked; *ip = save_ip; - ip->ip_len += iphlen; + ip->ip_len = htons(ip_len + iphlen); icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); return; } @@ -1206,7 +1206,7 @@ struct ip *ip; ip = (struct ip *)&ui->ui_i; - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); } ipflags = 0; @@ -1233,7 +1233,7 @@ m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); } else ui->ui_sum = 0; - ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; + ((struct ip *)ui)->ip_len = htons(sizeof(struct udpiphdr) + len); ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */ ((struct ip *)ui)->ip_tos = tos; /* XXX */ UDPSTAT_INC(udps_opackets); @@ -1383,7 +1383,7 @@ m_adj(m, skip); ip = mtod(m, struct ip *); - ip->ip_len -= skip; + ip->ip_len = htons(ntohs(ip->ip_len) - skip); ip->ip_p = IPPROTO_ESP; /* Index: sys/netinet/ip_carp.c =================================================================== --- sys/netinet/ip_carp.c (revision 241481) +++ sys/netinet/ip_carp.c (working copy) @@ -783,9 +783,9 @@ ip->ip_v = IPVERSION; ip->ip_hl = sizeof(*ip) >> 2; ip->ip_tos = IPTOS_LOWDELAY; - ip->ip_len = len; + ip->ip_len = htons(len); ip->ip_id = ip_newid(); - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); ip->ip_ttl = CARP_DFLTTL; ip->ip_p = IPPROTO_CARP; ip->ip_sum = 0; Index: sys/netinet/raw_ip.c =================================================================== --- sys/netinet/raw_ip.c (revision 241481) +++ sys/netinet/raw_ip.c (working copy) @@ -292,7 +292,8 @@ * not modify the packet except for some * byte order swaps. */ - ip->ip_len += off; + ip->ip_len = ntohs(ip->ip_len) + off; + ip->ip_off = ntohs(ip->ip_off); hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr, ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask); @@ -449,11 +450,11 @@ ip = mtod(m, struct ip *); ip->ip_tos = inp->inp_ip_tos; if (inp->inp_flags & INP_DONTFRAG) - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); else - ip->ip_off = 0; + ip->ip_off = htons(0); ip->ip_p = inp->inp_ip_p; - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); ip->ip_src = inp->inp_laddr; if (jailed(inp->inp_cred)) { /* @@ -505,6 +506,12 @@ ip->ip_id = ip_newid(); /* + * Applications on raw sockets expect host byte order. + */ + ip->ip_len = htons(ip->ip_len); + ip->ip_off = htons(ip->ip_off); + + /* * XXX prevent ip_output from overwriting header fields. */ flags |= IP_RAWOUTPUT; Index: sys/netinet/ip_divert.c =================================================================== --- sys/netinet/ip_divert.c (revision 241481) +++ sys/netinet/ip_divert.c (working copy) @@ -386,10 +386,6 @@ INP_RUNLOCK(inp); goto cantsend; } - - /* Convert fields to host order for ip_output() */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); break; #ifdef INET6 case IPV6_VERSION >> 4: Index: sys/netinet/sctp_usrreq.c =================================================================== --- sys/netinet/sctp_usrreq.c (revision 241481) +++ sys/netinet/sctp_usrreq.c (working copy) @@ -180,7 +180,7 @@ SCTP_TCB_UNLOCK(stcb); return; } - totsz = ip->ip_len; + totsz = ntohs(ip->ip_len); nxtsz = ntohs(icmph->icmp_nextmtu); if (nxtsz == 0) { Index: sys/netinet/ip_output.c =================================================================== --- sys/netinet/ip_output.c (revision 241481) +++ sys/netinet/ip_output.c (working copy) @@ -102,7 +102,6 @@ /* * IP output. The packet in mbuf chain m contains a skeletal IP * header (with len, off, ttl, proto, tos, src, dst). - * ip_len and ip_off are in host format. * The mbuf chain containing the packet will be freed. * The mbuf opt, if present, will not be freed. * If route ro is present and has ro_rt initialized, route lookup would be @@ -175,6 +174,8 @@ hlen = len; /* ip->ip_hl is updated above */ } ip = mtod(m, struct ip *); + ip_len = ntohs(ip->ip_len); + ip_off = ntohs(ip->ip_off); /* * Fill in IP header. If we are not allowing fragmentation, @@ -442,7 +443,7 @@ * packet or packet fragments, unless ALTQ is enabled on the given * interface in which case packetdrop should be done by queueing. */ - n = ip->ip_len / mtu + 1; /* how many fragments ? */ + n = ip_len / mtu + 1; /* how many fragments ? */ if ( #ifdef ALTQ (!ALTQ_IS_ENABLED(&ifp->if_snd)) && @@ -469,7 +470,7 @@ goto bad; } /* don't allow broadcast messages to be fragmented */ - if (ip->ip_len > mtu) { + if (ip_len > mtu) { error = EMSGSIZE; goto bad; } @@ -502,12 +503,6 @@ hlen = ip->ip_hl << 2; #endif /* IPSEC */ - /* - * To network byte order. pfil(9) hooks and ip_fragment() expect this. - */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - /* Jump over all PFIL processing if hooks are not active. */ if (!PFIL_HOOKED(&V_inet_pfil_hook)) goto passout; @@ -544,8 +539,6 @@ } else { if (ia != NULL) ifa_free(&ia->ia_ifa); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto again; /* Redo the routing table lookup. */ } } @@ -579,16 +572,11 @@ m_tag_delete(m, fwd_tag); if (ia != NULL) ifa_free(&ia->ia_ifa); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto again; } #endif /* IPFIREWALL_FORWARD */ passout: - ip_len = ntohs(ip->ip_len); - ip_off = ntohs(ip->ip_off); - /* 127/8 must not appear on wire - RFC1122. */ if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { @@ -1295,8 +1283,6 @@ * calls the output routine of the loopback "driver", but with an interface * pointer that might NOT be a loopback interface -- evil, but easier than * replicating that code here. - * - * IP header in host byte order. */ static void ip_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in *dst, @@ -1326,8 +1312,6 @@ * than the interface's MTU. Can this possibly matter? */ ip = mtod(copym, struct ip *); - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(copym, hlen); #if 1 /* XXX */ Index: sys/netinet/in_gif.c =================================================================== --- sys/netinet/in_gif.c (revision 241481) +++ sys/netinet/in_gif.c (working copy) @@ -192,7 +192,7 @@ iphdr.ip_p = proto; /* version will be set in ip_output() */ iphdr.ip_ttl = V_ip_gif_ttl; - iphdr.ip_len = m->m_pkthdr.len + sizeof(struct ip); + iphdr.ip_len = htons(m->m_pkthdr.len + sizeof(struct ip)); ip_ecn_ingress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED : ECN_NOCARE, &iphdr.ip_tos, &tos); Index: sys/netinet/ip_options.c =================================================================== --- sys/netinet/ip_options.c (revision 241481) +++ sys/netinet/ip_options.c (working copy) @@ -490,7 +490,7 @@ unsigned optlen; optlen = opt->m_len - sizeof(p->ipopt_dst); - if (optlen + ip->ip_len > IP_MAXPACKET) { + if (optlen + ntohs(ip->ip_len) > IP_MAXPACKET) { *phlen = 0; return (m); /* XXX should fail */ } @@ -523,7 +523,7 @@ *phlen = sizeof(struct ip) + optlen; ip->ip_v = IPVERSION; ip->ip_hl = *phlen >> 2; - ip->ip_len += optlen; + ip->ip_len = htons(ntohs(ip->ip_len) + optlen); return (m); } Index: sys/netinet/tcp_timewait.c =================================================================== --- sys/netinet/tcp_timewait.c (revision 241481) +++ sys/netinet/tcp_timewait.c (working copy) @@ -593,9 +593,9 @@ m->m_pkthdr.csum_flags = CSUM_TCP; th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(sizeof(struct tcphdr) + optlen + IPPROTO_TCP)); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); if (V_path_mtu_discovery) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); error = ip_output(m, inp->inp_options, NULL, ((tw->tw_so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), NULL, inp); Index: sys/netinet/tcp_output.c =================================================================== --- sys/netinet/tcp_output.c (revision 241481) +++ sys/netinet/tcp_output.c (working copy) @@ -1239,7 +1239,7 @@ struct route ro; bzero(&ro, sizeof(ro)); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); #ifdef INET6 if (tp->t_inpcb->inp_vflag & INP_IPV6PROTO) ip->ip_ttl = in6_selecthlim(tp->t_inpcb, NULL); @@ -1253,7 +1253,7 @@ * NB: Don't set DF on small MTU/MSS to have a safe fallback. */ if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss) - ip->ip_off |= IP_DF; + ip->ip_off |= htons(IP_DF); error = ip_output(m, tp->t_inpcb->inp_options, &ro, ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0, Index: sys/netinet/sctputil.c =================================================================== --- sys/netinet/sctputil.c (revision 241481) +++ sys/netinet/sctputil.c (working copy) @@ -6821,7 +6821,7 @@ switch (iph->ip_v) { #ifdef INET case IPVERSION: - iph->ip_len -= sizeof(struct udphdr); + iph->ip_len = ntohs(htons(iph->ip_len) - sizeof(struct udphdr)); sctp_input_with_port(m, off, port); break; #endif Index: sys/netinet/ip_input.c =================================================================== --- sys/netinet/ip_input.c (revision 241481) +++ sys/netinet/ip_input.c (working copy) @@ -390,9 +390,8 @@ m->m_flags &= ~M_FASTFWD_OURS; /* Set up some basics that will be used later. */ ip = mtod(m, struct ip *); - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); hlen = ip->ip_hl << 2; + ip_len = ntohs(ip->ip_len); goto ours; } @@ -513,8 +512,6 @@ #ifdef IPFIREWALL_FORWARD if (m->m_flags & M_FASTFWD_OURS) { m->m_flags &= ~M_FASTFWD_OURS; - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto ours; } if ((dchg = (m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL)) != 0) { @@ -523,20 +520,12 @@ * packets originally destined to us to some other directly * connected host. */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); ip_forward(m, dchg); return; } #endif /* IPFIREWALL_FORWARD */ passin: - /* - * From now and up to output pfil(9) processing in ip_output() - * the header is in host byte order. - */ - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); /* * Process options and, if not destined for us, @@ -732,20 +721,21 @@ * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. */ - if (ip->ip_off & (IP_MF | IP_OFFMASK)) { + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) { m = ip_reass(m); if (m == NULL) return; ip = mtod(m, struct ip *); /* Get the header length of the reassembled packet */ hlen = ip->ip_hl << 2; + ip_len = ntohs(ip->ip_len); } /* * Further protocols expect the packet length to be w/o the * IP header. */ - ip->ip_len -= hlen; + ip->ip_len = htons(ip_len - hlen); #ifdef IPSEC /* @@ -914,22 +904,21 @@ * Adjust ip_len to not reflect header, * convert offset of this to bytes. */ - ip->ip_len -= hlen; - if (ip->ip_off & IP_MF) { + ip->ip_len = htons(ntohs(ip->ip_len) - hlen); + if (ip->ip_off & htons(IP_MF)) { /* * Make sure that fragments have a data length * that's a non-zero multiple of 8 bytes. */ - if (ip->ip_len == 0 || (ip->ip_len & 0x7) != 0) { + if (ntohs(ip->ip_len) == 0 || (ntohs(ip->ip_len & 0x7) != 0)) { IPSTAT_INC(ips_toosmall); /* XXX */ goto dropfrag; } m->m_flags |= M_FRAG; } else m->m_flags &= ~M_FRAG; - ip->ip_off <<= 3; + ip->ip_off = htons(ntohs(ip->ip_off) << 3); - /* * Attempt reassembly; if it succeeds, proceed. * ip_reass() will return a different mbuf. @@ -1000,7 +989,7 @@ * Find a segment which begins after this one does. */ for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) - if (GETIP(q)->ip_off > ip->ip_off) + if (ntohs(GETIP(q)->ip_off) > ntohs(ip->ip_off)) break; /* @@ -1013,14 +1002,15 @@ * segment, then it's checksum is invalidated. */ if (p) { - i = GETIP(p)->ip_off + GETIP(p)->ip_len - ip->ip_off; + i = ntohs(GETIP(p)->ip_off) + ntohs(GETIP(p)->ip_len) - + ntohs(ip->ip_off); if (i > 0) { - if (i >= ip->ip_len) + if (i >= ntohs(ip->ip_len)) goto dropfrag; m_adj(m, i); m->m_pkthdr.csum_flags = 0; - ip->ip_off += i; - ip->ip_len -= i; + ip->ip_off = htons(ntohs(ip->ip_off) + i); + ip->ip_len = htons(ntohs(ip->ip_len) - i); } m->m_nextpkt = p->m_nextpkt; p->m_nextpkt = m; @@ -1033,12 +1023,13 @@ * While we overlap succeeding segments trim them or, * if they are completely covered, dequeue them. */ - for (; q != NULL && ip->ip_off + ip->ip_len > GETIP(q)->ip_off; - q = nq) { - i = (ip->ip_off + ip->ip_len) - GETIP(q)->ip_off; - if (i < GETIP(q)->ip_len) { - GETIP(q)->ip_len -= i; - GETIP(q)->ip_off += i; + for (; q != NULL && ntohs(ip->ip_off) + ntohs(ip->ip_len) > + ntohs(GETIP(q)->ip_off); q = nq) { + i = (ntohs(ip->ip_off) + ntohs(ip->ip_len)) - + ntohs(GETIP(q)->ip_off); + if (i < ntohs(GETIP(q)->ip_len)) { + GETIP(q)->ip_len = htons(ntohs(GETIP(q)->ip_len) - i); + GETIP(q)->ip_off = htons(ntohs(GETIP(q)->ip_off) + i); m_adj(q, i); q->m_pkthdr.csum_flags = 0; break; @@ -1062,14 +1053,14 @@ */ next = 0; for (p = NULL, q = fp->ipq_frags; q; p = q, q = q->m_nextpkt) { - if (GETIP(q)->ip_off != next) { + if (ntohs(GETIP(q)->ip_off) != next) { if (fp->ipq_nfrags > V_maxfragsperpacket) { IPSTAT_ADD(ips_fragdropped, fp->ipq_nfrags); ip_freef(head, fp); } goto done; } - next += GETIP(q)->ip_len; + next += ntohs(GETIP(q)->ip_len); } /* Make sure the last packet didn't have the IP_MF flag */ if (p->m_flags & M_FRAG) { @@ -1125,7 +1116,7 @@ * packet; dequeue and discard fragment reassembly header. * Make header visible. */ - ip->ip_len = (ip->ip_hl << 2) + next; + ip->ip_len = htons((ip->ip_hl << 2) + next); ip->ip_src = fp->ipq_src; ip->ip_dst = fp->ipq_dst; TAILQ_REMOVE(head, fp, ipq_list); @@ -1365,8 +1356,6 @@ * * The srcrt parameter indicates whether the packet is being forwarded * via a source route. - * - * IP header in host byte order. */ void ip_forward(struct mbuf *m, int srcrt) @@ -1436,7 +1425,7 @@ mcopy = NULL; } if (mcopy != NULL) { - mcopy->m_len = min(ip->ip_len, M_TRAILINGSPACE(mcopy)); + mcopy->m_len = min(ntohs(ip->ip_len), M_TRAILINGSPACE(mcopy)); mcopy->m_pkthdr.len = mcopy->m_len; m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t)); } @@ -1564,7 +1553,7 @@ if (ia != NULL) mtu = ia->ia_ifp->if_mtu; else - mtu = ip_next_mtu(ip->ip_len, 0); + mtu = ip_next_mtu(ntohs(ip->ip_len), 0); } IPSTAT_INC(ips_cantfrag); break; Index: sys/netinet/siftr.c =================================================================== --- sys/netinet/siftr.c (revision 241481) +++ sys/netinet/siftr.c (working copy) @@ -952,7 +952,8 @@ * the mbuf cluster "at" at offset "offset" bytes from * the beginning of the "at" mbuf's data pointer. */ - th->th_sum = in_cksum_skip(*m, ip->ip_len, ip_hl); + th->th_sum = in_cksum_skip(*m, ntohs(ip->ip_len), + ip_hl); } /* Index: sys/netinet/ip_icmp.c =================================================================== --- sys/netinet/ip_icmp.c (revision 241481) +++ sys/netinet/ip_icmp.c (working copy) @@ -229,7 +229,7 @@ */ if (n->m_flags & M_DECRYPTED) goto freeit; - if (oip->ip_off & ~(IP_MF|IP_DF)) + if (oip->ip_off & htons(~(IP_MF|IP_DF))) goto freeit; if (n->m_flags & (M_BCAST|M_MCAST)) goto freeit; @@ -263,16 +263,17 @@ tcphlen = th->th_off << 2; if (tcphlen < sizeof(struct tcphdr)) goto freeit; - if (oip->ip_len < oiphlen + tcphlen) + if (ntohs(oip->ip_len) < oiphlen + tcphlen) goto freeit; if (oiphlen + tcphlen > n->m_len && n->m_next == NULL) goto stdreply; if (n->m_len < oiphlen + tcphlen && ((n = m_pullup(n, oiphlen + tcphlen)) == NULL)) goto freeit; - icmpelen = max(tcphlen, min(V_icmp_quotelen, oip->ip_len - oiphlen)); + icmpelen = max(tcphlen, min(V_icmp_quotelen, + ntohs(oip->ip_len) - oiphlen)); } else -stdreply: icmpelen = max(8, min(V_icmp_quotelen, oip->ip_len - oiphlen)); +stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) - oiphlen)); icmplen = min(oiphlen + icmpelen, nlen); if (icmplen < sizeof(struct ip)) @@ -322,8 +323,6 @@ */ m_copydata(n, 0, icmplen, (caddr_t)&icp->icmp_ip); nip = &icp->icmp_ip; - nip->ip_len = htons(nip->ip_len); - nip->ip_off = htons(nip->ip_off); /* * Set up ICMP message mbuf and copy old IP header (without options @@ -338,7 +337,7 @@ m->m_pkthdr.rcvif = n->m_pkthdr.rcvif; nip = mtod(m, struct ip *); bcopy((caddr_t)oip, (caddr_t)nip, sizeof(struct ip)); - nip->ip_len = m->m_len; + nip->ip_len = htons(m->m_len); nip->ip_v = IPVERSION; nip->ip_hl = 5; nip->ip_p = IPPROTO_ICMP; @@ -360,7 +359,7 @@ struct ip *ip = mtod(m, struct ip *); struct sockaddr_in icmpsrc, icmpdst, icmpgw; int hlen = off; - int icmplen = ip->ip_len; + int icmplen = ntohs(ip->ip_len); int i, code; void (*ctlfunc)(int, struct sockaddr *, void *); int fibnum; @@ -501,7 +500,6 @@ ICMPSTAT_INC(icps_badlen); goto freeit; } - icp->icmp_ip.ip_len = ntohs(icp->icmp_ip.ip_len); /* Discard ICMP's in response to multicast packets */ if (IN_MULTICAST(ntohl(icp->icmp_ip.ip_dst.s_addr))) goto badcode; @@ -594,7 +592,8 @@ } ifa_free(&ia->ia_ifa); reflect: - ip->ip_len += hlen; /* since ip_input deducts this */ + /* Since ip_input() deducts this. */ + ip->ip_len = htons(ntohs(ip->ip_len) + hlen); ICMPSTAT_INC(icps_reflect); ICMPSTAT_INC(icps_outhist[icp->icmp_type]); icmp_reflect(m); @@ -864,7 +863,7 @@ * Now strip out original options by copying rest of first * mbuf's data back, and adjust the IP length. */ - ip->ip_len -= optlen; + ip->ip_len = htons(ntohs(ip->ip_len) - optlen); ip->ip_v = IPVERSION; ip->ip_hl = 5; m->m_len -= optlen; @@ -898,7 +897,7 @@ m->m_len -= hlen; icp = mtod(m, struct icmp *); icp->icmp_cksum = 0; - icp->icmp_cksum = in_cksum(m, ip->ip_len - hlen); + icp->icmp_cksum = in_cksum(m, ntohs(ip->ip_len) - hlen); m->m_data -= hlen; m->m_len += hlen; m->m_pkthdr.rcvif = (struct ifnet *)0; Index: sys/netinet/ip_gre.c =================================================================== --- sys/netinet/ip_gre.c (revision 241481) +++ sys/netinet/ip_gre.c (working copy) @@ -274,12 +274,10 @@ /* * On FreeBSD, rip_input() supplies us with ip->ip_len - * already converted into host byteorder and also decreases - * it by the lengh of IP header, however, ip_input() expects - * that this field is in the original format (network byteorder - * and full size of IP packet), so that adjust accordingly. + * decreased by the lengh of IP header, however, ip_input() + * expects it to be full size of IP packet, so adjust accordingly. */ - ip->ip_len = htons(ip->ip_len + sizeof(struct ip) - msiz); + ip->ip_len = htons(ntohs(ip->ip_len) + sizeof(struct ip) - msiz); ip->ip_sum = 0; ip->ip_sum = in_cksum(m, (ip->ip_hl << 2)); Index: sys/netinet/ip_ipsec.c =================================================================== --- sys/netinet/ip_ipsec.c (revision 241481) +++ sys/netinet/ip_ipsec.c (working copy) @@ -264,7 +264,6 @@ { #ifdef IPSEC struct secpolicy *sp = NULL; - struct ip *ip = mtod(*m, struct ip *); struct tdb_ident *tdbi; struct m_tag *mtag; int s; @@ -332,9 +331,6 @@ } } - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); - /* * Do delayed checksums now because we send before * this is done in the normal processing path. @@ -345,6 +341,8 @@ } #ifdef SCTP if ((*m)->m_pkthdr.csum_flags & CSUM_SCTP) { + struct ip *ip = mtod(*m, struct ip *); + sctp_delayed_cksum(*m, (uint32_t)(ip->ip_hl << 2)); (*m)->m_pkthdr.csum_flags &= ~CSUM_SCTP; } @@ -359,8 +357,6 @@ * IPsec processing and return without error. */ *error = 0; - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); goto done; } /* Index: sys/netinet/ip_mroute.c =================================================================== --- sys/netinet/ip_mroute.c (revision 241481) +++ sys/netinet/ip_mroute.c (working copy) @@ -1493,7 +1493,7 @@ { struct ip *ip = mtod(m, struct ip *); vifi_t vifi; - int plen = ip->ip_len; + int plen = ntohs(ip->ip_len); VIF_LOCK_ASSERT(); @@ -2376,10 +2376,7 @@ /* Take care of delayed checksums */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - /* XXX: in_delayed_cksum() expects net byte order */ - ip->ip_len = htons(ip->ip_len); in_delayed_cksum(m); - ip->ip_len = ntohs(ip->ip_len); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } @@ -2401,10 +2398,8 @@ /* Compute the MTU after the PIM Register encapsulation */ mtu = 0xffff - sizeof(pim_encap_iphdr) - sizeof(pim_encap_pimhdr); - if (ip->ip_len <= mtu) { + if (ntohs(ip->ip_len) <= mtu) { /* Turn the IP header into a valid one */ - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(mb_copy, ip->ip_hl << 2); } else { @@ -2509,7 +2504,8 @@ ip_outer = mtod(mb_first, struct ip *); *ip_outer = pim_encap_iphdr; ip_outer->ip_id = ip_newid(); - ip_outer->ip_len = len + sizeof(pim_encap_iphdr) + sizeof(pim_encap_pimhdr); + ip_outer->ip_len = htons(len + sizeof(pim_encap_iphdr) + + sizeof(pim_encap_pimhdr)); ip_outer->ip_src = V_viftable[vifi].v_lcl_addr; ip_outer->ip_dst = rt->mfc_rp; /* @@ -2517,8 +2513,8 @@ * IP_DF bit. */ ip_outer->ip_tos = ip->ip_tos; - if (ntohs(ip->ip_off) & IP_DF) - ip_outer->ip_off |= IP_DF; + if (ip->ip_off & htons(IP_DF)) + ip_outer->ip_off |= htons(IP_DF); pimhdr = (struct pim_encap_pimhdr *)((caddr_t)ip_outer + sizeof(pim_encap_iphdr)); *pimhdr = pim_encap_pimhdr; @@ -2571,7 +2567,7 @@ struct ip *ip = mtod(m, struct ip *); struct pim *pim; int minlen; - int datalen = ip->ip_len; + int datalen = ntohs(ip->ip_len); int ip_tos; int iphlen = off; Index: sys/netinet/sctp_output.c =================================================================== --- sys/netinet/sctp_output.c (revision 241481) +++ sys/netinet/sctp_output.c (working copy) @@ -3980,15 +3980,15 @@ tos_value |= sctp_get_ect(stcb); } if ((nofragment_flag) && (port == 0)) { - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); } else - ip->ip_off = 0; + ip->ip_off = htons(0); /* FreeBSD has a function for ip_id's */ ip->ip_id = ip_newid(); ip->ip_ttl = inp->ip_inp.inp.inp_ip_ttl; - ip->ip_len = packet_length; + ip->ip_len = htons(packet_length); ip->ip_tos = tos_value; if (port) { ip->ip_p = IPPROTO_UDP; @@ -10991,7 +10991,7 @@ udp->uh_sum = 0; } } - ip->ip_len = len; + ip->ip_len = htons(len); if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); Index: sys/netinet/igmp.c =================================================================== --- sys/netinet/igmp.c (revision 241481) +++ sys/netinet/igmp.c (working copy) @@ -1442,7 +1442,7 @@ ip = mtod(m, struct ip *); iphlen = off; - igmplen = ip->ip_len; + igmplen = ntohs(ip->ip_len); /* * Validate lengths. @@ -2225,7 +2225,7 @@ ip = mtod(m, struct ip *); ip->ip_tos = 0; - ip->ip_len = sizeof(struct ip) + sizeof(struct igmp); + ip->ip_len = htons(sizeof(struct ip) + sizeof(struct igmp)); ip->ip_off = 0; ip->ip_p = IPPROTO_IGMP; ip->ip_src.s_addr = INADDR_ANY; @@ -3522,8 +3522,8 @@ ip = mtod(m, struct ip *); ip->ip_tos = IPTOS_PREC_INTERNETCONTROL; - ip->ip_len = hdrlen + igmpreclen; - ip->ip_off = IP_DF; + ip->ip_len = htons(hdrlen + igmpreclen); + ip->ip_off = htons(IP_DF); ip->ip_p = IPPROTO_IGMP; ip->ip_sum = 0; Index: sys/netinet6/ip6_ipsec.c =================================================================== --- sys/netinet6/ip6_ipsec.c (revision 241481) +++ sys/netinet6/ip6_ipsec.c (working copy) @@ -295,15 +295,9 @@ */ #ifdef INET if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - struct ip *ip; - ipseclog((LOG_DEBUG, "%s: we do not support IPv4 over IPv6", __func__)); - /* XXX: in_delayed_cksum() expects net byte order */ - ip = mtod(*m, struct ip *); - ip->ip_len = htons(ip->ip_len); in_delayed_cksum(*m); - ip->ip_len = ntohs(ip->ip_len); (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } #endif Index: sys/netpfil/pf/pf.c =================================================================== --- sys/netpfil/pf/pf.c (revision 241481) +++ sys/netpfil/pf/pf.c (working copy) @@ -2252,8 +2252,8 @@ h->ip_v = 4; h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; - h->ip_off = V_path_mtu_discovery ? IP_DF : 0; - h->ip_len = len; + h->ip_off = htons(V_path_mtu_discovery ? IP_DF : 0); + h->ip_len = htons(len); h->ip_ttl = ttl ? ttl : V_ip_defttl; h->ip_sum = 0; @@ -2316,17 +2316,8 @@ switch (af) { #ifdef INET case AF_INET: - { - struct ip *ip; - - /* icmp_error() expects host byte ordering */ - ip = mtod(m0, struct ip *); - NTOHS(ip->ip_len); - NTOHS(ip->ip_off); - pfse->pfse_type = PFSE_ICMP; break; - } #endif /* INET */ #ifdef INET6 case AF_INET6: Index: sys/netpfil/pf/if_pfsync.c =================================================================== --- sys/netpfil/pf/if_pfsync.c (revision 241481) +++ sys/netpfil/pf/if_pfsync.c (working copy) @@ -1384,7 +1384,7 @@ ip->ip_hl = sizeof(sc->sc_template) >> 2; ip->ip_tos = IPTOS_LOWDELAY; /* len and id are set later. */ - ip->ip_off = IP_DF; + ip->ip_off = htons(IP_DF); ip->ip_ttl = PFSYNC_DFLTTL; ip->ip_p = IPPROTO_PFSYNC; ip->ip_src.s_addr = INADDR_ANY; @@ -1522,7 +1522,7 @@ bcopy(&sc->sc_template, ip, sizeof(*ip)); offset = sizeof(*ip); - ip->ip_len = m->m_pkthdr.len; + ip->ip_len = htons(m->m_pkthdr.len); ip->ip_id = htons(ip_randomid()); /* build the pfsync header */ Index: sys/netpfil/ipfw/ip_fw_dynamic.c =================================================================== --- sys/netpfil/ipfw/ip_fw_dynamic.c (revision 241481) +++ sys/netpfil/ipfw/ip_fw_dynamic.c (working copy) @@ -1016,9 +1016,8 @@ h->ip_v = 4; h->ip_hl = sizeof(*h) >> 2; h->ip_tos = IPTOS_LOWDELAY; - h->ip_off = 0; - /* ip_len must be in host format for ip_output */ - h->ip_len = len; + h->ip_off = htons(0); + h->ip_len = htons(len); h->ip_ttl = V_ip_defttl; h->ip_sum = 0; break; Index: sys/netpfil/ipfw/ip_fw_pfil.c =================================================================== --- sys/netpfil/ipfw/ip_fw_pfil.c (revision 241481) +++ sys/netpfil/ipfw/ip_fw_pfil.c (working copy) @@ -431,7 +431,6 @@ int hlen; struct mbuf *reass; - SET_HOST_IPLEN(ip); /* ip_reass wants host order */ reass = ip_reass(clone); /* Reassemble packet. */ if (reass == NULL) return 0; /* not an error */ @@ -442,7 +441,6 @@ */ ip = mtod(reass, struct ip *); hlen = ip->ip_hl << 2; - SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Index: sys/netpfil/ipfw/ip_dn_io.c =================================================================== --- sys/netpfil/ipfw/ip_dn_io.c (revision 241481) +++ sys/netpfil/ipfw/ip_dn_io.c (working copy) @@ -658,13 +658,10 @@ switch (dst) { case DIR_OUT: - SET_HOST_IPLEN(mtod(m, struct ip *)); ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL); break ; case DIR_IN : - /* put header in network format for ip_input() */ - //SET_NET_IPLEN(mtod(m, struct ip *)); netisr_dispatch(NETISR_IP, m); break; Index: sys/netpfil/ipfw/ip_fw2.c =================================================================== --- sys/netpfil/ipfw/ip_fw2.c (revision 241481) +++ sys/netpfil/ipfw/ip_fw2.c (working copy) @@ -627,8 +627,6 @@ m_adj(m, args->L3offset); #endif if (code != ICMP_REJECT_RST) { /* Send an ICMP unreach */ - /* We need the IP header in host order for icmp_error(). */ - SET_HOST_IPLEN(ip); icmp_error(args->m, ICMP_UNREACH, code, 0L, 0); } else if (args->f_id.proto == IPPROTO_TCP) { struct tcphdr *const tcp = @@ -2418,11 +2416,6 @@ /* if not fragmented, go to next rule */ if ((ip_off & (IP_MF | IP_OFFMASK)) == 0) break; - /* - * ip_reass() expects len & off in host - * byte order. - */ - SET_HOST_IPLEN(ip); args->m = m = ip_reass(m); @@ -2436,7 +2429,6 @@ ip = mtod(m, struct ip *); hlen = ip->ip_hl << 2; - SET_NET_IPLEN(ip); ip->ip_sum = 0; if (hlen == sizeof(struct ip)) ip->ip_sum = in_cksum_hdr(ip); Index: sys/netipsec/ipsec.c =================================================================== --- sys/netipsec/ipsec.c (revision 241481) +++ sys/netipsec/ipsec.c (working copy) @@ -597,10 +597,9 @@ IPSEC_ASSERT(m != NULL, ("null mbuf")); IPSEC_ASSERT(m->m_pkthdr.len >= sizeof(struct ip),("packet too short")); - /* NB: ip_input() flips it into host endian. XXX Need more checking. */ if (m->m_len >= sizeof (struct ip)) { struct ip *ip = mtod(m, struct ip *); - if (ip->ip_off & (IP_MF | IP_OFFMASK)) + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) goto done; #ifdef _IP_VHL off = _IP_VHL_HL(ip->ip_vhl) << 2; @@ -612,7 +611,7 @@ struct ip ih; m_copydata(m, 0, sizeof (struct ip), (caddr_t) &ih); - if (ih.ip_off & (IP_MF | IP_OFFMASK)) + if (ih.ip_off & htons(IP_MF | IP_OFFMASK)) goto done; #ifdef _IP_VHL off = _IP_VHL_HL(ih.ip_vhl) << 2; Index: sys/netgraph/ng_ipfw.c =================================================================== --- sys/netgraph/ng_ipfw.c (revision 241481) +++ sys/netgraph/ng_ipfw.c (working copy) @@ -265,7 +265,6 @@ switch (ip->ip_v) { #ifdef INET case IPVERSION: - SET_HOST_IPLEN(ip); return (ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL)); #endif Index: sys/net/if_stf.c =================================================================== --- sys/net/if_stf.c (revision 241481) +++ sys/net/if_stf.c (working copy) @@ -523,7 +523,7 @@ bcopy(&in4, &ip->ip_dst, sizeof(ip->ip_dst)); ip->ip_p = IPPROTO_IPV6; ip->ip_ttl = ip_stf_ttl; - ip->ip_len = m->m_pkthdr.len; /*host order*/ + ip->ip_len = htons(m->m_pkthdr.len); if (ifp->if_flags & IFF_LINK1) ip_ecn_ingress(ECN_ALLOWED, &ip->ip_tos, &tos); else Index: sys/net/if_gre.c =================================================================== --- sys/net/if_gre.c (revision 241481) +++ sys/net/if_gre.c (working copy) @@ -356,7 +356,7 @@ * RFC2004 specifies that fragmented diagrams shouldn't * be encapsulated. */ - if (ip->ip_off & (IP_MF | IP_OFFMASK)) { + if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) { _IF_DROP(&ifp->if_snd); m_freem(m); error = EINVAL; /* is there better errno? */ @@ -410,7 +410,7 @@ } ip = mtod(m, struct ip *); memcpy((caddr_t)(ip + 1), &mob_h, (unsigned)msiz); - ip->ip_len = ntohs(ip->ip_len) + msiz; + ip->ip_len = htons(ntohs(ip->ip_len) + msiz); } else { /* AF_INET */ _IF_DROP(&ifp->if_snd); m_freem(m); @@ -493,7 +493,7 @@ ((struct ip*)gh)->ip_ttl = GRE_TTL; ((struct ip*)gh)->ip_tos = gre_ip_tos; ((struct ip*)gh)->ip_id = gre_ip_id; - gh->gi_len = m->m_pkthdr.len; + gh->gi_len = htons(m->m_pkthdr.len); } ifp->if_opackets++; --Izn7cH1Com+I3R9J-- From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 13:54:52 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2F80DF99; Fri, 12 Oct 2012 13:54:52 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx1.freebsd.org (Postfix) with ESMTP id C54F28FC0A; Fri, 12 Oct 2012 13:54:51 +0000 (UTC) Received: by mail-ie0-f182.google.com with SMTP id k10so6289728iea.13 for ; Fri, 12 Oct 2012 06:54:50 -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=wHTztVl0ei7EuNbrI51YHC0fqd3WZSkJEpNNt/K0BW8=; b=I9IU8qdV3Ttia4+klb2bfMgGSZu9rhxFkwnx4uJbGNU/5k+eidDuR+iUJraOvCoKU7 K9SdYmvXYq0jzp3loHWdEfzaaJ28DMJThEQ85W6Cqv7O0tQAgPw747ZfsjUs4bxFc8T4 zQguxYQ/CkbegLUt3IYmK9UN0XPljPotAZv+uxpvNxpQHJ3QtSvxTrd+D3j+xiNkyO3c gn7Ut6o9C3A5nTaYxJFkfjaZc8bX07H4h7BweFCd1XJkcio2laT1GMZKUBKcM1Aj/EHi IuMc1WqlH9wbXpvly+67ZdQrVNtK1JLfN8psTvRRC9/2fZKysWvpRl8cuFI62Xj08zuS l+/g== Received: by 10.50.236.74 with SMTP id us10mr2366636igc.5.1350050090407; Fri, 12 Oct 2012 06:54:50 -0700 (PDT) Received: from [192.168.221.83] ([216.81.189.9]) by mx.google.com with ESMTPS id uq6sm1541017igb.14.2012.10.12.06.54.48 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Oct 2012 06:54:49 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: 8.3: kernel panic in bpf.c catchpacket() From: Guy Helmer In-Reply-To: <5075C05E.9070800@FreeBSD.org> Date: Fri, 12 Oct 2012 08:54:45 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <1EDA1615-2CDE-405A-A725-AF7CC7D3E273@gmail.com> References: <4B5399BF-4EE0-4182-8297-3BB97C4AA884@gmail.com> <59F9A36E-3DB2-4F6F-BB2A-A4C9DA76A70C@gmail.com> <5075C05E.9070800@FreeBSD.org> To: "Alexander V. Chernikov" X-Mailer: Apple Mail (2.1499) Cc: freebsd-net@freebsd.org, FreeBSD Stable 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: Fri, 12 Oct 2012 13:54:52 -0000 On Oct 10, 2012, at 1:37 PM, Alexander V. Chernikov = wrote: > On 10.10.2012 00:36, Guy Helmer wrote: >>=20 >> On Oct 8, 2012, at 8:09 AM, Guy Helmer wrote: >>=20 >>> I'm seeing a consistent new kernel panic in FreeBSD 8.3: >>> I'm not seeing how bd_sbuf would be NULL here. Any ideas? >>=20 >> Since I've not had any replies, I hope nobody minds if I reply with = more information. >>=20 >> This panic seems to be occasionally triggered now that my user land = code is changing the packet filter a while after the bpd device has been = opened and an initial packet filter was set (previously, my code did not = change the filter after it was initially set). >>=20 >> I'm focusing on bpf_setf() since that seems to be the place that = could be tickling a problem, and I see that bpf_setf() calls reset_d(d) = to clear the hold buffer. I have manually verified that the BPFD lock is = held during the call to reset_d(), and the lock is held every other = place that the buffers are manipulated, so I haven't been able to find = any place that seems vulnerable to losing one of the bpf buffers. Still = searching, but any help would be appreciated. >=20 > Can you please check this code on -current? > Locking has changed quite significantly some time ago, so there is = good chance that you can get rid of this panic (or discover different = one which is really "new") :). I'm not ready to run this app on current, so I have merged revs 229898, = 233937, 233938, 233946, 235744, 235745, 235746, 235747, 236231, 236251, = 236261, 236262, 236559, and 236806 to my 8.3 checkout to get code that = should be virtually identical to current without the timestamp changes. Unfortunately, I have only been able to trigger the panic in my test lab = once -- so I'm not sure whether a lack of problems with the updated code = will be indicative of likely success in the field where this has been = trigged regularly at some sites=85 Thanks, Guy From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 14:35:57 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3360676 for ; Fri, 12 Oct 2012 14:35:57 +0000 (UTC) (envelope-from eugene@imedia.ru) Received: from mx2.imedia.ru (mx2.imedia.ru [91.230.26.134]) by mx1.freebsd.org (Postfix) with ESMTP id 748888FC0A for ; Fri, 12 Oct 2012 14:35:55 +0000 (UTC) X-All-Recipients: X-DKIM: OpenDKIM Filter v2.5.0 mx2.imedia.ru q9CECc3L067042 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=imedia.ru; s=common; t=1350051158; bh=2ufKrUSLDbqXwW6ZF+CeIvwDKhpJ9PB/CfkrfipDAwE=; h=From:Reply-To:To:Subject:Date; b=RHuo7MFMS1MjzXXje4XUSEX3yxKnqBI2cVB+A6UAp3mEm9nd7eo7Xl7BFatcsaddg u0hTo7HB9mpZ9f9e2TreJV597mT/qsObYfT6ZlruqovDYMBBThof2byEzi3nSRlrKT MdftnCQgg7qTqv+XR4rTvNoPvLa5ofe5rdpUtngA= Received: from badger.imedia.ru (root@badger.imedia.ru [10.167.1.243]) by mx2.imedia.ru (8.14.3/8.14.3/TWINS7_LDAP) with ESMTP id q9CECc3L067042 for ; Fri, 12 Oct 2012 18:12:38 +0400 (MSK) (envelope-from eugene@imedia.ru) Received: from badger.imedia.ru (eugene@localhost [127.0.0.1]) by badger.imedia.ru (8.14.5/8.14.4) with ESMTP id q9CECbsU065711 for ; Fri, 12 Oct 2012 18:12:37 +0400 (MSK) (envelope-from eugene@imedia.ru) Received: from localhost (localhost [[UNIX: localhost]]) by badger.imedia.ru (8.14.5/8.14.4/Submit) id q9CECb9g065710 for freebsd-net@freebsd.org; Fri, 12 Oct 2012 18:12:37 +0400 (MSK) (envelope-from eugene@imedia.ru) X-Authentication-Warning: badger.imedia.ru: eugene set sender to eugene@imedia.ru using -f From: Eugene Mitrofanov Organization: Sanoma Independent Media To: freebsd-net@freebsd.org Subject: dev.bce.3.mbuf_alloc_failed_count increases permanently Date: Fri, 12 Oct 2012 18:12:37 +0400 User-Agent: KMail/1.9.10 X-Origin: badger.imedia.ru MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201210121812.37557.eugene@imedia.ru> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (mx2.imedia.ru [10.167.0.252]); Fri, 12 Oct 2012 18:12:38 +0400 (MSK) X-Virus-Scanned: clamav-milter 0.97.4-exp at lynx.imedia.ru X-Virus-Status: Clean X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Eugene Mitrofanov List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 14:35:57 -0000 Hello FreeBSD 8.2-p3. I observed a strange behaviour sysctl -a | g bce.3|g -vE '(%|stat)'; echo; sleep 10; sysctl -a | g bce.3| g -vE '(%|stat)'; echo; netstat -m dev.bce.3.l2fhdr_error_count: 0 dev.bce.3.mbuf_alloc_failed_count: 2098854 dev.bce.3.mbuf_frag_count: 2655285 dev.bce.3.dma_map_addr_rx_failed_count: 0 dev.bce.3.dma_map_addr_tx_failed_count: 57 dev.bce.3.unexpected_attention_count: 0 dev.bce.3.com_no_buffers: 0 dev.bce.3.l2fhdr_error_count: 0 dev.bce.3.mbuf_alloc_failed_count: 2098856 dev.bce.3.mbuf_frag_count: 2655288 dev.bce.3.dma_map_addr_rx_failed_count: 0 dev.bce.3.dma_map_addr_tx_failed_count: 57 dev.bce.3.unexpected_attention_count: 0 dev.bce.3.com_no_buffers: 0 3022/18143/21165 mbufs in use (current/cache/total) 2039/9179/11218/65536 mbuf clusters in use (current/cache/total/max) 1678/3731 mbuf+clusters out of packet secondary zone in use (current/cache) 0/1672/1672/12800 4k (page size) jumbo clusters in use (current/cache/total/max) 0/1763/1763/6400 9k jumbo clusters in use (current/cache/total/max) 0/0/0/3200 16k jumbo clusters in use (current/cache/total/max) 4833K/45448K/50282K bytes allocated to network (current/cache/total) 0/0/0 requests for mbufs denied (mbufs/clusters/mbuf+clusters) 0/0/0 requests for jumbo clusters denied (4k/9k/16k) 0/0/0 sfbufs in use (current/peak/max) 0 requests for sfbufs denied 0 requests for sfbufs delayed 59058137 requests for I/O initiated by sendfile 0 calls to protocol drain routines Any suggestions? What is the reason of this? -- EVM7-RIPE From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 16:13:30 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 7ABEAD48 for ; Fri, 12 Oct 2012 16:13:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 058C68FC1B for ; Fri, 12 Oct 2012 16:13:27 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B6AFDB924 for ; Fri, 12 Oct 2012 12:13:11 -0400 (EDT) From: John Baldwin To: net@freebsd.org Subject: Dropping TCP options from retransmitted SYNs considered harmful Date: Fri, 12 Oct 2012 12:13:11 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p20; KDE/4.5.5; amd64; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201210121213.11152.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 12 Oct 2012 12:13:11 -0400 (EDT) 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: Fri, 12 Oct 2012 16:13:30 -0000 Back in 2001 FreeBSD added a hack to strip TCP options from retransmitted SYNs starting with the 3rd SYN in this block in tcp_timer.c: /* * Disable rfc1323 if we haven't got any response to * our third SYN to work-around some broken terminal servers * (most of which have hopefully been retired) that have bad VJ * header compression code which trashes TCP segments containing * unknown-to-them TCP options. */ if ((tp->t_state == TCPS_SYN_SENT) && (tp->t_rxtshift == 3)) tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP); There is even a PR for the original bug report: kern/1689 However, there is an unintended consequence of this change that can be disastrous. Specifically, suppose you have a FreeBSD client connecting to a server, and that the SYNs are arriving at the server successfully, but the first few return SYN/ACKs are dropped. Eventually a SYN/ACK makes it through and the connection is established. The server (based on the first SYN it saw) believes it has negotiated window scaling with the client. The client, however, has broken what it promised in that first SYN and believes it is not using any window scaling at all. This causes two forms of breakage: 1) When the server advertises a scaled window (e.g. '8' for a 64k window scaled at 13), the client thinks it is an unscaled window ('8') and sends data to the server very slowly. 2) When the client advertises an unscaled window (e.g. '65535' for a 64k window), the server thinks it has a huge window (65535 << 13 == 511MB) to send into. I'm not sure that 2) is a problem per se, but I have definitely seen instances of 1) (and examined the 'struct tcpcb' in kgdb on both the server and client end of the connections to verify they disagreed on the scaling). The original motivation of this change is to work around broken terminal servers that were old when this change was added in 2001. Over 10 years later I think we should at least have an option to turn this work-around off, and possibly disable it by default. Thoughts? -- John Baldwin From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 18:15:05 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 B8F06123; Fri, 12 Oct 2012 18:15:05 +0000 (UTC) (envelope-from gnn@neville-neil.com) Received: from vps.hungerhost.com (vps.hungerhost.com [216.38.53.176]) by mx1.freebsd.org (Postfix) with ESMTP id 6EC898FC12; Fri, 12 Oct 2012 18:15:05 +0000 (UTC) Received: from [209.249.190.124] (port=60501 helo=gnnmac.hudson-trading.com) by vps.hungerhost.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.80) (envelope-from ) id 1TMjlI-0006qs-2k; Fri, 12 Oct 2012 14:15:04 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: Dropping TCP options from retransmitted SYNs considered harmful From: George Neville-Neil In-Reply-To: <201210121213.11152.jhb@freebsd.org> Date: Fri, 12 Oct 2012 14:15:04 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <3DBAA027-B5D9-44AA-A00D-0496985D4FEA@neville-neil.com> References: <201210121213.11152.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1499) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.hungerhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - neville-neil.com 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: Fri, 12 Oct 2012 18:15:05 -0000 On Oct 12, 2012, at 12:13 , John Baldwin wrote: > Back in 2001 FreeBSD added a hack to strip TCP options from = retransmitted SYNs=20 > starting with the 3rd SYN in this block in tcp_timer.c: >=20 > /* > * Disable rfc1323 if we haven't got any response to > * our third SYN to work-around some broken terminal servers > * (most of which have hopefully been retired) that have bad VJ > * header compression code which trashes TCP segments containing > * unknown-to-them TCP options. > */ > if ((tp->t_state =3D=3D TCPS_SYN_SENT) && (tp->t_rxtshift =3D=3D = 3)) > tp->t_flags &=3D ~(TF_REQ_SCALE|TF_REQ_TSTMP); >=20 > There is even a PR for the original bug report: kern/1689 >=20 > However, there is an unintended consequence of this change that can be=20= > disastrous. Specifically, suppose you have a FreeBSD client = connecting to a=20 > server, and that the SYNs are arriving at the server successfully, but = the=20 > first few return SYN/ACKs are dropped. Eventually a SYN/ACK makes it = through=20 > and the connection is established. >=20 > The server (based on the first SYN it saw) believes it has negotiated = window=20 > scaling with the client. The client, however, has broken what it = promised in=20 > that first SYN and believes it is not using any window scaling at all. = This=20 > causes two forms of breakage: >=20 > 1) When the server advertises a scaled window (e.g. '8' for a 64k = window > scaled at 13), the client thinks it is an unscaled window ('8') and > sends data to the server very slowly. >=20 > 2) When the client advertises an unscaled window (e.g. '65535' for a = 64k > window), the server thinks it has a huge window (65535 << 13 =3D=3D = 511MB) > to send into. >=20 > I'm not sure that 2) is a problem per se, but I have definitely seen = instances=20 > of 1) (and examined the 'struct tcpcb' in kgdb on both the server and = client=20 > end of the connections to verify they disagreed on the scaling). >=20 > The original motivation of this change is to work around broken = terminal=20 > servers that were old when this change was added in 2001. Over 10 = years later=20 > I think we should at least have an option to turn this work-around = off, and=20 > possibly disable it by default. >=20 > Thoughts? >=20 I'm all for taking that code out. Best, George From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 19:00:07 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F38B37A; Fri, 12 Oct 2012 19:00:07 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mx.techwires.net (mx.techwires.net [79.140.39.242]) by mx1.freebsd.org (Postfix) with ESMTP id F2D3B8FC08; Fri, 12 Oct 2012 19:00:06 +0000 (UTC) Received: from amy.lab.techwires.net (dslb-088-065-056-134.pools.arcor-ip.net [88.65.56.134]) by mx.techwires.net (Postfix) with ESMTPSA id 2EB1C297560; Fri, 12 Oct 2012 21:00:00 +0200 (CEST) From: Bernhard Schmidt To: "Ronald F. Guilmette" Subject: Re: Oops! (was: Support for Intel 5100 WiFi ?) Date: Fri, 12 Oct 2012 21:00:07 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.1-PRERELEASE; KDE/4.7.4; amd64; ; ) References: <71855.1349997081@tristatelogic.com> In-Reply-To: <71855.1349997081@tristatelogic.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201210122100.07216.bschmidt@techwires.net> Cc: freebsd-net@freebsd.org, Adrian Chadd 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: Fri, 12 Oct 2012 19:00:07 -0000 On Friday 12 October 2012 01:11:21 Ronald F. Guilmette wrote: > > In message > , you wrote: > > >What's the output of 'ifconfig wlanX list sta'? > > % ifconfig wlan0 list sta > ADDR AID CHAN RATE RSSI IDLE TXSEQ RXSEQ CAPS FLAG > c0:c1:c0:8b:4b:f3 1 11 36M 11.5 0 85 37120 EP AQEHTRS RSN HTCAP WPS WME This is the expected result. iwn(4) still (ab)uses the legacy rate control algo for 11n. This means that you get the real 11n throughput because the legacy rates are translated to MCS rates, but, the reported rates are still legacy. -- Bernhard From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 20:24:41 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 531A72B5; Fri, 12 Oct 2012 20:24:41 +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 BE0088FC12; Fri, 12 Oct 2012 20:24:40 +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 q9CKOXtd003619; Sat, 13 Oct 2012 00:24:33 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9CKOWVM003618; Sat, 13 Oct 2012 00:24:32 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Sat, 13 Oct 2012 00:24:32 +0400 From: Gleb Smirnoff To: George Neville-Neil Subject: Re: Dropping TCP options from retransmitted SYNs considered harmful Message-ID: <20121012202432.GZ89655@FreeBSD.org> References: <201210121213.11152.jhb@freebsd.org> <3DBAA027-B5D9-44AA-A00D-0496985D4FEA@neville-neil.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <3DBAA027-B5D9-44AA-A00D-0496985D4FEA@neville-neil.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: John Baldwin , 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: Fri, 12 Oct 2012 20:24:41 -0000 On Fri, Oct 12, 2012 at 02:15:04PM -0400, George Neville-Neil wrote: G> > Back in 2001 FreeBSD added a hack to strip TCP options from retransmitted SYNs G> > starting with the 3rd SYN in this block in tcp_timer.c: G> > G> > /* G> > * Disable rfc1323 if we haven't got any response to G> > * our third SYN to work-around some broken terminal servers G> > * (most of which have hopefully been retired) that have bad VJ G> > * header compression code which trashes TCP segments containing G> > * unknown-to-them TCP options. G> > */ G> > if ((tp->t_state == TCPS_SYN_SENT) && (tp->t_rxtshift == 3)) G> > tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP); G> > G> > There is even a PR for the original bug report: kern/1689 G> > G> > However, there is an unintended consequence of this change that can be G> > disastrous. Specifically, suppose you have a FreeBSD client connecting to a G> > server, and that the SYNs are arriving at the server successfully, but the G> > first few return SYN/ACKs are dropped. Eventually a SYN/ACK makes it through G> > and the connection is established. G> > G> > The server (based on the first SYN it saw) believes it has negotiated window G> > scaling with the client. The client, however, has broken what it promised in G> > that first SYN and believes it is not using any window scaling at all. This G> > causes two forms of breakage: G> > G> > 1) When the server advertises a scaled window (e.g. '8' for a 64k window G> > scaled at 13), the client thinks it is an unscaled window ('8') and G> > sends data to the server very slowly. G> > G> > 2) When the client advertises an unscaled window (e.g. '65535' for a 64k G> > window), the server thinks it has a huge window (65535 << 13 == 511MB) G> > to send into. G> > G> > I'm not sure that 2) is a problem per se, but I have definitely seen instances G> > of 1) (and examined the 'struct tcpcb' in kgdb on both the server and client G> > end of the connections to verify they disagreed on the scaling). G> > G> > The original motivation of this change is to work around broken terminal G> > servers that were old when this change was added in 2001. Over 10 years later G> > I think we should at least have an option to turn this work-around off, and G> > possibly disable it by default. G> > G> > Thoughts? G> > G> G> I'm all for taking that code out. +1 -- Totus tuus, Glebius. From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 20:29:53 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 406675EC; Fri, 12 Oct 2012 20:29:53 +0000 (UTC) (envelope-from Michael.Tuexen@lurchi.franken.de) Received: from mail-n.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) by mx1.freebsd.org (Postfix) with ESMTP id A06228FC0A; Fri, 12 Oct 2012 20:29:52 +0000 (UTC) Received: from [192.168.1.103] (p508F9A09.dip.t-dialin.net [80.143.154.9]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTP id 4DA791C0C0BCC; Fri, 12 Oct 2012 22:29:50 +0200 (CEST) Subject: Re: Dropping TCP options from retransmitted SYNs considered harmful Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: Michael Tuexen In-Reply-To: <3DBAA027-B5D9-44AA-A00D-0496985D4FEA@neville-neil.com> Date: Fri, 12 Oct 2012 22:29:48 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201210121213.11152.jhb@freebsd.org> <3DBAA027-B5D9-44AA-A00D-0496985D4FEA@neville-neil.com> To: George Neville-Neil X-Mailer: Apple Mail (2.1283) Cc: John Baldwin , 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: Fri, 12 Oct 2012 20:29:53 -0000 On Oct 12, 2012, at 8:15 PM, George Neville-Neil wrote: >=20 > On Oct 12, 2012, at 12:13 , John Baldwin wrote: >=20 >> Back in 2001 FreeBSD added a hack to strip TCP options from = retransmitted SYNs=20 >> starting with the 3rd SYN in this block in tcp_timer.c: >>=20 >> /* >> * Disable rfc1323 if we haven't got any response to >> * our third SYN to work-around some broken terminal servers >> * (most of which have hopefully been retired) that have bad VJ >> * header compression code which trashes TCP segments containing >> * unknown-to-them TCP options. >> */ >> if ((tp->t_state =3D=3D TCPS_SYN_SENT) && (tp->t_rxtshift =3D=3D = 3)) >> tp->t_flags &=3D ~(TF_REQ_SCALE|TF_REQ_TSTMP); >>=20 >> There is even a PR for the original bug report: kern/1689 >>=20 >> However, there is an unintended consequence of this change that can = be=20 >> disastrous. Specifically, suppose you have a FreeBSD client = connecting to a=20 >> server, and that the SYNs are arriving at the server successfully, = but the=20 >> first few return SYN/ACKs are dropped. Eventually a SYN/ACK makes it = through=20 >> and the connection is established. >>=20 >> The server (based on the first SYN it saw) believes it has negotiated = window=20 >> scaling with the client. The client, however, has broken what it = promised in=20 >> that first SYN and believes it is not using any window scaling at = all. This=20 >> causes two forms of breakage: >>=20 >> 1) When the server advertises a scaled window (e.g. '8' for a 64k = window >> scaled at 13), the client thinks it is an unscaled window ('8') and >> sends data to the server very slowly. >>=20 >> 2) When the client advertises an unscaled window (e.g. '65535' for a = 64k >> window), the server thinks it has a huge window (65535 << 13 =3D=3D = 511MB) >> to send into. >>=20 >> I'm not sure that 2) is a problem per se, but I have definitely seen = instances=20 >> of 1) (and examined the 'struct tcpcb' in kgdb on both the server and = client=20 >> end of the connections to verify they disagreed on the scaling). >>=20 >> The original motivation of this change is to work around broken = terminal=20 >> servers that were old when this change was added in 2001. Over 10 = years later=20 >> I think we should at least have an option to turn this work-around = off, and=20 >> possibly disable it by default. >>=20 >> Thoughts? >>=20 >=20 > I'm all for taking that code out. ACK. >=20 > Best, > George >=20 >=20 > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >=20 From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 21:06:31 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 5E28F12F; Fri, 12 Oct 2012 21:06:31 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2878F8FC12; Fri, 12 Oct 2012 21:06:30 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id rp8so3543433pbb.13 for ; Fri, 12 Oct 2012 14:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=0UzXZe+e4AUF/goNW4ZmJ9ES2UTyJHt8SK6c1aRQGPA=; b=SQlCWPJloHspz5n1BIrCb3cNs4K6R+/8I4gpGU+ZM22Utz6eeooBv5UqtuEL1q7VfD tLzjL9ArJgJ/vOKMnN7j6BEmQQRP06iiXFVMHqSR9MZVNHFYWF4F7JZc0mAMr1QH4s8w pjFaqTdwWB+IUgIoevKGf6rePb7dCr1imrokL46ukDU42ln1Nsz/CdYItQURa7huA9Fn cZ42lxI7kJKZZvOetWxxDqf6GKn5tSv7YW0UN+hPa+QJwkTNIxAr/xLzqTB2w9dfVIxg Kw++y8NQf79Jcz60BJgZZjsH0dkSbD7J1IzopyMLwUK5/QdS4zWhB6kBQYM7CQ7uhQct cbYA== MIME-Version: 1.0 Received: by 10.68.197.9 with SMTP id iq9mr16576685pbc.130.1350075989826; Fri, 12 Oct 2012 14:06:29 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.146.233 with HTTP; Fri, 12 Oct 2012 14:06:29 -0700 (PDT) In-Reply-To: <20121012124709.GX89655@FreeBSD.org> References: <20121009154128.GU34622@FreeBSD.org> <20121012124640.GW89655@FreeBSD.org> <20121012124709.GX89655@FreeBSD.org> Date: Fri, 12 Oct 2012 17:06:29 -0400 X-Google-Sender-Auth: sVMmEDD8lUneuBnFNo1XqM0hOdg Message-ID: Subject: Re: [CFT/Review] net byte order for AF_INET From: Adrian Chadd To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 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: Fri, 12 Oct 2012 21:06:31 -0000 On 12 October 2012 08:47, Gleb Smirnoff wrote: > On Fri, Oct 12, 2012 at 04:46:40PM +0400, Gleb Smirnoff wrote: > T> Latest version of patch for further review and testing > T> Changelog: > T> - Fixed TCP checksums > T> - Added comment about raw sockets byte ordering. > T> - More explicit htons(0), when assigning ip_off field. I've just eyeballed the patch again: * You've patched SCTP and IGMP - have you done any SCTP and IGMP testing at all? * This kind of stuff almost begs for some kind of automated test suite for testing IPv4, IPv6, TCP/UDP/ICMP, IGMP, SCTP, all the tunneling stuff - is there anything out there like this? I know of the IPv6 test suites that exist; what about being able to regression test the other stuff? Also whilst I'm nitpicking - do you think there's any performance issues that may creep up? Remember that "performance issues" to me don't necessarily mean "on a current generation intel", but mean "all those cache starved ARM/MIPS/PPC/Atom boards out there that aren't natively in network byte order." Making everything use network byte order throughout the stack is nice for read-only packet work and nice for cache-happy i386s, but what about the rest of the world? (Don't get me wrong, I think this tidy-up is very nice and maybe quite needed, I just wonder what other unknown magic is hiding behind the existing code..) Adrian From owner-freebsd-net@FreeBSD.ORG Fri Oct 12 21:21:53 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 5FEB8953; Fri, 12 Oct 2012 21:21:53 +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 B22CB8FC1A; Fri, 12 Oct 2012 21:21:52 +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 q9CLLplQ003892; Sat, 13 Oct 2012 01:21:51 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9CLLp3H003891; Sat, 13 Oct 2012 01:21:51 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Sat, 13 Oct 2012 01:21:51 +0400 From: Gleb Smirnoff To: Adrian Chadd Subject: Re: [CFT/Review] net byte order for AF_INET Message-ID: <20121012212151.GB89655@glebius.int.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121012124640.GW89655@FreeBSD.org> <20121012124709.GX89655@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: Fri, 12 Oct 2012 21:21:53 -0000 On Fri, Oct 12, 2012 at 05:06:29PM -0400, Adrian Chadd wrote: A> On 12 October 2012 08:47, Gleb Smirnoff wrote: A> > On Fri, Oct 12, 2012 at 04:46:40PM +0400, Gleb Smirnoff wrote: A> > T> Latest version of patch for further review and testing A> > T> Changelog: A> > T> - Fixed TCP checksums A> > T> - Added comment about raw sockets byte ordering. A> > T> - More explicit htons(0), when assigning ip_off field. A> A> I've just eyeballed the patch again: A> A> * You've patched SCTP and IGMP - have you done any SCTP and IGMP testing at all? A> * This kind of stuff almost begs for some kind of automated test suite A> for testing IPv4, IPv6, TCP/UDP/ICMP, IGMP, SCTP, all the tunneling A> stuff - is there anything out there like this? I know of the IPv6 test A> suites that exist; what about being able to regression test the other A> stuff? Not tested yet: SCTP IGMP IPSEC siftr(4) mrouting pfsync, pf_route() stf(4) ng_ipfw(4) Tested: TCP/UDP/ICMP ip_fragment/ip_reass raw socket gre(4) as if_gre and as ng_pptpgre gif(4) pf(4) ipfw(4) divert(4) A> Also whilst I'm nitpicking - do you think there's any performance A> issues that may creep up? Remember that "performance issues" to me A> don't necessarily mean "on a current generation intel", but mean "all A> those cache starved ARM/MIPS/PPC/Atom boards out there that aren't A> natively in network byte order." Making everything use network byte A> order throughout the stack is nice for read-only packet work and nice A> for cache-happy i386s, but what about the rest of the world? Well, there may be unmeasurable impact. Just a few instructions per packet. Some functions may be optimized to store converted length in local variable and perform one or two ntohs() operations less. But better as a separate change. We've got much more fat optimization targets in stack than this. A> (Don't get me wrong, I think this tidy-up is very nice and maybe quite A> needed, I just wonder what other unknown magic is hiding behind the A> existing code..) There is so much magic here, and I want to just wipe it away instead of learning it to depths. The motivation to finally start this work and get it done is several panics due to packet in wrong byte order, which I am failing to parse and model out which codepath could lead to them. Thus I decided to fix that in principle. -- Totus tuus, Glebius. From owner-freebsd-net@FreeBSD.ORG Sat Oct 13 17:09:27 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 3C41FA6; Sat, 13 Oct 2012 17:09:27 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) by mx1.freebsd.org (Postfix) with ESMTP id 93B448FC0A; Sat, 13 Oct 2012 17:09:26 +0000 (UTC) Received: from alph.allbsd.org (p1137-ipbf1505funabasi.chiba.ocn.ne.jp [118.7.212.137]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id q9DH999p055687 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 14 Oct 2012 02:09:19 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) (authenticated bits=0) by alph.allbsd.org (8.14.5/8.14.5) with ESMTP id q9DH977a048255; Sun, 14 Oct 2012 02:09:09 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Sun, 14 Oct 2012 02:08:19 +0900 (JST) Message-Id: <20121014.020819.1069705220778418073.hrs@allbsd.org> To: melifaro@FreeBSD.org Subject: Re: [PATCH] IPv6 and ICMP6 redirects - routing performance From: Hiroki Sato In-Reply-To: <5076C0E3.9050803@FreeBSD.org> References: <5076C0E3.9050803@FreeBSD.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Sun_Oct_14_02_08_19_2012_155)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Sun, 14 Oct 2012 02:09:19 +0900 (JST) X-Spam-Status: No, score=-98.1 required=13.0 tests=CONTENT_TYPE_PRESENT, ONLY1HOPDIRECT,SAMEHELOBY2HOP,USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org 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: Sat, 13 Oct 2012 17:09:27 -0000 ----Security_Multipart(Sun_Oct_14_02_08_19_2012_155)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit "Alexander V. Chernikov" wrote in <5076C0E3.9050803@FreeBSD.org>: me> Hello list! me> me> Currently there are some unnecessary code residing in me> netinet6/in6_rmx.c causing performance degradation for IPv6 me> forwarding. me> me> Initially it was merged from netinet/in_rmx.c but it seems it is me> totally unused now due to different approach used in IPv6 redirects. me> me> Code calls mtx_lock() on rte per each routing lookup in me> in6_matroute(). me> Initially I plan to make someting like r241406 for IPv6, but after me> some investigation I found that no one is currently setting me> RTF_DYNAMIC flag for IPv6 routes. me> me> the question is: can we remove this entirely (patch attached) or we me> still needs some parts of this due to incomplete RFC 4861 me> implementation? I think there is no problem with the removal because route handling by rtqkill() is not needed for routes injected by ND and removal of in6_clsroute() has already made the in6_rtqtimo() no-op. -- Hiroki ----Security_Multipart(Sun_Oct_14_02_08_19_2012_155)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAlB5oAMACgkQTyzT2CeTzy1BUgCfdw2MVPNd4De/IfotSe6jZljy wDYAnRdBezUC24CQygVSBVij0BvxtDQq =AFyo -----END PGP SIGNATURE----- ----Security_Multipart(Sun_Oct_14_02_08_19_2012_155)---- From owner-freebsd-net@FreeBSD.ORG Sat Oct 13 17:50:20 2012 Return-Path: Delivered-To: net@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id 8D8396D for ; Sat, 13 Oct 2012 17:50:20 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from dhcp170-36-red.yandex.net (freefall.freebsd.org [8.8.178.135]) by mx2.freebsd.org (Postfix) with ESMTP id DB0103B5A54; Sat, 13 Oct 2012 17:50:19 +0000 (UTC) Message-ID: <5079A9A1.4070403@FreeBSD.org> Date: Sat, 13 Oct 2012 21:49:21 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120627 Thunderbird/13.0.1 MIME-Version: 1.0 To: net@freebsd.org Subject: ixgbe & if_igb RX ring locking Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Jack Vogel 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: Sat, 13 Oct 2012 17:50:20 -0000 Hello list! Packets receiving code for both ixgbe and if_igb looks like the following: ixgbe_msix_que -- ixgbe_rxeof() { IXGBE_RX_LOCK(rxr); while { get_packet; -- ixgbe_rx_input() { ++ IXGBE_RX_UNLOCK(rxr); if_input(packet); ++ IXGBE_RX_LOCK(rxr); } } IXGBE_RX_UNLOCK(rxr); } Lines marked with ++ appeared in r209068(igb) and r217593(ixgbe). These lines probably do LORs masking (if any) well. However, such change introduce quite significant performance drop: On my routing setup (nearly the same from previous -Intel 10G thread in -net) adding lock/unlock causes 2.8MPPS decrease to 2.3MPPS which is nearly 20%. So my questions are: Can any real LORs happen in some complex setup? (I can't imagine any). If so: maybe we can somehow avoid/workaround such cases? (and consider removing those locks). -- WBR, Alexander From owner-freebsd-net@FreeBSD.ORG Sat Oct 13 18:02:08 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 CC14968C; Sat, 13 Oct 2012 18:02:08 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 86CB98FC0A; Sat, 13 Oct 2012 18:02:08 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id E17637300A; Sat, 13 Oct 2012 20:22:23 +0200 (CEST) Date: Sat, 13 Oct 2012 20:22:23 +0200 From: Luigi Rizzo To: "Alexander V. Chernikov" Subject: Re: ixgbe & if_igb RX ring locking Message-ID: <20121013182223.GA73341@onelab2.iet.unipi.it> References: <5079A9A1.4070403@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5079A9A1.4070403@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: Jack Vogel , 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: Sat, 13 Oct 2012 18:02:08 -0000 On Sat, Oct 13, 2012 at 09:49:21PM +0400, Alexander V. Chernikov wrote: > Hello list! > > > Packets receiving code for both ixgbe and if_igb looks like the following: > > > ixgbe_msix_que > > -- ixgbe_rxeof() > { > IXGBE_RX_LOCK(rxr); > while > { > get_packet; > > -- ixgbe_rx_input() > { > ++ IXGBE_RX_UNLOCK(rxr); > if_input(packet); > ++ IXGBE_RX_LOCK(rxr); > } > > } > IXGBE_RX_UNLOCK(rxr); > } > > Lines marked with ++ appeared in r209068(igb) and r217593(ixgbe). > > These lines probably do LORs masking (if any) well. > However, such change introduce quite significant performance drop: > > On my routing setup (nearly the same from previous -Intel 10G thread in > -net) adding lock/unlock causes 2.8MPPS decrease to 2.3MPPS which is > nearly 20%. one option could be (same as it is done in the timer routine in dummynet) to build a list of all the packets that need to be sent to if_input(), and then call if_input with the entire list outside the lock. It would be even easier if we modify the various *_input() routines to handle a list of mbufs instead of just one. cheers luigi > So my questions are: > > Can any real LORs happen in some complex setup? (I can't imagine any). > If so: maybe we can somehow avoid/workaround such cases? (and consider > removing those locks). > > > > -- > WBR, Alexander > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" From owner-freebsd-net@FreeBSD.ORG Sat Oct 13 18:32:45 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 C348061A for ; Sat, 13 Oct 2012 18:32:45 +0000 (UTC) (envelope-from ray@ddteam.net) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 45AFE8FC16 for ; Sat, 13 Oct 2012 18:32:43 +0000 (UTC) Received: by mail-ee0-f54.google.com with SMTP id c50so2508359eek.13 for ; Sat, 13 Oct 2012 11:32:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=user-agent:in-reply-to:references:mime-version:content-type :content-transfer-encoding:subject:from:date:to:cc:message-id :x-gm-message-state; bh=niKOUxI76l/hY8ymPFZFB7QOrT2BJDHaNaIdPvakWSo=; b=Ghy+E9fpj7pmz7pHDIDejnIPimMDtzuI0FMGVXyYD+jqi3A2mYpo6DPvK1tAxutU53 YZUdX1NsRFubu+mvba2JmfuSnkhOAxOnX3q/QtLh7DLjF8lQ+/3Eb6ZCfWjdl7ITOddA 0bSYpDNQ/L+jZl2Asjt2ORrfTu4UAcTlXYGydK5QwgAXK54oy5wfn/Y03dcacVX/x9tL krqsXNsyIlHIyfEi+WC/yju8ZpsUD0++GCpdWDJ8AT2eQ8a2MKlL2oiLJLS7qiw61OUU a2E8+ZkwZ8BnR8F6VFId3810a6Ae9nBNt009IzqTrWoJ3CFsRmf0EIl1p7LqFNCytT4o aFDg== Received: by 10.14.200.134 with SMTP id z6mr10579639een.33.1350153162901; Sat, 13 Oct 2012 11:32:42 -0700 (PDT) Received: from [88.154.85.155] ([88.154.85.155]) by mx.google.com with ESMTPS id v3sm17171676een.1.2012.10.13.11.32.39 (version=SSLv3 cipher=OTHER); Sat, 13 Oct 2012 11:32:41 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: <20121012212151.GB89655@glebius.int.ru> References: <20121009154128.GU34622@FreeBSD.org> <20121012124640.GW89655@FreeBSD.org> <20121012124709.GX89655@FreeBSD.org> <20121012212151.GB89655@glebius.int.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [CFT/Review] net byte order for AF_INET From: Aleksandr Rybalko Date: Sat, 13 Oct 2012 21:32:28 +0300 To: Gleb Smirnoff ,Adrian Chadd Message-ID: <2b582820-0095-4dbe-b929-ba5eb9d4e0ee@email.android.com> X-Gm-Message-State: ALoCoQnzkuwpFEa6Xb0FIXDQWBNaXYl2il2pqa0fXc40p2qzZv+feX21AtVGzhEczy6XHPe/jP0C 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: Sat, 13 Oct 2012 18:32:45 -0000 Gleb Smirnoff написал(а): >On Fri, Oct 12, 2012 at 05:06:29PM -0400, Adrian Chadd wrote: >A> On 12 October 2012 08:47, Gleb Smirnoff wrote: >A> > On Fri, Oct 12, 2012 at 04:46:40PM +0400, Gleb Smirnoff wrote: >A> > T> Latest version of patch for further review and testing >A> > T> Changelog: >A> > T> - Fixed TCP checksums >A> > T> - Added comment about raw sockets byte ordering. >A> > T> - More explicit htons(0), when assigning ip_off field. >A> >A> I've just eyeballed the patch again: >A> >A> * You've patched SCTP and IGMP - have you done any SCTP and IGMP >testing at all? >A> * This kind of stuff almost begs for some kind of automated test >suite >A> for testing IPv4, IPv6, TCP/UDP/ICMP, IGMP, SCTP, all the tunneling >A> stuff - is there anything out there like this? I know of the IPv6 >test >A> suites that exist; what about being able to regression test the >other >A> stuff? > >Not tested yet: > >SCTP >IGMP >IPSEC >siftr(4) >mrouting >pfsync, pf_route() >stf(4) >ng_ipfw(4) No, ng_ipfw tested :-) > >Tested: > >TCP/UDP/ICMP >ip_fragment/ip_reass >raw socket >gre(4) as if_gre and as ng_pptpgre >gif(4) >pf(4) >ipfw(4) >divert(4) > >A> Also whilst I'm nitpicking - do you think there's any performance >A> issues that may creep up? Remember that "performance issues" to me >A> don't necessarily mean "on a current generation intel", but mean >"all >A> those cache starved ARM/MIPS/PPC/Atom boards out there that aren't >A> natively in network byte order." Making everything use network byte >A> order throughout the stack is nice for read-only packet work and >nice >A> for cache-happy i386s, but what about the rest of the world? > >Well, there may be unmeasurable impact. Just a few instructions per >packet. Some functions may be optimized to store converted length in >local variable and perform one or two ntohs() operations less. But >better as a separate change. We've got much more fat optimization >targets in stack than this. > >A> (Don't get me wrong, I think this tidy-up is very nice and maybe >quite >A> needed, I just wonder what other unknown magic is hiding behind the >A> existing code..) > >There is so much magic here, and I want to just wipe it away instead >of learning it to depths. The motivation to finally start this work and >get it done is several panics due to packet in wrong byte order, which >I >am failing to parse and model out which codepath could lead to them. >Thus >I decided to fix that in principle. WBW ------ Aleksandr Rybalko From owner-freebsd-net@FreeBSD.ORG Sat Oct 13 18:57:46 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5C1327D for ; Sat, 13 Oct 2012 18:57:46 +0000 (UTC) (envelope-from powerlist@gmail.com) Received: from smtp.ccitonline.org (smtp.CCITonline.org [69.166.152.155]) by mx1.freebsd.org (Postfix) with ESMTP id 25DDE8FC0A for ; Sat, 13 Oct 2012 18:57:45 +0000 (UTC) Received: from smtp.ccitonline.org ([69.166.152.152]) by smtp.ccitonline.org (8.13.8/8.13.8) with ESMTP id q9DIv13q015806 for ; Sat, 13 Oct 2012 14:57:45 -0400 Date: Sat, 13 Oct 2012 14:57:45 -0400 (EDT) From: powerlist@gmail.com To: freebsd-net@freebsd.org Message-ID: <27917925.171787.1350154665484.JavaMail.webprod@BAYLORWEB03> Subject: You need to see BaylorCME.org! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: ColdFusion 9 Application Server 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: Sat, 13 Oct 2012 18:57:46 -0000 Dear Friend, Your colleague, Debbie Eigenman, thought you might like to see the online CME activity, "Hemangiomas: When to Worry, What to Do", posted at http://www.baylorcme.org/hemangioma. There are additional online CME activities available at http://www.baylorcme.org. Thank you, Texas Children's Hospital & Baylor College of Medicine --------------------------------------------------------- A message from Debbie Eigenman: Hello Friend, You've made up to $100,and even $900 per day...guaranteed! Without breaking a sweat... and without spending any serious time in front of a computer screen. This is the kind of asset I would have killed for when I was first starting out. I urge you not to put this off. Some of the programs, like ours, are new and not well know yet. I honestly believe those who get in now and lock in their positions, while this is new, will be the ones who will reap the long term financial rewards. Don't let this opportunity slip by. IMPORTANT: APPLY NOW or Before Oct 15, 2012 is the Cut-Off date! To lock in your Commission! For Only $4.99 Membership To secure your $900 Commission APPLY NOW Hurry Grab it Now! You Get-Paid direct to your PAYPAL this coming Nov 05,2012 Be sure to APPLY NOW to secure your GUARANTEED $900 Commission! Important: join today $4.99 this limited offer for this week only. HERE:>>>> http://www.my-binary-code-online.com/?code=507939f8e24d5 These are PAID members Under YOU! And you are in powerline if you join Today. TYPE -- Date and Time - New PAID Members ----- Country P Oct. 13 @ 01:18 PM == Aaron Mailey ======== Kansas P Oct. 13 @ 10:42 AM == Kevin Knowles ======= United States P Oct. 13 @ 09:23 AM == Jeoff Bellar ======== Canada P Oct. 13 @ 08:39 AM == Shawn Davison ======= United States P Oct. 12 @ 08:26 AM == Gregg Alisone ======= United States P Oct. 12 @ 07:31 AM == Ellaberg Mustachez == Portugal P Oct. 12 @ 06:37 AM == Karriana Stoacavezh = United Kingdom P Oct. 12 @ 05:21 AM == Michelle Fernandez == Portugal P Oct. 11 @ 11:38 PM == Devon Black ========= Sri Lanka P Oct. 11 @ 11:15 PM == Catherine Simone ==== United Kingdom P Oct. 11 @ 10:45 PM == William Osburn ====== United States P Oct. 11 @ 10:15 PM == Joey Mcguire ======== United Kingdom P Oct. 11 @ 09:15 PM == Jason Morales ======= Canada P Oct. 11 @ 08:45 PM == Kimmey Sasail ======= United States P Oct. 11 @ 07:15 PM == Anne Salde ========== Sri Lanka P Oct. 10 @ 10:45 AM == Timmy Brown ========= United States P Oct. 10 @ 09:59 AM == Victor Chavarin ===== Italy P Oct. 10 @ 08:32 AM == Gaynell Bailey ====== South Africa P Oct. 10 @ 07:40 AM == Barbara Thorntone === Portugal P Oct. 10 @ 06:21 AM == James Wien ========== North Carolina P Oct. 10 @ 06:08 PM == Mike Wright ========= Berlin P Oct. 10 @ 04:33 PM == Mary Huggins ======== Hawaii P Oct. 10 @ 02:46 PM == Wenona Iser ========= London P Oct. 10 @ 10:08 AM == Serdena Alley ======= Oklahoma P Oct. 09 @ 08:55 AM == Roberto Moran ======= Philippines Therefore, you have a GUARANTEED $900 Commission every month from now on!. Earn $36 Per Process Each $36 x 25 = $900 Commission will be yours....! You must APPLY NOW right away or before Oct 15,2012 @ 11:59 PM (Pacific Time)---- or you will forever forfeit the $900 Commission that is now yours for the taking. You'll be paid via PAYPAL this Nov 05,2012. Be sure to APPLY NOW to secure your GUARANTEED $900 Commission! Click the link Below or Copy & Paste into your Browser: HERE:>>>> http://www.my-binary-code-online.com/?code=507939f8e24d5 Please do realize that if you dont APPLY NOW, ALL Commission that are currently is yours to take. As soon as I receive the confirmation of your Registration, I will be in touch with you to help you get started. To Your Success, Debbie Eigenman From owner-freebsd-net@FreeBSD.ORG Sat Oct 13 19:24:22 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 E0AF9B4F; Sat, 13 Oct 2012 19:24:22 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7A96A8FC08; Sat, 13 Oct 2012 19:24:22 +0000 (UTC) Received: by mail-vc0-f182.google.com with SMTP id fw7so5907763vcb.13 for ; Sat, 13 Oct 2012 12:24:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=CpnH+4N3bDvB9qaxqYHRCZav7EFQw3dU2IVNNVUC1BQ=; b=uzUocdkiB4kZDPQP57fNluMKKrl1opc9jf0HnQL2zO1abxf+tj9aY07xM1qIHKMkJC O9+Jiq7ZGULIRjd55L1czHOP9BNStojk7CfUfudRMyh2kCXF4nDOofKdiSPZjBpAUrZ9 7vls05AjEFpkrGDRfaJAO3X0qQPiRrzzMZeg8spZyhBz4hOeK8S2ljwE5optdZJzw/fv vADU5GzUxbjX9hqhr4emVxG9JrIfFGDv86tB/Ft+cIN04WyeAV+TkdX9x1aKYZKzAUB/ ZHaSmSqoiNZdT+5QHf7nde7Mj4TT3AAkv/8okuFwQ0n5XM8FxIJ2gThK0/RcsQv+F1RE ejIQ== MIME-Version: 1.0 Received: by 10.58.203.161 with SMTP id kr1mr1863785vec.35.1350156261714; Sat, 13 Oct 2012 12:24:21 -0700 (PDT) Received: by 10.58.68.8 with HTTP; Sat, 13 Oct 2012 12:24:21 -0700 (PDT) In-Reply-To: <20121013182223.GA73341@onelab2.iet.unipi.it> References: <5079A9A1.4070403@FreeBSD.org> <20121013182223.GA73341@onelab2.iet.unipi.it> Date: Sat, 13 Oct 2012 12:24:21 -0700 Message-ID: Subject: Re: ixgbe & if_igb RX ring locking From: Jack Vogel To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: "Alexander V. Chernikov" , 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: Sat, 13 Oct 2012 19:24:23 -0000 On Sat, Oct 13, 2012 at 11:22 AM, Luigi Rizzo wrote: > On Sat, Oct 13, 2012 at 09:49:21PM +0400, Alexander V. Chernikov wrote: > > Hello list! > > > > > > Packets receiving code for both ixgbe and if_igb looks like the > following: > > > > > > ixgbe_msix_que > > > > -- ixgbe_rxeof() > > { > > IXGBE_RX_LOCK(rxr); > > while > > { > > get_packet; > > > > -- ixgbe_rx_input() > > { > > ++ IXGBE_RX_UNLOCK(rxr); > > if_input(packet); > > ++ IXGBE_RX_LOCK(rxr); > > } > > > > } > > IXGBE_RX_UNLOCK(rxr); > > } > > > > Lines marked with ++ appeared in r209068(igb) and r217593(ixgbe). > > > > These lines probably do LORs masking (if any) well. > > However, such change introduce quite significant performance drop: > > > > On my routing setup (nearly the same from previous -Intel 10G thread in > > -net) adding lock/unlock causes 2.8MPPS decrease to 2.3MPPS which is > > nearly 20%. > > one option could be (same as it is done in the timer > routine in dummynet) to build a list of all the packets > that need to be sent to if_input(), and then call > if_input with the entire list outside the lock. > > It would be even easier if we modify the various *_input() > routines to handle a list of mbufs instead of just one. > > cheers > luigi > > Very interesting idea Luigi, will have to get that some thought. Jack > So my questions are: > > > > Can any real LORs happen in some complex setup? (I can't imagine any). > > If so: maybe we can somehow avoid/workaround such cases? (and consider > > removing those locks). > > > > > > > > -- > > WBR, Alexander > > > > _______________________________________________ > > freebsd-net@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-net > > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > From owner-freebsd-net@FreeBSD.ORG Sat Oct 13 22:19:10 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 3BE609BF; Sat, 13 Oct 2012 22:19:10 +0000 (UTC) (envelope-from nitroboost@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id A13298FC1B; Sat, 13 Oct 2012 22:19:09 +0000 (UTC) Received: by mail-ee0-f54.google.com with SMTP id c50so2546700eek.13 for ; Sat, 13 Oct 2012 15:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=IdUAstOnprM6jCZyjNrKpwVR8wwTSEwxqSAZB7o+Vpg=; b=ufvChC1rsSa+jeCSYkAcfvvjbDVVOsChKCed3+b3YTjn6nUPCd9jWE4mcnhXrvgtp3 XWk1nHLhfpsmOHmUn9HlzBRTfFkptbfI/mPk7ylHsLVJTuIIrO4n1p00+5zb0goaLL7D MCRHj8awWC5+Zei3XwxMJ12a6QHJTklpFa1TgtKdhEMVwyhSEs4LqFP9vgp3vSbz61+n M27YgIyratvfivsI263CK1aae/McvnS9gzRrphvO8teSM4qqqLR6YnCUWu7fg6XdM5Sa ArioO/c/ug0tun9uQ9FcJEcAtWxH4uvZVyaUESzJO8QavoTUACUAriOU0R05kcqNKxl4 3o9A== MIME-Version: 1.0 Received: by 10.14.212.72 with SMTP id x48mr10929379eeo.40.1350166748411; Sat, 13 Oct 2012 15:19:08 -0700 (PDT) Received: by 10.14.218.133 with HTTP; Sat, 13 Oct 2012 15:19:08 -0700 (PDT) In-Reply-To: <201210121213.11152.jhb@freebsd.org> References: <201210121213.11152.jhb@freebsd.org> Date: Sat, 13 Oct 2012 15:19:08 -0700 Message-ID: Subject: Re: Dropping TCP options from retransmitted SYNs considered harmful From: Jason Wolfe To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 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: Sat, 13 Oct 2012 22:19:10 -0000 On Fri, Oct 12, 2012 at 9:13 AM, John Baldwin wrote: > Back in 2001 FreeBSD added a hack to strip TCP options from retransmitted SYNs > starting with the 3rd SYN in this block in tcp_timer.c: > > /* > * Disable rfc1323 if we haven't got any response to > * our third SYN to work-around some broken terminal servers > * (most of which have hopefully been retired) that have bad VJ > * header compression code which trashes TCP segments containing > * unknown-to-them TCP options. > */ > if ((tp->t_state == TCPS_SYN_SENT) && (tp->t_rxtshift == 3)) > tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP); > > There is even a PR for the original bug report: kern/1689 > > [..snip..] > > The original motivation of this change is to work around broken terminal > servers that were old when this change was added in 2001. Over 10 years later > I think we should at least have an option to turn this work-around off, and > possibly disable it by default. > > Thoughts? > > -- > John Baldwin Not that it alone merits keeping the code in, but there are some cases where this comes in handy. I ran into an issue with heavily trafficked Linux <-> FBSD boxes here - http://lists.freebsd.org/pipermail/freebsd-net/2012-March/031881.html. Linux would deny the connection because in FBSD ithe n and outbound timestamp randomization isn't sync'd to the same base, so when FBSD would hit a 2MSL connection Linux would simply ignore the SYN. After the 3rd SYN FBSD would drop support, and Linux would finally honor the request. I doubt this is too widespread, but it would probably break things for a few folks. Jason From owner-freebsd-net@FreeBSD.ORG Sat Oct 13 22:26:42 2012 Return-Path: Delivered-To: freebsd-net@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A0533F44; Sat, 13 Oct 2012 22:26:42 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [8.8.178.135]) by mx1.freebsd.org (Postfix) with ESMTP id 6F8F38FC1B; Sat, 13 Oct 2012 22:26:42 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q9DMQge2090951; Sat, 13 Oct 2012 22:26:42 GMT (envelope-from linimon@freefall.freebsd.org) Received: (from linimon@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q9DMQg3q090947; Sat, 13 Oct 2012 22:26:42 GMT (envelope-from linimon) Date: Sat, 13 Oct 2012 22:26:42 GMT Message-Id: <201210132226.q9DMQg3q090947@freefall.freebsd.org> To: linimon@FreeBSD.org, freebsd-bugs@FreeBSD.org, freebsd-net@FreeBSD.org From: linimon@FreeBSD.org Subject: Re: kern/172675: [netinet] [patch] sysctl_tcp_hc_list (net.inet.tcp.hostcache.list) race condition causing memory corruption 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: Sat, 13 Oct 2012 22:26:42 -0000 Old Synopsis: sysctl_tcp_hc_list (net.inet.tcp.hostcache.list) race condition causing memory corruption New Synopsis: [netinet] [patch] sysctl_tcp_hc_list (net.inet.tcp.hostcache.list) race condition causing memory corruption Responsible-Changed-From-To: freebsd-bugs->freebsd-net Responsible-Changed-By: linimon Responsible-Changed-When: Sat Oct 13 22:26:12 UTC 2012 Responsible-Changed-Why: Over to maintainer(s). http://www.freebsd.org/cgi/query-pr.cgi?pr=172675