From owner-freebsd-net@FreeBSD.ORG Mon Jul 18 06:34:57 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DA80216A41C for ; Mon, 18 Jul 2005 06:34:57 +0000 (GMT) (envelope-from w65l76@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7317C43D49 for ; Mon, 18 Jul 2005 06:34:57 +0000 (GMT) (envelope-from w65l76@gmail.com) Received: by wproxy.gmail.com with SMTP id i22so949433wra for ; Sun, 17 Jul 2005 23:34:56 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=AA7WJoKlVgAVyukfSXNBKWy4F/5+rVbYWfZctBBtgjMzbohnc6Q19PRzEnP9arPCmaxuPnhBqkTvbq47kAVC3G48LNuDt9yAzusOWKD+IAINdJUm78wLKcjSUHP6OinqLVKO8FDklAudKgeanwHeO8WR0kcxficubAIqfD5yrZU= Received: by 10.54.24.31 with SMTP id 31mr264199wrx; Sun, 17 Jul 2005 23:34:56 -0700 (PDT) Received: by 10.54.115.14 with HTTP; Sun, 17 Jul 2005 23:34:56 -0700 (PDT) Message-ID: Date: Mon, 18 Jul 2005 06:34:56 +0000 From: Walery Kokarev To: freebsd-ipfw@freebsd.org, freebsd-net@freebsd.org In-Reply-To: <20050716095353.B86993@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <001c01c58a17$5dbe4a40$0100000a@R3B> <200507161740.38234.max@love2party.net> <20050716095353.B86993@xorpc.icir.org> Cc: Subject: Re: Traffic quota features in IPFW X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Walery Kokarev List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jul 2005 06:34:58 -0000 And why can't one use divert(4) interface? It looks quite suitable for that particular task. From owner-freebsd-net@FreeBSD.ORG Mon Jul 18 06:36:48 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA69916A41C; Mon, 18 Jul 2005 06:36:48 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A19943D45; Mon, 18 Jul 2005 06:36:48 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.12.11) with ESMTP id j6I6amd5010952; Sun, 17 Jul 2005 23:36:48 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id j6I6amvP010951; Sun, 17 Jul 2005 23:36:48 -0700 (PDT) (envelope-from rizzo) Date: Sun, 17 Jul 2005 23:36:48 -0700 From: Luigi Rizzo To: Walery Kokarev Message-ID: <20050717233648.A10929@xorpc.icir.org> References: <001c01c58a17$5dbe4a40$0100000a@R3B> <200507161740.38234.max@love2party.net> <20050716095353.B86993@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from w65l76@gmail.com on Mon, Jul 18, 2005 at 06:34:56AM +0000 Cc: freebsd-ipfw@freebsd.org, freebsd-net@freebsd.org Subject: Re: Traffic quota features in IPFW 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, 18 Jul 2005 06:36:49 -0000 On Mon, Jul 18, 2005 at 06:34:56AM +0000, Walery Kokarev wrote: > And why can't one use divert(4) interface? It looks quite suitable for > that particular task. no _that_ would really be a performance killer! From owner-freebsd-net@FreeBSD.ORG Mon Jul 18 06:50:28 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 194FC16A41C for ; Mon, 18 Jul 2005 06:50:28 +0000 (GMT) (envelope-from mosfet@planet.eon.net) Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net [199.185.220.223]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9B80743D45 for ; Mon, 18 Jul 2005 06:50:27 +0000 (GMT) (envelope-from mosfet@planet.eon.net) Received: from antioch ([142.179.216.126]) by priv-edtnes51.telusplanet.net (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with SMTP id <20050718065026.IYUU24306.priv-edtnes51.telusplanet.net@antioch>; Mon, 18 Jul 2005 00:50:26 -0600 Message-ID: <000501c58b6d$73a50d60$4b3010ac@antioch> From: "Lee S Clark" To: "Ragnar Lonn" References: <003101c58055$f5eb2110$4b3010ac@antioch> <42CE3E0A.3040304@packetfront.com> Date: Mon, 18 Jul 2005 01:51:05 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Cc: freebsd-net@freebsd.org Subject: Re: EM(4), vlans & dhclient 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, 18 Jul 2005 06:50:28 -0000 ----- Original Message ----- From: "Ragnar Lonn" To: "Lee S Clark" Cc: Sent: Friday, July 08, 2005 2:49 AM Subject: Re: EM(4), vlans & dhclient > Lee S Clark wrote: > > >- dhclient's interactions with either em(4) or some part of vlan(4) is flakey at best. occasionally all 3 vlan interfaces will obtain an IP, in other instances there is no traffic placed on the wire at all. typically one vlan int will get an IP the other two will not. i suppose this has something to do with em not liking promisc. > > > > > > Yeah, I've had some problems with multiple vlan interfaces too. I had > problems using multiple unique > MAC addresses for the different vlan interfaces on 5.x. The kernel would > drop packets destined for > e.g. vlan interface A that had MAC address X when the underlying > physical network interface had > another MAC address. It seemed easy to patch but we ended up using 4.x > instead anyhow and > there it works fine. > > >- the vlan interfaces _must_ have the same MAC as the parent (em0) otherwise the parent must be in promisc in order for the vlan int to recieve frames destined for it if a unique lladdr is applied. this may seem obvious, but is there a way to alter this behaviour to allow "unicast" MAC forwarding up from the parent to the vlan interfaces without enabling promisc (this might be another request for Linux veth on FreeBSD ;)? our ISP requires MAC registration in order to allocate IPs, one MAC = one IP, period. > > > > > > When we tested on 5.x, I'm fairly sure it didn't work *even if* the > physical interface was in promiscuous > mode. Maybe the behaviour isn't the same for all 5.x versions either. Or > maybe I'm just confused. > > Anyway, if you want to use several MAC addresses on a single physical > interface you have to set > the physical interface to promiscuous mode, AFAIK. Why don't you want to > enable promiscuous > mode? > > You also have to turn off the autosrc flag to keep the physical if from > overwriting the MAC > address of the vlan if on outgoing packets, but you probably knew that. > > You could try installing 4.11 and see how things work there, as a last > resort. > > /Ragnar > Sorry for the delayed reply; vacation. I don't have any particular aversion to promiscuous mode, just personal preference to avoid it. I certainly agree with you, 4.11 is looking very appealing. Thanks for the input! Cheers Lee From owner-freebsd-net@FreeBSD.ORG Mon Jul 18 07:06:54 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 95D8616A41C; Mon, 18 Jul 2005 07:06:54 +0000 (GMT) (envelope-from julian@elischer.org) Received: from delight.idiom.com (delight.idiom.com [216.240.32.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 32FD843D53; Mon, 18 Jul 2005 07:06:54 +0000 (GMT) (envelope-from julian@elischer.org) Received: from idiom.com (idiom.com [216.240.32.1]) by delight.idiom.com (Postfix) with ESMTP id D67201F7124; Mon, 18 Jul 2005 00:06:53 -0700 (PDT) Received: from [192.168.2.3] (home.elischer.org [216.240.48.38]) by idiom.com (8.12.11/8.12.11) with ESMTP id j6I76q76037464; Mon, 18 Jul 2005 00:06:52 -0700 (PDT) (envelope-from julian@elischer.org) Message-ID: <42DB550B.9070603@elischer.org> Date: Mon, 18 Jul 2005 00:06:51 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.7) Gecko/20050424 X-Accept-Language: en, hu MIME-Version: 1.0 To: Luigi Rizzo References: <001c01c58a17$5dbe4a40$0100000a@R3B> <200507161740.38234.max@love2party.net> <20050716095353.B86993@xorpc.icir.org> <20050717233648.A10929@xorpc.icir.org> In-Reply-To: <20050717233648.A10929@xorpc.icir.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-ipfw@freebsd.org, Walery Kokarev , freebsd-net@freebsd.org Subject: Re: Traffic quota features in IPFW 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, 18 Jul 2005 07:06:54 -0000 Luigi Rizzo wrote: > On Mon, Jul 18, 2005 at 06:34:56AM +0000, Walery Kokarev wrote: > >>And why can't one use divert(4) interface? It looks quite suitable for >>that particular task. > > > no _that_ would really be a performance killer! > > _______________________________________________ > 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" unless you divert to a netgraph socket within the kernel :-) (or use the new ipfw netgraph diversion facility) From owner-freebsd-net@FreeBSD.ORG Mon Jul 18 11:02:23 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 39BDB16A41C for ; Mon, 18 Jul 2005 11:02:23 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CAD7D43D53 for ; Mon, 18 Jul 2005 11:02:22 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j6IB2MdA098248 for ; Mon, 18 Jul 2005 11:02:22 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j6IB2M0S098243 for freebsd-net@freebsd.org; Mon, 18 Jul 2005 11:02:22 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 18 Jul 2005 11:02:22 GMT Message-Id: <200507181102.j6IB2M0S098243@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-net@FreeBSD.org Cc: Subject: Current problem reports assigned to you 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, 18 Jul 2005 11:02:23 -0000 Current FreeBSD problem reports Critical problems Serious problems Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2003/07/11] kern/54383 net [nfs] [patch] NFS root configurations wit o [2005/06/21] kern/82470 net FreeBSD advertises wrong window scale in 2 problems total. From owner-freebsd-net@FreeBSD.ORG Mon Jul 18 11:06:50 2005 Return-Path: X-Original-To: freebsd-net@FreeBSD.org Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3681816A41C for ; Mon, 18 Jul 2005 11:06:50 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7DE1F43D64 for ; Mon, 18 Jul 2005 11:06:42 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.3/8.13.3) with ESMTP id j6IB6crP024250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 18 Jul 2005 15:06:38 +0400 (MSD) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.3/8.13.1/Submit) id j6IB6brK024249; Mon, 18 Jul 2005 15:06:37 +0400 (MSD) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 18 Jul 2005 15:06:36 +0400 From: Gleb Smirnoff To: Motonori Shindo Message-ID: <20050718110636.GD22517@cell.sick.ru> Mail-Followup-To: Gleb Smirnoff , Motonori Shindo , freebsd-net@freebsd.org References: <20050710.165128.39641194.mshindo@mshindo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20050710.165128.39641194.mshindo@mshindo.net> User-Agent: Mutt/1.5.6i Cc: freebsd-net@FreeBSD.org Subject: Re: Netgraph mpd as a PPPoE access concentrator 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, 18 Jul 2005 11:06:50 -0000 On Sun, Jul 10, 2005 at 04:51:28PM +0900, Motonori Shindo wrote: M> I'm trying to use Netgraph (mpd) as a PPPoE access concentrator M> (i.e. PPPoE server). It is working OK but with one minor potential M> problem which I haven't been able to solve. M> M> The following is the mpd log file (replacing ip addresses with M> XXX.XXX.XXX.XXX) and configuration files. As we see in this log, the M> first incoming request succeeds and operates normally. However, M> "device" seems to be getting an attempt to bring it up again right M> after the first call is disconnected. This attempt never succeeds and M> is repeated indefinitely. Can you try: set link max-redial -1 in bundle configuration? -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE From owner-freebsd-net@FreeBSD.ORG Tue Jul 19 11:17:12 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2120216A41C for ; Tue, 19 Jul 2005 11:17:12 +0000 (GMT) (envelope-from do_not_reply@abripart.iserver.net) Received: from abripart.iserver.net (abripart.iserver.net [128.121.115.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id CAA0443D46 for ; Tue, 19 Jul 2005 11:17:11 +0000 (GMT) (envelope-from do_not_reply@abripart.iserver.net) Received: (from abripart@localhost) by abripart.iserver.net (8.12.11/8.12.11) id j6JBHBHa021351; Tue, 19 Jul 2005 05:17:11 -0600 (MDT) Date: Tue, 19 Jul 2005 05:17:11 -0600 (MDT) From: do_not_reply@abripart.iserver.net Message-Id: <200507191117.j6JBHBHa021351@abripart.iserver.net> X-Authentication-Warning: abripart.iserver.net: abripart set sender to do_not_reply using -f To: freebsd-net@freebsd.org X-Request-Originator: freebsd-net@freebsd.org X-Info1: ***************************************************************** X-Info2: This message was generated as an autoresponse to a mail request. X-Info3: Please report abuse of this autoresponder promptly to the site X-Info4: hostmaster. X-Info5: ***************************************************************** Subject: AutoResponse: Undelivered Mail 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: Tue, 19 Jul 2005 11:17:12 -0000 Your email has not been sent as this email is inactive. If you want to reach someone at IWA, please go to below url for appropriate contact: http://www.iwanet.org/directories Thank you. IWA Web Manager From owner-freebsd-net@FreeBSD.ORG Tue Jul 19 15:18:50 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 20DBC16A41F; Tue, 19 Jul 2005 15:18:50 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from postfix4-1.free.fr (postfix4-1.free.fr [213.228.0.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8548243D45; Tue, 19 Jul 2005 15:18:49 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from tatooine.tataz.chchile.org (vol75-8-82-233-239-98.fbx.proxad.net [82.233.239.98]) by postfix4-1.free.fr (Postfix) with ESMTP id 4D02F318876; Tue, 19 Jul 2005 17:18:47 +0200 (CEST) Received: by tatooine.tataz.chchile.org (Postfix, from userid 1000) id A3EF8405B; Tue, 19 Jul 2005 17:18:39 +0200 (CEST) Date: Tue, 19 Jul 2005 17:18:38 +0200 From: Jeremie Le Hen To: gnn@freebsd.org Message-ID: <20050719151838.GL39292@obiwan.tataz.chchile.org> References: <20050713130042.GV39292@obiwan.tataz.chchile.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: freebsd-net@freebsd.org, Jeremie Le Hen Subject: Re: Problem with Path MTU Discovery 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: Tue, 19 Jul 2005 15:18:50 -0000 Hi George, sorry for the delay. > > I set a gif(4)-based IPSec tunnel between my network and a friend's one. > > This works pretty well, except that Path MTU Discovery doesn't work. > > > > Quick draw: > > MTU: 1500 MTU:1280 MTU:1500 > > Comp1 --------- Gate1 -------- Gate2 -----+-- Comp2 > > RELENG_5 RELENG_4 RELENG_5 | RELENG_5 > > | > > +-- Comp3 > > RELENG_5 > > Can you look at the routing table for each of Comp1 and Comp2 and also > use the -W flag to show the path MTU? If there is something wonky in > the routing table then TCP will not hear about the MTU change. There doesn't seem to be strange MTUs in routing table (each host has multiple jails, which explains why the routing table is somewhat large). %%% comp1:root# netstat -rnWf inet Routing tables Internet: Destination Gateway Flags Refs Use Mtu Netif Expire default 192.168.1.1 UGS 0 3878073 1500 em0 127.0.0.1 127.0.0.1 UH 0 4 16384 lo0 192.168.1 link#3 UC 0 0 1500 em0 192.168.1.1 00:09:5b:1a:48:94 UHLW 1 594449 1500 em0 1169 192.168.1.25 00:04:23:89:e5:84 UHLW 0 20232 1500 lo0 => 192.168.1.25/32 link#3 UC 0 0 1500 em0 192.168.1.53 00:04:23:89:e5:84 UHLW 0 24765 1500 lo0 => 192.168.1.53/32 link#3 UC 0 0 1500 em0 192.168.1.178 00:c0:9f:94:39:8f UHLW 0 275 1500 em0 316 192.168.1.241/32 link#3 UC 0 0 1500 em0 comp2:root# netstat -rnWf inet Routing tables Internet: Destination Gateway Flags Refs Use Mtu Netif Expire default 192.168.4.13 UGS 0 58623 1500 xl0 127.0.0.1 127.0.0.1 UH 0 1244 16384 lo0 192.168.4 link#1 UC 0 0 1500 xl0 192.168.4.4 00:60:08:60:fe:10 UHLW 0 20 1500 lo0 192.168.4.13 00:0a:5e:3d:40:cb UHLW 1 1307764 1500 xl0 1012 192.168.4.40 00:60:08:60:fe:10 UHLW 0 1255 1500 lo0 => 192.168.4.40/32 link#1 UC 0 0 1500 xl0 192.168.4.49 00:60:08:60:fe:10 UHLW 0 2317 1500 lo0 => 192.168.4.49/32 link#1 UC 0 0 1500 xl0 192.168.4.50 00:60:08:60:fe:10 UHLW 0 1220 1500 lo0 => 192.168.4.50/32 link#1 UC 0 0 1500 xl0 192.168.4.51 00:60:08:60:fe:10 UHLW 0 4763999 1500 lo0 => 192.168.4.51/32 link#1 UC 0 0 1500 xl0 192.168.4.52 00:60:08:60:fe:10 UHLW 0 1215 1500 lo0 => 192.168.4.52/32 link#1 UC 0 0 1500 xl0 192.168.4.53 00:60:08:60:fe:10 UHLW 0 14393 1500 lo0 => 192.168.4.53/32 link#1 UC 0 0 1500 xl0 192.168.4.54/32 link#1 UC 0 0 1500 xl0 192.168.4.80 00:60:08:60:fe:10 UHLW 0 24577 1500 lo0 => 192.168.4.80/32 link#1 UC 0 0 1500 xl0 %%% Thank you. Regards, -- Jeremie Le Hen hen dot org >< ttz at chchile dot org > From owner-freebsd-net@FreeBSD.ORG Wed Jul 20 03:35:27 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C07816A41F for ; Wed, 20 Jul 2005 03:35:27 +0000 (GMT) (envelope-from admin@kr.Ru) Received: from ns.kr.ru (ns.kr.ru [84.22.128.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0D5F743D5C for ; Wed, 20 Jul 2005 03:35:24 +0000 (GMT) (envelope-from admin@kr.Ru) Received: from gravis.skala-net.ru (gravis.skala-net.ru [84.22.128.254]) by ns.kr.ru (Postfix) with ESMTP id 671BC22E3A for ; Wed, 20 Jul 2005 11:35:20 +0800 (KRAST) Date: Wed, 20 Jul 2005 11:32:26 +0800 From: Vitaliy Ovsyannikov X-Priority: 3 (Normal) Message-ID: <91763059.20050720113226@kr.Ru> To: freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: ng_netflow on 802.1Q VLAN-tagged iface X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Vitaliy Ovsyannikov List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2005 03:35:27 -0000 Hello, Is it possible to setup ng_netflow to suck in 802.1Q-tagged traffic (listen on parent interface instead of dother VLAN-ifaces) and make regular netflow5 data? (the same way like the cisco routers do) -- Sincerely, Vitaliy Ovsyannikov JSC Skala, Krasnoyarsk, Russia From owner-freebsd-net@FreeBSD.ORG Wed Jul 20 09:50:32 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A882616A41F for ; Wed, 20 Jul 2005 09:50:32 +0000 (GMT) (envelope-from lists@yazzy.org) Received: from mail.yazzy.org (mail.yazzy.org [217.8.140.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4690043D45 for ; Wed, 20 Jul 2005 09:50:29 +0000 (GMT) (envelope-from lists@yazzy.org) Received: from 217-13-2-82.dd.nextgentel.com ([217.13.2.82] helo=h311r4z3r) by mail.yazzy.org with esmtps (TLSv1:AES256-SHA:256) (YazzY.org) id 1DvBDV-0001v4-KP for freebsd-net@freebsd.org; Wed, 20 Jul 2005 11:50:18 +0200 Date: Wed, 20 Jul 2005 11:50:25 +0200 From: Marcin Jessa To: FreeBSD-net Message-Id: <20050720115025.01ad8a6e.lists@yazzy.org> Organization: YazzY.org X-Mailer: Sylpheed version 2.0.0beta6 (GTK+ 2.6.8; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -2.5 (--) Subject: vtun vs openvpn 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: Wed, 20 Jul 2005 09:50:32 -0000 Hi guys. What is the difference between vtun and openvpn? Do they work the same way ? Reading info on their web sites it sounds like vtun does the same thing as openvpn ... http://vtun.sourceforge.net/ http://openvpn.net/ From owner-freebsd-net@FreeBSD.ORG Thu Jul 21 04:08:44 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7BB4F16A421 for ; Thu, 21 Jul 2005 04:08:44 +0000 (GMT) (envelope-from MrSharky@iastate.edu) Received: from mailhub-3.iastate.edu (mailhub-3.iastate.edu [129.186.140.13]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E55843D97 for ; Thu, 21 Jul 2005 04:08:31 +0000 (GMT) (envelope-from MrSharky@iastate.edu) Received: from mailout-2.iastate.edu (mailout-2.iastate.edu [129.186.140.2]) by mailhub-3.iastate.edu (8.12.10/8.12.10) with SMTP id j6L48TZo003076 for ; Wed, 20 Jul 2005 23:08:29 -0500 Message-Id: <200507210408.j6L48TZo003076@mailhub-3.iastate.edu> Received: from plan-99-98.icsincorporated.com(206.61.99.98) by mailout-2.iastate.edu via csmap id bf6db00e_f99e_11d9_8d82_003048290bef_769; Wed, 20 Jul 2005 23:20:46 -0500 (CDT) From: "Ryan Rathje" To: Date: Wed, 20 Jul 2005 23:07:58 -0500 MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Thread-Index: AcWNqcbkIiOsWVOlQpmoYLXGVxH3CQ== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: hostent modification 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: Thu, 21 Jul 2005 04:08:44 -0000 I'm trying to write a custom dns program that instead of calling the "gethostbyname(query)" to resolve an IP, it calls my get_rand_ip(query) function. Now, the background is thus: I'm trying to have our gateway pick a random IP and send it back to the client that requested the query (say client asks for www.google.com , and custom dns programs returns 123.123.123.123). This may be confusing as to why I want to do this, think simulating the Internet within a controlled environment. I'm able to fill in all parts of the hostent struct except for **h_addr_list. struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; char **h_addr_list; } So to make this mess a little clearer, how to do "inject" an (random) IP into the variable "**h_addr_list"? Here is a snippet of my code: #include #include #include #include struct hostent get_rand_ip(char *query); struct hostent get_rand_ip(char *query) { struct hostent myHost; char ch[] = "123.122.121.111"; myHost.h_name = query; myHost.h_aliases = NULL; myHost.h_addrtype = AF_INET; myHost.h_length = 4; myHost.h_addr_list = (char *) ch; return myHost; } Lastly, I what would the corresponding printf statement be for verifying that my random ip did get assigned properly to h_addr_list? Thanks to all that took the time to read this. From owner-freebsd-net@FreeBSD.ORG Thu Jul 21 12:22:34 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 51A6B16A420 for ; Thu, 21 Jul 2005 12:22:34 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from postfix4-1.free.fr (postfix4-1.free.fr [213.228.0.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F72E43D77 for ; Thu, 21 Jul 2005 12:22:13 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from tatooine.tataz.chchile.org (vol75-8-82-233-239-98.fbx.proxad.net [82.233.239.98]) by postfix4-1.free.fr (Postfix) with ESMTP id C4F51319E2C; Thu, 21 Jul 2005 14:22:04 +0200 (CEST) Received: by tatooine.tataz.chchile.org (Postfix, from userid 1000) id 9F077407E; Thu, 21 Jul 2005 14:21:54 +0200 (CEST) Date: Thu, 21 Jul 2005 14:21:54 +0200 From: Jeremie Le Hen To: Philip Olsson Message-ID: <20050721122154.GF39292@obiwan.tataz.chchile.org> References: <42D2151B.4020807@puffy.nu> <02ae01c585e9$b1f64c70$42764eca@ilo.skyinet.net> <42D22214.2060804@puffy.nu> <20050711095414.GC39292@obiwan.tataz.chchile.org> <42D3AF42.3050809@puffy.nu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42D3AF42.3050809@puffy.nu> User-Agent: Mutt/1.5.9i Cc: fooler , Jeremie Le Hen , freebsd-net@freebsd.org Subject: Re: ipfw+dummynet only getting half bandwidth when using routed interfaces. 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: Thu, 21 Jul 2005 12:22:34 -0000 Hi Philip, > Yepps. And adding bridged does not help either. > I'm beginning to belive that I am the problem since there must be other > people doing this. did you resolve your problem ? If yes, what was the solution ? Regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org > From owner-freebsd-net@FreeBSD.ORG Thu Jul 21 18:07:16 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2386616A434 for ; Thu, 21 Jul 2005 18:07:16 +0000 (GMT) (envelope-from anders@cs.ucla.edu) Received: from smtp110.sbc.mail.mud.yahoo.com (smtp110.sbc.mail.mud.yahoo.com [68.142.198.209]) by mx1.FreeBSD.org (Postfix) with SMTP id D046343D60 for ; Thu, 21 Jul 2005 18:06:58 +0000 (GMT) (envelope-from anders@cs.ucla.edu) Received: (qmail 98783 invoked from network); 21 Jul 2005 18:06:58 -0000 Received: from unknown (HELO ?10.0.1.3?) (apeiris@sbcglobal.net@69.108.126.145 with plain) by smtp110.sbc.mail.mud.yahoo.com with SMTP; 21 Jul 2005 18:06:58 -0000 Mime-Version: 1.0 (Apple Message framework v733) Content-Transfer-Encoding: 7bit Message-Id: <91885646-8E16-4D06-91D7-307DD5836475@cs.ucla.edu> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: freebsd-net@freebsd.org From: Anders Persson Date: Thu, 21 Jul 2005 11:06:56 -0700 X-Mailer: Apple Mail (2.733) Subject: interface cleanup 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: Thu, 21 Jul 2005 18:07:16 -0000 Hi all, My name is Anders Persson and I am working on a Google SoC project in which I am trying to remove reference made from user land to kernel- only data structures. Currently I am going through netstat and rewriting some of the functions to rely on sysctl rather than kvm. The hope is to completely remove kvm from netstat, and parts that solely depend on it, like the core dump analysis would be factored out and moved to a more suitable place (kgdb?) In many cases this works quite well, and the public interfaces contain most of the information needed. In some cases certain pieces of information are not available. A specific example would be routing information, where I try to rely on routing messages to obtain the info. However, one piece of information that is missing is the ref count (rt_refcnt in rtentry). If this is one piece of information deemed necessary, what is the general opinion of including that in rt_msghdr? (Just a side note, I noticed there is both rtm_use and rtm_rmx.rmx_pksent in rt_msghdr, however when dumping an rtentry, the pksent metric of the entry is assigned to rtm_use and rmx_pksent is left unassigned, I assume this is done to avoid breaking legacy code?) The parts of netstat I am currently looking at are multicast routing info and netgraph. For both of these parts there seem to be no public interfaces to query for information. However, mrouting in IPv4 provide access to the internal structures which partially avoids using kvm (in one case you sysctl returns a list of mem locations so you have to do a sysctl/kvm combo to get the stuff you want), however, the structs that are returned contains pointers to other internal data such as ifnet's. There already exists some basic ioctl () request to obtain partial information, but I was thinking of extending the publicly available information by either adding a few more ioctl request, or extending the information available via sysctl. I guess the more complex task would be to efficiently dump the routing cache with bandwidth meters etc. Any thoughts about this? I have not had time to go through netgraph enough yet, but does anyone have some ideas how to avoid using kvm to obtain netgraph info? Thanks a lot, Anders From owner-freebsd-net@FreeBSD.ORG Thu Jul 21 22:06:18 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6FAB616A41F for ; Thu, 21 Jul 2005 22:06:18 +0000 (GMT) (envelope-from lulf@kerneled.org) Received: from bbnett.no (mail.bbnett.no [82.147.36.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id E0B4343D46 for ; Thu, 21 Jul 2005 22:06:17 +0000 (GMT) (envelope-from lulf@kerneled.org) Received: from [82.147.50.38] (helo=vimes.djelibeybi) by bbnett.no with esmtp (Exim 4.32 #6 (Debian)) id 1DvjBG-00043E-Rn; Fri, 22 Jul 2005 00:06:15 +0200 From: Ulf Lilleengen To: anders@cs.ucla.edu, freebsd-net@freebsd.org Content-Type: text/plain Date: Fri, 22 Jul 2005 00:06:17 +0200 Message-Id: <1121983577.2947.4.camel@vimes.djelibeybi> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Spam-Score: -1.0 (-) Cc: Subject: Re: interface cleanup 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: Thu, 21 Jul 2005 22:06:18 -0000 On Thu, Jul 21, 2005 at 11:06:56AM -0700, Anders Persson wrote: > I have not had time to go through netgraph enough yet, but does > anyone have some ideas how to avoid using kvm to obtain netgraph info? Well, I think rwatson not long ago imported libmemstat(3),now in current, which could be used for that purpose (i think). - Ulf Lilleengen / lulf From owner-freebsd-net@FreeBSD.ORG Fri Jul 22 06:49:33 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7AFFB16A42C for ; Fri, 22 Jul 2005 06:49:33 +0000 (GMT) (envelope-from Hartmut.Brandt@dlr.de) Received: from smtp-3.dlr.de (smtp-3.dlr.de [195.37.61.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id B103543D78 for ; Fri, 22 Jul 2005 06:49:10 +0000 (GMT) (envelope-from Hartmut.Brandt@dlr.de) Received: from beagle.kn.op.dlr.de ([129.247.173.6]) by smtp-3.dlr.de over TLS secured channel with Microsoft SMTPSVC(6.0.3790.211); Fri, 22 Jul 2005 08:49:04 +0200 Date: Fri, 22 Jul 2005 08:49:04 +0200 (CEST) From: Harti Brandt X-X-Sender: brandt_h@beagle.kn.op.dlr.de To: Anders Persson In-Reply-To: <91885646-8E16-4D06-91D7-307DD5836475@cs.ucla.edu> Message-ID: <20050722084700.D10603@beagle.kn.op.dlr.de> References: <91885646-8E16-4D06-91D7-307DD5836475@cs.ucla.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 22 Jul 2005 06:49:04.0936 (UTC) FILETIME=[73800280:01C58E89] Cc: freebsd-net@freebsd.org Subject: Re: interface cleanup X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Harti Brandt List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2005 06:49:33 -0000 On Thu, 21 Jul 2005, Anders Persson wrote: AP>I have not had time to go through netgraph enough yet, but does anyone have AP>some ideas how to avoid using kvm to obtain netgraph info? Add a control message to the ng_socket type that returns you the info you need. harti From owner-freebsd-net@FreeBSD.ORG Fri Jul 22 10:45:50 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1A61D16A4D7; Fri, 22 Jul 2005 10:45:50 +0000 (GMT) (envelope-from lists@yazzy.org) Received: from mail.yazzy.org (mail.yazzy.org [217.8.140.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id BEB4943D78; Fri, 22 Jul 2005 10:45:20 +0000 (GMT) (envelope-from lists@yazzy.org) Received: from 217-13-2-82.dd.nextgentel.com ([217.13.2.82] helo=h311r4z3r) by mail.yazzy.org with esmtps (TLSv1:AES256-SHA:256) (YazzY.org) id 1Dvv19-0004Ub-Nx; Fri, 22 Jul 2005 12:44:36 +0200 Date: Fri, 22 Jul 2005 12:44:49 +0200 From: Marcin Jessa To: FreeBSD-Current , FreeBSD-net Message-Id: <20050722124449.33f23cb9.lists@yazzy.org> Organization: YazzY.org X-Mailer: Sylpheed version 2.0.0beta6 (GTK+ 2.6.8; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -2.5 (--) Cc: Subject: issue with atheros and channel selection 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: Fri, 22 Jul 2005 10:45:50 -0000 Hi guys. When you ifconfig athX channel XX it works fine But when you then want to change that to ifconfig athX channel any (or '-' or '0') the old channel number does not change. The number then can be changed only to a different numeric value. Cheers, Marcin Jessa From owner-freebsd-net@FreeBSD.ORG Fri Jul 22 13:31:25 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D0BD16A46E for ; Fri, 22 Jul 2005 13:31:25 +0000 (GMT) (envelope-from mime@traveller.cz) Received: from ss.eunet.cz (ss.eunet.cz [193.85.228.13]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2392343D6B for ; Fri, 22 Jul 2005 13:30:58 +0000 (GMT) (envelope-from mime@traveller.cz) Received: from localhost.i.cz (ss.eunet.cz [193.85.228.13]) by ss.eunet.cz (8.13.1/8.13.1) with ESMTP id j6MDUchj084595; Fri, 22 Jul 2005 15:30:38 +0200 (CEST) (envelope-from mime@traveller.cz) From: Michal Mertl To: Anders Persson Content-Type: multipart/mixed; boundary="=-aECT6uAwSk87pHWGHBa6" Date: Fri, 22 Jul 2005 15:30:36 +0200 Message-Id: <1122039036.1260.32.camel@genius1.i.cz> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-net@freebsd.org Subject: Re: interface cleanup 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: Fri, 22 Jul 2005 13:31:25 -0000 --=-aECT6uAwSk87pHWGHBa6 Content-Type: text/plain Content-Transfer-Encoding: 7bit > Currently I am going through netstat and > rewriting some of the functions to rely on sysctl rather than kvm. > The hope is to completely remove kvm from netstat, and parts that > solely depend on it, like the core dump analysis would be factored > out and moved to a more suitable place (kgdb?) I also worked on it a bit. I didn't find a way to get the "IP interface" statistics with a sysctl. I wrote a small patch to kernel to include it which you may find usefull. Attached are the patches and a program that uses the new function. It's used pretty similarly to if_mib. I can't find the modifications to netstat to use it :-(. I'also played a bit with route printing through sysctl but it's nothing fancy. I can give you the result of this if you'd like to. Att --=-aECT6uAwSk87pHWGHBa6 Content-Disposition: attachment; filename=in_mib.patch Content-Type: text/x-patch; name=in_mib.patch; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit Index: conf/files =================================================================== RCS file: /home/fcvs/cvs/src/sys/conf/files,v retrieving revision 1.975 diff -u -r1.975 files --- conf/files 9 Dec 2004 13:54:28 -0000 1.975 +++ conf/files 16 Dec 2004 23:37:03 -0000 @@ -1477,6 +1477,7 @@ netinet/igmp.c optional inet netinet/in.c optional inet netinet/in_gif.c optional gif inet +netinet/in_mib.c optional inet netinet/ip_gre.c optional gre inet netinet/ip_id.c optional inet netinet/in_pcb.c optional inet --=-aECT6uAwSk87pHWGHBa6-- From owner-freebsd-net@FreeBSD.ORG Fri Jul 22 14:38:05 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6757816A420 for ; Fri, 22 Jul 2005 14:38:05 +0000 (GMT) (envelope-from melkor@pikenet.ru) Received: from grimble.pike.ru (grimble.pike.ru [194.135.18.157]) by mx1.FreeBSD.org (Postfix) with ESMTP id D4EA743D83 for ; Fri, 22 Jul 2005 14:37:56 +0000 (GMT) (envelope-from melkor@pikenet.ru) Received: (from melkor@localhost) by grimble.pike.ru (8.11.2/8.11.1) id j6MF22b63271 for freebsd-net@freebsd.org; Fri, 22 Jul 2005 19:02:02 +0400 (MSD) (envelope-from melkor) Date: Fri, 22 Jul 2005 19:02:02 +0400 From: Roman Petrov To: freebsd-net@freebsd.org Message-ID: <20050722190201.C58377@pikenet.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: Problem with sending SYN/ACK 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: Fri, 22 Jul 2005 14:38:05 -0000 Hello, Suppose I have three daemons, who grab all the packets which are forwarded to their addresses via different vlans fwd 10.104.50.2,9998 tcp from any to any dst-port 80 in recv vlan0 fwd 10.104.50.6,9998 tcp from any to any dst-port 80 in recv vlan1 fwd 10.104.50.10,9998 tcp from any to any dst-port 80 in recv vlan2 Those daemons then proceed to answer with a static responce (well, I mean they actually accept connection, give the responce and close socket which they've created accepting connection) Those daemons run with uids of 20000 20001 and 20002. So, I forward the answers to the proper gateway by using ipfw rules: fwd 10.104.50.1 tcp from any to any out uid 20000 fwd 10.104.50.5 tcp from any to any out uid 20001 fwd 10.104.50.9 tcp from any to any out uid 20002 The problem is that the SYN/ACK packet seems to be sent from another uid, and thus cannot be forwarded to the proper gateway. Is there a way I can force sending SYN/ACK from uids I need? I don't want to use additional natd's on those gateways, neither I want to run those daemons on gateways. Thank You for reading this. -- Roman Petrov From owner-freebsd-net@FreeBSD.ORG Sat Jul 23 00:24:41 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6491816A41F; Sat, 23 Jul 2005 00:24:41 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9909343D46; Sat, 23 Jul 2005 00:24:40 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with ESMTP id D47DD46B13; Fri, 22 Jul 2005 20:24:39 -0400 (EDT) Date: Sat, 23 Jul 2005 01:25:20 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Ed Maste In-Reply-To: <20050712220452.GB38249@sandvine.com> Message-ID: <20050723012046.K40216@fledge.watson.org> References: <42CEF0EB.4000107@borderware.com> <42D006DB.8080108@errno.com> <20050712150224.GA38249@sandvine.com> <20050712162332.Q79478@fledge.watson.org> <20050712220452.GB38249@sandvine.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-net@freebsd.org, gnn@FreeBSD.org Subject: Re: what to replace splnet in FreeBSD 5.x? 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: Sat, 23 Jul 2005 00:24:41 -0000 On Tue, 12 Jul 2005, Ed Maste wrote: > On Tue, Jul 12, 2005 at 04:30:18PM +0100, Robert Watson wrote: > >> I'm concerned about the multicast address list problems you've been >> experiencing, but haven't yet had a chance to investigate. If you could >> provide a code fragment that exercises this problem, that would probably >> get me started a lot more quickly. > > Thanks Robert. So far we've reproduced it only within our test lab > environment and with our product executables -- a large amount of code > and infrastructure. I've attempted to reduce it to a small amount of > code that demonstrates the problem but have had no success yet. Ed, The attached patch introduces locking around the link layer and IPv4 multicast address lists, as well as updates drivers to use the locking. It's a fairly large diff, but other than the changes to if.c, in.c, and igmp.c, is fairly mechanical. It may well correct the problem you've been seeing. If possible, and given sufficient review, I'd like to get this change into 6.0, especially given that it affects the layout of struct ifnet which is part of the ABI for network interface device drivers. I've tested it with a basic IPv4 multicast regression test locally, but not with a lot of multicast parallelism, since I don't have easily accessible real-world workloads. Any testing you could provide would be most welcome. Likewise, code review :-). Similar changes will also be needed in the IPv6 multicast code. I've CC'd George to victimize him further ... er ... to see if he's interested in this area. Robert N M Watson --- //depot/vendor/freebsd/src/sys/dev/ath/if_ath.c 2005/07/22 18:00:59 +++ //depot/projects/netsmp/src/sys/dev/ath/if_ath.c 2005/07/23 00:06:01 @@ -1661,6 +1661,7 @@ /* calculate and install multicast filter */ if ((ifp->if_flags & IFF_ALLMULTI) == 0) { mfilt[0] = mfilt[1] = 0; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { caddr_t dl; @@ -1673,6 +1674,7 @@ pos &= 0x3f; mfilt[pos / 32] |= (1 << (pos % 32)); } + IF_ADDR_UNLOCK(ifp); } else { mfilt[0] = mfilt[1] = ~0; } --- //depot/vendor/freebsd/src/sys/dev/awi/awi.c 2005/07/22 16:50:36 +++ //depot/projects/netsmp/src/sys/dev/awi/awi.c 2005/07/23 00:06:01 @@ -1146,15 +1146,19 @@ #ifdef __FreeBSD__ if (ifp->if_flags & IFF_ALLMULTI) goto set_mib; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; - if (n == AWI_GROUP_ADDR_SIZE) + if (n == AWI_GROUP_ADDR_SIZE) { + IF_ADDR_UNLOCK(ifp); goto set_mib; + } IEEE80211_ADDR_COPY(sc->sc_mib_addr.aGroup_Addresses[n], LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); n++; } + IF_ADDR_UNLOCK(ifp); #else ETHER_FIRST_MULTI(step, &sc->sc_ic.ic_ec, enm); while (enm != NULL) { --- //depot/vendor/freebsd/src/sys/dev/bfe/if_bfe.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/bfe/if_bfe.c 2005/07/19 21:29:46 @@ -883,12 +883,14 @@ val |= BFE_RXCONF_ALLMULTI; else { val &= ~BFE_RXCONF_ALLMULTI; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; bfe_cam_write(sc, LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i++); } + IF_ADDR_UNLOCK(ifp); } CSR_WRITE_4(sc, BFE_RXCONF, val); --- //depot/vendor/freebsd/src/sys/dev/bge/if_bge.c 2005/06/24 21:45:25 +++ //depot/projects/netsmp/src/sys/dev/bge/if_bge.c 2005/07/19 21:29:46 @@ -1171,6 +1171,7 @@ CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0); /* Now program new ones. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1178,6 +1179,7 @@ ifma->ifma_addr), ETHER_ADDR_LEN) & 0x7F; hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F); } + IF_ADDR_UNLOCK(ifp); for (i = 0; i < 4; i++) CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), hashes[i]); --- //depot/vendor/freebsd/src/sys/dev/ed/if_ed.c 2005/06/15 20:25:30 +++ //depot/projects/netsmp/src/sys/dev/ed/if_ed.c 2005/07/19 21:29:46 @@ -1778,6 +1778,7 @@ mcaf[0] = 0; mcaf[1] = 0; + IF_ADDR_LOCK(sc->ifp); TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1785,6 +1786,7 @@ ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; af[index >> 3] |= 1 << (index & 7); } + IF_ADDR_UNLOCK(sc->ifp); } int --- //depot/vendor/freebsd/src/sys/dev/em/if_em.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/em/if_em.c 2005/07/19 21:29:46 @@ -1596,7 +1596,8 @@ E1000_WRITE_REG(&adapter->hw, RCTL, reg_rctl); msec_delay(5); } - + + IF_ADDR_LOCK(ifp); #if __FreeBSD_version < 500000 LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { #else @@ -1611,6 +1612,7 @@ &mta[mcnt*ETH_LENGTH_OF_ADDRESS], ETH_LENGTH_OF_ADDRESS); mcnt++; } + IF_ADDR_UNLOCK(ifp); if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) { reg_rctl = E1000_READ_REG(&adapter->hw, RCTL); --- //depot/vendor/freebsd/src/sys/dev/ex/if_ex.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/ex/if_ex.c 2005/07/19 21:29:46 @@ -840,11 +840,13 @@ ifp = sc->ifp; count = 0; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { if (maddr->ifma_addr->sa_family != AF_LINK) continue; count++; } + IF_ADDR_UNLOCK(ifp); if ((ifp->if_flags & IFF_PROMISC) || (ifp->if_flags & IFF_ALLMULTI) || count > 63) { @@ -871,7 +873,8 @@ CSR_WRITE_2(sc, IO_PORT_REG, 0); CSR_WRITE_2(sc, IO_PORT_REG, 0); CSR_WRITE_2(sc, IO_PORT_REG, (count + 1) * 6); - + + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { if (maddr->ifma_addr->sa_family != AF_LINK) continue; @@ -882,6 +885,7 @@ CSR_WRITE_2(sc, IO_PORT_REG, *addr++); CSR_WRITE_2(sc, IO_PORT_REG, *addr++); } + IF_ADDR_UNLOCK(ifp); /* Program our MAC address as well */ /* XXX: Is this necessary? The Linux driver does this --- //depot/vendor/freebsd/src/sys/dev/fe/if_fe.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/fe/if_fe.c 2005/07/19 21:29:46 @@ -2060,6 +2060,7 @@ struct ifmultiaddr *ifma; filter = fe_filter_nothing; + IF_ADDR_LOCK(sc->ifp); TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -2072,6 +2073,7 @@ filter.data[index >> 3] |= 1 << (index & 7); } + IF_ADDR_UNLOCK(sc->ifp); return ( filter ); } --- //depot/vendor/freebsd/src/sys/dev/fxp/if_fxp.c 2005/06/11 00:50:21 +++ //depot/projects/netsmp/src/sys/dev/fxp/if_fxp.c 2005/07/19 21:29:46 @@ -2484,6 +2484,7 @@ nmcasts = 0; if ((sc->flags & FXP_FLAG_ALL_MCAST) == 0) { + IF_ADDR_LOCK(ifp); #if __FreeBSD_version < 500000 LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { #else @@ -2500,6 +2501,7 @@ &sc->mcsp->mc_addr[nmcasts][0], ETHER_ADDR_LEN); nmcasts++; } + IF_ADDR_UNLOCK(ifp); } mcsp->mc_cnt = htole16(nmcasts * ETHER_ADDR_LEN); return (nmcasts); --- //depot/vendor/freebsd/src/sys/dev/gem/if_gem.c 2005/06/12 15:35:17 +++ //depot/projects/netsmp/src/sys/dev/gem/if_gem.c 2005/07/19 21:29:46 @@ -1894,6 +1894,7 @@ /* Clear hash table */ memset(hash, 0, sizeof(hash)); + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; @@ -1906,6 +1907,7 @@ /* Set the corresponding bit in the filter. */ hash[crc >> 4] |= 1 << (15 - (crc & 15)); } + IF_ADDR_UNLOCK(ifp); v |= GEM_MAC_RX_HASH_FILTER; ifp->if_flags &= ~IFF_ALLMULTI; --- //depot/vendor/freebsd/src/sys/dev/hme/if_hme.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/hme/if_hme.c 2005/07/19 21:29:46 @@ -1679,6 +1679,7 @@ * the word. */ + IF_ADDR_LOCK(sc->sc_ifp); TAILQ_FOREACH(inm, &sc->sc_ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; @@ -1691,6 +1692,7 @@ /* Set the corresponding bit in the filter. */ hash[crc >> 4] |= 1 << (crc & 0xf); } + IF_ADDR_UNLOCK(sc->sc_ifp); ifp->if_flags &= ~IFF_ALLMULTI; --- //depot/vendor/freebsd/src/sys/dev/ie/if_ie.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/ie/if_ie.c 2005/07/19 21:29:46 @@ -1676,6 +1676,7 @@ * Step through the list of addresses. */ sc->mcast_count = 0; + IF_ADDR_LOCK(sc->ifp); TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1690,6 +1691,7 @@ &(sc->mcast_addrs[sc->mcast_count]), 6); sc->mcast_count++; } + IF_ADDR_UNLOCK(sc->ifp); setflag: sc->want_mcsetup = 1; --- //depot/vendor/freebsd/src/sys/dev/if_ndis/if_ndis.c 2005/06/14 17:50:27 +++ //depot/projects/netsmp/src/sys/dev/if_ndis/if_ndis.c 2005/07/19 21:29:46 @@ -265,6 +265,7 @@ sc->ndis_filter |= NDIS_PACKET_TYPE_MULTICAST; len = 0; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -272,11 +273,13 @@ mclist + (ETHER_ADDR_LEN * len), ETHER_ADDR_LEN); len++; if (len > mclistsz) { + IF_ADDR_UNLOCK(ifp); sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; sc->ndis_filter &= ~NDIS_PACKET_TYPE_MULTICAST; goto out; } } + IF_ADDR_UNLOCK(ifp); len = len * ETHER_ADDR_LEN; error = ndis_set_info(sc, OID_802_3_MULTICAST_LIST, mclist, &len); --- //depot/vendor/freebsd/src/sys/dev/ixgb/if_ixgb.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/ixgb/if_ixgb.c 2005/07/19 21:29:46 @@ -1065,6 +1065,7 @@ IOCTL_DEBUGOUT("ixgb_set_multi: begin"); + IF_ADDR_LOCK(ifp); #if __FreeBSD_version < 500000 LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { #else @@ -1077,6 +1078,7 @@ &mta[mcnt * IXGB_ETH_LENGTH_OF_ADDRESS], IXGB_ETH_LENGTH_OF_ADDRESS); mcnt++; } + IF_ADDR_UNLOCK(ifp); if (mcnt > MAX_NUM_MULTICAST_ADDRESSES) { reg_rctl = IXGB_READ_REG(&adapter->hw, RCTL); --- //depot/vendor/freebsd/src/sys/dev/lge/if_lge.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/lge/if_lge.c 2005/07/19 21:29:46 @@ -390,6 +390,7 @@ CSR_WRITE_4(sc, LGE_MAR1, 0); /* now program new ones */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -400,6 +401,7 @@ else hashes[1] |= (1 << (h - 32)); } + IF_ADDR_UNLOCK(ifp); CSR_WRITE_4(sc, LGE_MAR0, hashes[0]); CSR_WRITE_4(sc, LGE_MAR1, hashes[1]); --- //depot/vendor/freebsd/src/sys/dev/lnc/if_lnc.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/lnc/if_lnc.c 2005/07/19 21:29:46 @@ -239,6 +239,7 @@ */ bzero(sc->init_block->ladrf, MULTICAST_FILTER_LEN); + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -247,6 +248,7 @@ ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; sc->init_block->ladrf[index >> 3] |= 1 << (index & 7); } + IF_ADDR_UNLOCK(ifp); } void --- //depot/vendor/freebsd/src/sys/dev/my/if_my.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/my/if_my.c 2005/07/19 21:29:46 @@ -346,6 +346,7 @@ CSR_WRITE_4(sc, MY_MAR1, 0); /* now program new ones */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -357,6 +358,7 @@ hashes[1] |= (1 << (h - 32)); mcnt++; } + IF_ADDR_UNLOCK(ifp); if (mcnt) rxfilt |= MY_AM; --- //depot/vendor/freebsd/src/sys/dev/nge/if_nge.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/nge/if_nge.c 2005/07/19 21:29:46 @@ -705,6 +705,7 @@ * that needs to be updated, and the lower 4 bits represent * which bit within that byte needs to be set. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -716,6 +717,7 @@ NGE_FILTADDR_MCAST_LO + (index * 2)); NGE_SETBIT(sc, NGE_RXFILT_DATA, (1 << bit)); } + IF_ADDR_UNLOCK(ifp); CSR_WRITE_4(sc, NGE_RXFILT_CTL, filtsave); --- //depot/vendor/freebsd/src/sys/dev/nve/if_nve.c 2005/06/11 01:40:36 +++ //depot/projects/netsmp/src/sys/dev/nve/if_nve.c 2005/07/19 21:29:46 @@ -1074,6 +1074,7 @@ return; } /* Setup multicast filter */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { u_char *addrp; @@ -1087,6 +1088,7 @@ oraddr[i] |= mcaddr; } } + IF_ADDR_UNLOCK(ifp); for (i = 0; i < 6; i++) { hwfilter.acMulticastAddress[i] = andaddr[i] & oraddr[i]; hwfilter.acMulticastMask[i] = andaddr[i] | (~oraddr[i]); --- //depot/vendor/freebsd/src/sys/dev/owi/if_owi.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/owi/if_owi.c 2005/07/19 21:29:46 @@ -1213,6 +1213,7 @@ return; } + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1225,6 +1226,7 @@ break; } } + IF_ADDR_UNLOCK(ifp); mcast.wi_len = (i * 3) + 1; wi_write_record(sc, (struct wi_ltv_gen *)&mcast); --- //depot/vendor/freebsd/src/sys/dev/pdq/pdq_ifsubr.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/pdq/pdq_ifsubr.c 2005/07/19 21:29:46 @@ -273,6 +273,7 @@ PDQ_IFNET(sc)->if_flags &= ~IFF_ALLMULTI; #endif + IF_ADDR_LOCK(PDQ_IFNET(sc)); for (ifma = TAILQ_FIRST(&PDQ_IFNET(sc)->if_multiaddrs); ifma && num_addrs > 0; ifma = TAILQ_NEXT(ifma, ifma_link)) { char *mcaddr; @@ -285,6 +286,7 @@ addr++; num_addrs--; } + IF_ADDR_UNLOCK(PDQ_IFNET(sc)); /* * If not all the address fit into the CAM, turn on all-multicast mode. */ --- //depot/vendor/freebsd/src/sys/dev/ray/if_ray.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/ray/if_ray.c 2005/07/19 21:29:46 @@ -2704,6 +2704,7 @@ * The multicast list is only 16 items long so use promiscuous * mode and don't bother updating the multicast list. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) count++; if (count == 0) { @@ -2711,6 +2712,7 @@ return; } else if (count > 16) { ifp->if_flags |= IFF_ALLMULTI; + IF_ADDR_UNLOCK(ifp); ray_com_runq_done(sc); return; } else if (ifp->if_flags & IFF_ALLMULTI) @@ -2732,6 +2734,7 @@ ); bufp += ETHER_ADDR_LEN; } + IF_ADDR_UNLOCK(ifp); ray_com_ecf(sc, com); } --- //depot/vendor/freebsd/src/sys/dev/re/if_re.c 2005/07/01 04:16:05 +++ //depot/projects/netsmp/src/sys/dev/re/if_re.c 2005/07/19 21:29:46 @@ -601,6 +601,7 @@ CSR_WRITE_4(sc, RL_MAR4, 0); /* now program new ones */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -612,6 +613,7 @@ hashes[1] |= (1 << (h - 32)); mcnt++; } + IF_ADDR_UNLOCK(ifp); if (mcnt) rxfilt |= RL_RXCFG_RX_MULTI; --- //depot/vendor/freebsd/src/sys/dev/sn/if_sn.c 2005/07/18 23:45:24 +++ //depot/projects/netsmp/src/sys/dev/sn/if_sn.c 2005/07/19 21:29:46 @@ -1410,6 +1410,7 @@ bzero(mcf, MCFSZ); + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) return 0; @@ -1423,5 +1424,6 @@ } af[index2 >> 3] |= 1 << (index2 & 7); } + IF_ADDR_UNLOCK(ifp); return 1; /* use multicast filter */ } --- //depot/vendor/freebsd/src/sys/dev/snc/dp83932.c 2005/06/12 15:25:25 +++ //depot/projects/netsmp/src/sys/dev/snc/dp83932.c 2005/07/19 21:29:46 @@ -675,6 +675,7 @@ ifp->if_flags &= ~IFF_ALLMULTI; /* Loop through multicast addresses */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -688,6 +689,7 @@ LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); mcount++; } + IF_ADDR_UNLOCK(ifp); NIC_PUT(sc, SNCR_CDP, LOWER(sc->v_cda)); NIC_PUT(sc, SNCR_CDC, MAXCAM); --- //depot/vendor/freebsd/src/sys/dev/tx/if_tx.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/tx/if_tx.c 2005/07/19 21:29:46 @@ -1409,6 +1409,7 @@ filter[2] = 0; filter[3] = 0; + IF_ADDR_LOCK(ifp); #if __FreeBSD_version < 500000 LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { #else @@ -1420,6 +1421,7 @@ ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; filter[h >> 4] |= 1 << (h & 0xF); } + IF_ADDR_UNLOCK(ifp); CSR_WRITE_4(sc, MC0, filter[0]); CSR_WRITE_4(sc, MC1, filter[1]); --- //depot/vendor/freebsd/src/sys/dev/txp/if_txp.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/txp/if_txp.c 2005/07/19 21:29:46 @@ -1774,6 +1774,7 @@ else { hash[0] = hash[1] = 0; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1797,6 +1798,7 @@ hashbit = (u_int16_t)(crc & (64 - 1)); hash[hashbit / 32] |= (1 << hashbit % 32); } + IF_ADDR_UNLOCK(ifp); if (mcnt > 0) { filter |= TXP_RXFILT_HASHMULTI; --- //depot/vendor/freebsd/src/sys/dev/usb/if_aue.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/usb/if_aue.c 2005/07/19 21:29:46 @@ -539,6 +539,7 @@ aue_csr_write_1(sc, AUE_MAR0 + i, 0); /* now program new ones */ + IF_ADDR_LOCK(ifp); #if __FreeBSD_version >= 500000 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) #else @@ -551,6 +552,7 @@ ifma->ifma_addr), ETHER_ADDR_LEN) & ((1 << AUE_BITS) - 1); AUE_SETBIT(sc, AUE_MAR + (h >> 3), 1 << (h & 0x7)); } + IF_ADDR_UNLOCK(ifp); return; } --- //depot/vendor/freebsd/src/sys/dev/usb/if_axe.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/usb/if_axe.c 2005/07/19 21:29:46 @@ -338,6 +338,7 @@ } else rxmode &= ~AXE_RXCMD_ALLMULTI; + IF_ADDR_LOCK(ifp); #if __FreeBSD_version >= 500000 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) #else @@ -350,6 +351,7 @@ ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; hashtbl[h / 8] |= 1 << (h % 8); } + IF_ADDR_UNLOCK(ifp); axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, (void *)&hashtbl); axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL); --- //depot/vendor/freebsd/src/sys/dev/usb/if_cue.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/usb/if_cue.c 2005/07/19 21:29:46 @@ -356,6 +356,7 @@ sc->cue_mctab[i] = 0; /* now program new ones */ + IF_ADDR_LOCK(ifp); #if __FreeBSD_version >= 500000 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) #else @@ -367,6 +368,7 @@ h = cue_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); sc->cue_mctab[h >> 3] |= 1 << (h & 0x7); } + IF_ADDR_UNLOCK(ifp); /* * Also include the broadcast address in the filter --- //depot/vendor/freebsd/src/sys/dev/usb/if_kue.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/usb/if_kue.c 2005/07/19 21:29:46 @@ -327,6 +327,7 @@ sc->kue_rxfilt &= ~KUE_RXFILT_ALLMULTI; + IF_ADDR_LOCK(ifp); #if __FreeBSD_version >= 500000 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) #else @@ -345,6 +346,7 @@ KUE_MCFILT(sc, i), ETHER_ADDR_LEN); i++; } + IF_ADDR_UNLOCK(ifp); if (i == KUE_MCFILTCNT(sc)) sc->kue_rxfilt |= KUE_RXFILT_ALLMULTI; --- //depot/vendor/freebsd/src/sys/dev/usb/if_rue.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/usb/if_rue.c 2005/07/19 22:53:09 @@ -500,6 +500,7 @@ rue_csr_write_4(sc, RUE_MAR4, 0); /* now program new ones */ + IF_ADDR_LOCK(ifp); #if __FreeBSD_version >= 500000 TAILQ_FOREACH (ifma, &ifp->if_multiaddrs, ifma_link) #else @@ -516,6 +517,7 @@ hashes[1] |= (1 << (h - 32)); mcnt++; } + IF_ADDR_UNLOCK(ifp); if (mcnt) rxcfg |= RUE_RCR_AM; --- //depot/vendor/freebsd/src/sys/dev/usb/if_udav.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/usb/if_udav.c 2005/07/19 21:29:46 @@ -1044,6 +1044,7 @@ ETHER_NEXT_MULTI(step, enm); } #elif defined(__FreeBSD__) + IF_ADDR_LOCK(ifp); #if __FreeBSD_version >= 500000 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) #else @@ -1056,6 +1057,7 @@ ifma->ifma_addr)); hashes[h>>3] |= 1 << (h & 0x7); } + IF_ADDR_UNLOCK(ifp); #endif /* disable all multicast */ --- //depot/vendor/freebsd/src/sys/dev/vge/if_vge.c 2005/06/11 01:40:36 +++ //depot/projects/netsmp/src/sys/dev/vge/if_vge.c 2005/07/19 21:29:46 @@ -594,6 +594,7 @@ } /* Now program new ones */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -626,6 +627,7 @@ CSR_WRITE_4(sc, VGE_MAR0, hashes[0]); CSR_WRITE_4(sc, VGE_MAR1, hashes[1]); } + IF_ADDR_UNLOCK(ifp); return; } --- //depot/vendor/freebsd/src/sys/dev/wi/if_wi.c 2005/07/22 16:50:36 +++ //depot/projects/netsmp/src/sys/dev/wi/if_wi.c 2005/07/23 00:06:01 @@ -1739,6 +1739,7 @@ } n = 0; + IF_ADDR_LOCK(ifp); #if __FreeBSD_version < 500000 LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { #else @@ -1752,6 +1753,7 @@ (LLADDR((struct sockaddr_dl *)ifma->ifma_addr))); n++; } + IF_ADDR_UNLOCK(ifp); return wi_write_rid(sc, WI_RID_MCAST_LIST, &mlist, IEEE80211_ADDR_LEN * n); } --- //depot/vendor/freebsd/src/sys/dev/wl/if_wl.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/dev/wl/if_wl.c 2005/07/19 21:29:46 @@ -2121,6 +2121,7 @@ outw(PIOP1(base), 0); /* ac_status */ outw(PIOP1(base), AC_MCSETUP|AC_CW_EL); /* ac_command */ outw(PIOR1(base), OFFSET_CU + 8); + IF_ADDR_LOCK(sc->ifp); TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -2131,6 +2132,7 @@ outw(PIOP1(base), addrp[4] + (addrp[5] << 8)); ++cnt; } + IF_ADDR_UNLOCK(sc->ifp); outw(PIOR1(base), OFFSET_CU + 6); /* mc-cnt */ outw(PIOP1(base), cnt * WAVELAN_ADDR_SIZE); if (wlcmd(sc, "config()-mcaddress") == 0) --- //depot/vendor/freebsd/src/sys/dev/xe/if_xe.c 2005/07/15 06:11:01 +++ //depot/projects/netsmp/src/sys/dev/xe/if_xe.c 2005/07/19 21:29:46 @@ -1274,6 +1274,7 @@ /* Iterate over multicast address list */ count = 0; + IF_ADDR_LOCK(ifp); #if __FreeBSD_version < 500000 LIST_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { #else @@ -1295,6 +1296,7 @@ /* Nowhere else to put them on CE2 */ break; } + IF_ADDR_UNLOCK(ifp); DEVPRINTF(2, (scp->dev, "set_multicast: count = %u\n", count)); --- //depot/vendor/freebsd/src/sys/net/if.c 2005/07/19 10:16:50 +++ //depot/projects/netsmp/src/sys/net/if.c 2005/07/22 23:59:30 @@ -417,6 +417,8 @@ { if_free_type(ifp, ifp->if_type); + + IF_ADDR_LOCK_DESTROY(ifp); } void @@ -460,6 +462,7 @@ TASK_INIT(&ifp->if_starttask, 0, if_start_deferred, ifp); TASK_INIT(&ifp->if_linktask, 0, do_link_state_change, ifp); IF_AFDATA_LOCK_INIT(ifp); + IF_ADDR_LOCK_INIT(ifp); ifp->if_afdata_initialized = 0; IFNET_WLOCK(); TAILQ_INSERT_TAIL(&ifnet, ifp, if_link); @@ -1824,99 +1827,229 @@ return (if_setflag(ifp, IFF_ALLMULTI, 0, &ifp->if_amcount, onswitch)); } +struct ifmultiaddr * +ifmaof_ifpforaddr(struct sockaddr *sa, struct ifnet *ifp) +{ + struct ifmultiaddr *ifma; + + IF_ADDR_LOCK_ASSERT(ifp); + + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (sa_equal(ifma->ifma_addr, sa)) + break; + } + + return ifma; +} + +/* + * XXXRW: ifmaof_ifpforaddr() is an unsensible name, and appears not to be + * used, so use my more sensibly named version here. + */ +static struct ifmultiaddr * +if_findmulti(struct ifnet *ifp, struct sockaddr *sa) +{ + + IF_ADDR_LOCK_ASSERT(ifp); + + return (ifmaof_ifpforaddr(sa, ifp)); +} + +/* + * Allocate a new ifmultiaddr and initialize based on passed arguments. We + * make copies of passed sockaddrs. The ifmultiaddr will not be added to + * the ifnet multicast address list here, so the caller must do that and + * other setup work (such as notifying the device driver). The reference + * count is initialized to 1. + */ +static struct ifmultiaddr * +if_allocmulti(struct ifnet *ifp, struct sockaddr *sa, struct sockaddr *llsa, + int mflags) +{ + struct ifmultiaddr *ifma; + struct sockaddr *dupsa; + + MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, mflags | + M_ZERO); + if (ifma == NULL) + return (NULL); + + MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, mflags); + if (dupsa == NULL) { + FREE(ifma, M_IFMADDR); + return (NULL); + } + bcopy(sa, dupsa, sa->sa_len); + ifma->ifma_addr = dupsa; + + ifma->ifma_ifp = ifp; + ifma->ifma_refcount = 1; + ifma->ifma_protospec = NULL; + + if (llsa == NULL) { + ifma->ifma_lladdr = NULL; + return (ifma); + } + + MALLOC(dupsa, struct sockaddr *, llsa->sa_len, M_IFMADDR, mflags); + if (dupsa == NULL) { + FREE(ifma->ifma_addr, M_IFMADDR); + FREE(ifma, M_IFMADDR); + return (NULL); + } + bcopy(llsa, dupsa, llsa->sa_len); + ifma->ifma_lladdr = dupsa; + + return (ifma); +} + +/* + * if_freemulti: free ifmultiaddr structure and possibly attached related + * addresses. The caller is responsible for implementing reference + * counting, notifying the driver, handling routing messages, and releasing + * any dependent link layer state. + */ +static void +if_freemulti(struct ifmultiaddr *ifma) +{ + + KASSERT(ifma->ifma_refcount == 1, ("if_freemulti: refcount %d", + ifma->ifma_refcount)); + KASSERT(ifma->ifma_protospec == NULL, + ("if_freemulti: protospec not NULL")); + + if (ifma->ifma_lladdr != NULL) + FREE(ifma->ifma_lladdr, M_IFMADDR); + FREE(ifma->ifma_addr, M_IFMADDR); + FREE(ifma, M_IFMADDR); +} + /* - * Add a multicast listenership to the interface in question. - * The link layer provides a routine which converts + * Register an additional multicast address with a network interface. + * + * - If the address is already present, bump the reference count on the + * address and return. + * - If the address is not link-layer, look up a link layer address. + * - Allocate address structures for one or both addresses, and attach to the + * multicast address list on the interface. If automatically adding a link + * layer address, the protocol address will own a reference to the link + * layer address, to be freed when it is freed. + * - Notify the network device driver of an addition to the multicast address + * list. + * + * 'sa' points to caller-owned memory with the desired multicast address. + * + * 'retifma' will be used to return a pointer to the resulting multicast + * address reference, if desired. */ int -if_addmulti(struct ifnet *ifp, struct sockaddr *sa, struct ifmultiaddr **retifma) +if_addmulti(struct ifnet *ifp, struct sockaddr *sa, + struct ifmultiaddr **retifma) { - struct sockaddr *llsa, *dupsa; - int error, s; - struct ifmultiaddr *ifma; + struct ifmultiaddr *ifma, *ll_ifma; + struct sockaddr *llsa; + int error; /* - * If the matching multicast address already exists - * then don't add a new one, just add a reference + * If the address is already present, return a new reference to it; + * otherwise, allocate storage and set up a new address. */ - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (sa_equal(sa, ifma->ifma_addr)) { - ifma->ifma_refcount++; - if (retifma) - *retifma = ifma; - return 0; - } + IF_ADDR_LOCK(ifp); + ifma = if_findmulti(ifp, sa); + if (ifma != NULL) { + ifma->ifma_refcount++; + if (retifma != NULL) + *retifma = ifma; + IF_ADDR_UNLOCK(ifp); + return (0); } /* - * Give the link layer a chance to accept/reject it, and also - * find out which AF_LINK address this maps to, if it isn't one - * already. + * The address isn't already present; resolve the protocol address + * into a link layer address, and then look that up, bump its + * refcount or allocate an ifma for that also. If 'llsa' was + * returned, we will need to free it later. */ + llsa = NULL; + ll_ifma = NULL; if (ifp->if_resolvemulti != NULL) { error = ifp->if_resolvemulti(ifp, &llsa, sa); - if (error) return error; - } else { - llsa = NULL; + if (error) + goto unlock_out; } - MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, M_WAITOK); - MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, M_WAITOK); - bcopy(sa, dupsa, sa->sa_len); + /* + * Allocate the new address. Don't hook it up yet, as we may also + * need to allocate a link layer multicast address. + */ + ifma = if_allocmulti(ifp, sa, llsa, M_NOWAIT); + if (ifma == NULL) { + error = ENOMEM; + goto free_llsa_out; + } - ifma->ifma_addr = dupsa; - ifma->ifma_lladdr = llsa; - ifma->ifma_ifp = ifp; - ifma->ifma_refcount = 1; - ifma->ifma_protospec = NULL; - rt_newmaddrmsg(RTM_NEWMADDR, ifma); + /* + * If a link layer address is found, we'll need to see if it's + * already present in the address list, or allocate is as well. + * When this block finishes, the link layer address will be on the + * list. + */ + if (llsa != NULL) { + ll_ifma = if_findmulti(ifp, llsa); + if (ll_ifma == NULL) { + ll_ifma = if_allocmulti(ifp, llsa, NULL, M_NOWAIT); + if (ll_ifma == NULL) { + if_freemulti(ifma); + error = ENOMEM; + goto free_llsa_out; + } + TAILQ_INSERT_HEAD(&ifp->if_multiaddrs, ll_ifma, + ifma_link); + } else + ll_ifma->ifma_refcount++; + } /* - * Some network interfaces can scan the address list at - * interrupt time; lock them out. + * We now have a new multicast address, ifma, and possibly a new or + * referenced link layer address. Add the primary address to the + * ifnet address list. */ - s = splimp(); TAILQ_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link); - splx(s); + if (retifma != NULL) *retifma = ifma; - if (llsa != NULL) { - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (sa_equal(ifma->ifma_addr, llsa)) - break; - } - if (ifma) { - ifma->ifma_refcount++; - } else { - MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, - M_IFMADDR, M_WAITOK); - MALLOC(dupsa, struct sockaddr *, llsa->sa_len, - M_IFMADDR, M_WAITOK); - bcopy(llsa, dupsa, llsa->sa_len); - ifma->ifma_addr = dupsa; - ifma->ifma_lladdr = NULL; - ifma->ifma_ifp = ifp; - ifma->ifma_refcount = 1; - ifma->ifma_protospec = NULL; - s = splimp(); - TAILQ_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link); - splx(s); - } - } + /* + * Must generate the message while holding the lock so that 'ifma' + * pointer is still valid. + * + * XXXRW: How come we don't announce ll_ifma? + */ + rt_newmaddrmsg(RTM_NEWMADDR, ifma); + IF_ADDR_UNLOCK(ifp); + /* * We are certain we have added something, so call down to the * interface to let them know about it. */ if (ifp->if_ioctl != NULL) { - s = splimp(); IFF_LOCKGIANT(ifp); (void) (*ifp->if_ioctl)(ifp, SIOCADDMULTI, 0); IFF_UNLOCKGIANT(ifp); - splx(s); } - return 0; + if (llsa != NULL) + FREE(llsa, M_IFMADDR); + + return (0); + +free_llsa_out: + if (llsa != NULL) + FREE(llsa, M_IFMADDR); + +unlock_out: + IF_ADDR_UNLOCK(ifp); + return (error); } /* @@ -1926,72 +2059,53 @@ int if_delmulti(struct ifnet *ifp, struct sockaddr *sa) { - struct ifmultiaddr *ifma; - int s; + struct ifmultiaddr *ifma, *ll_ifma; - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - if (sa_equal(sa, ifma->ifma_addr)) - break; - if (ifma == NULL) + IF_ADDR_LOCK(ifp); + ifma = if_findmulti(ifp, sa); + if (ifma == NULL) { + IF_ADDR_UNLOCK(ifp); return ENOENT; + } if (ifma->ifma_refcount > 1) { ifma->ifma_refcount--; + IF_ADDR_UNLOCK(ifp); return 0; } - rt_newmaddrmsg(RTM_DELMADDR, ifma); sa = ifma->ifma_lladdr; - s = splimp(); - TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link); + if (sa != NULL) + ll_ifma = if_findmulti(ifp, sa); + else + ll_ifma = NULL; + /* - * Make sure the interface driver is notified - * in the case of a link layer mcast group being left. + * XXXRW: How come we don't announce ll_ifma? */ - if (ifp->if_ioctl && ifma->ifma_addr->sa_family == AF_LINK && sa == 0) { - IFF_LOCKGIANT(ifp); - (void) (*ifp->if_ioctl)(ifp, SIOCDELMULTI, 0); - IFF_UNLOCKGIANT(ifp); + rt_newmaddrmsg(RTM_DELMADDR, ifma); + + TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link); + if_freemulti(ifma); + + if (ll_ifma != NULL) { + if (ll_ifma->ifma_refcount == 1) { + TAILQ_REMOVE(&ifp->if_multiaddrs, ll_ifma, ifma_link); + if_freemulti(ll_ifma); + } else + ll_ifma->ifma_refcount--; } - splx(s); - free(ifma->ifma_addr, M_IFMADDR); - free(ifma, M_IFMADDR); - if (sa == NULL) - return 0; + IF_ADDR_UNLOCK(ifp); /* - * Now look for the link-layer address which corresponds to - * this network address. It had been squirreled away in - * ifma->ifma_lladdr for this purpose (so we don't have - * to call ifp->if_resolvemulti() again), and we saved that - * value in sa above. If some nasty deleted the - * link-layer address out from underneath us, we can deal because - * the address we stored was is not the same as the one which was - * in the record for the link-layer address. (So we don't complain - * in that case.) + * Make sure the interface driver is notified + * in the case of a link layer mcast group being left. */ - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - if (sa_equal(sa, ifma->ifma_addr)) - break; - if (ifma == NULL) - return 0; - - if (ifma->ifma_refcount > 1) { - ifma->ifma_refcount--; - return 0; - } - - s = splimp(); - TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link); - if (ifp->if_ioctl != NULL) { + if (ifp->if_ioctl) { IFF_LOCKGIANT(ifp); (void) (*ifp->if_ioctl)(ifp, SIOCDELMULTI, 0); IFF_UNLOCKGIANT(ifp); } - splx(s); - free(ifma->ifma_addr, M_IFMADDR); - free(sa, M_IFMADDR); - free(ifma, M_IFMADDR); return 0; } @@ -2070,18 +2184,6 @@ return (0); } -struct ifmultiaddr * -ifmaof_ifpforaddr(struct sockaddr *sa, struct ifnet *ifp) -{ - struct ifmultiaddr *ifma; - - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - if (sa_equal(ifma->ifma_addr, sa)) - break; - - return ifma; -} - /* * The name argument must be a pointer to storage which will last as * long as the interface does. For physical devices, the result of --- //depot/vendor/freebsd/src/sys/net/if_arcsubr.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/net/if_arcsubr.c 2005/07/22 02:45:35 @@ -798,7 +798,9 @@ if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return EADDRNOTAVAIL; MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_ZERO); + M_NOWAIT | M_ZERO); + if (sdl == NULL) + return ENOMEM; sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; @@ -824,7 +826,9 @@ if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return EADDRNOTAVAIL; MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_ZERO); + M_NOWAIT | M_ZERO); + if (sdl == NULL) + return ENOMEM; sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; --- //depot/vendor/freebsd/src/sys/net/if_ethersubr.c 2005/07/21 09:02:12 +++ //depot/projects/netsmp/src/sys/net/if_ethersubr.c 2005/07/23 00:06:01 @@ -1144,7 +1144,9 @@ if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return EADDRNOTAVAIL; MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_WAITOK|M_ZERO); + M_NOWAIT|M_ZERO); + if (sdl == NULL) + return ENOMEM; sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; @@ -1171,7 +1173,9 @@ if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return EADDRNOTAVAIL; MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_WAITOK|M_ZERO); + M_NOWAIT|M_ZERO); + if (sdl == NULL) + return (ENOMEM); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; --- //depot/vendor/freebsd/src/sys/net/if_fddisubr.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/net/if_fddisubr.c 2005/07/22 02:45:35 @@ -720,7 +720,9 @@ if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return (EADDRNOTAVAIL); MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_WAITOK); + M_NOWAIT | M_ZERO); + if (sdl == NULL) + return (ENOMEM); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; @@ -749,7 +751,9 @@ if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return (EADDRNOTAVAIL); MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_WAITOK); + M_NOWAIT | M_ZERO); + if (sdl == NULL) + return (ENOMEM); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; --- //depot/vendor/freebsd/src/sys/net/if_iso88025subr.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/net/if_iso88025subr.c 2005/07/22 02:45:35 @@ -720,7 +720,9 @@ return (EADDRNOTAVAIL); } MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_WAITOK|M_ZERO); + M_NOWAIT|M_ZERO); + if (sdl == NULL) + return (ENOMEM); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; @@ -748,7 +750,9 @@ return (EADDRNOTAVAIL); } MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_WAITOK|M_ZERO); + M_NOWAIT|M_ZERO); + if (sdl == NULL) + return (ENOMEM); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; --- //depot/vendor/freebsd/src/sys/net/if_var.h 2005/07/21 22:05:31 +++ //depot/projects/netsmp/src/sys/net/if_var.h 2005/07/23 00:06:01 @@ -177,6 +177,7 @@ void *if_afdata[AF_MAX]; int if_afdata_initialized; struct mtx if_afdata_mtx; + struct mtx if_addr_mtx; /* mutex to protect address lists */ struct task if_starttask; /* task for IFF_NEEDSGIANT */ struct task if_linktask; /* task for link change events */ }; @@ -217,6 +218,16 @@ #define if_list if_link /* + * Locks for address lists on the network interface. + */ +#define IF_ADDR_LOCK_INIT(if) mtx_init(&(if)->if_addr_mtx, \ + "if_addr_mtx", NULL, MTX_DEF) +#define IF_ADDR_LOCK_DESTROY(if) mtx_destroy(&(if)->if_addr_mtx) +#define IF_ADDR_LOCK(if) mtx_lock(&(if)->if_addr_mtx) +#define IF_ADDR_UNLOCK(if) mtx_unlock(&(if)->if_addr_mtx) +#define IF_ADDR_LOCK_ASSERT(if) mtx_assert(&(if)->if_addr_mtx, MA_OWNED) + +/* * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) * are queues of messages stored on ifqueue structures * (defined above). Entries are added to and deleted from these structures --- //depot/vendor/freebsd/src/sys/net/if_vlan.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/net/if_vlan.c 2005/07/19 21:29:46 @@ -188,21 +188,27 @@ } /* Now program new ones. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_NOWAIT); - if (mc == NULL) + if (mc == NULL) { + IF_ADDR_UNLOCK(ifp); return (ENOMEM); + } bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), (char *)&mc->mc_addr, ETHER_ADDR_LEN); SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries); bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), LLADDR(&sdl), ETHER_ADDR_LEN); error = if_addmulti(ifp_p, (struct sockaddr *)&sdl, &rifma); - if (error) + if (error) { + IF_ADDR_UNLOCK(ifp); return (error); + } } + IF_ADDR_UNLOCK(ifp); return (0); } --- //depot/vendor/freebsd/src/sys/net/rtsock.c 2005/07/15 09:51:31 +++ //depot/projects/netsmp/src/sys/net/rtsock.c 2005/07/19 21:29:46 @@ -1178,6 +1178,11 @@ continue; ifa = ifaddr_byindex(ifp->if_index); info.rti_info[RTAX_IFP] = ifa ? ifa->ifa_addr : NULL; + + /* + * XXXRW: Can't acquire IF_ADDR_LOCK() due to call + * to SYSCTL_OUT(). + */ TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (af && af != ifma->ifma_addr->sa_family) continue; --- //depot/vendor/freebsd/src/sys/netinet/igmp.c 2005/03/26 22:25:15 +++ //depot/projects/netsmp/src/sys/netinet/igmp.c 2005/07/22 02:49:24 @@ -286,6 +286,7 @@ * - Use the value specified in the query message as * the maximum timeout. */ + IN_MULTI_LOCK(); IN_FIRST_MULTI(step, inm); while (inm != NULL) { if (inm->inm_ifp == ifp && @@ -301,6 +302,7 @@ } IN_NEXT_MULTI(step, inm); } + IN_MULTI_UNLOCK(); break; @@ -343,14 +345,15 @@ * If we belong to the group being reported, stop * our timer for that group. */ + IN_MULTI_LOCK(); IN_LOOKUP_MULTI(igmp->igmp_group, ifp, inm); - if (inm != NULL) { inm->inm_timer = 0; ++igmpstat.igps_rcv_ourreports; inm->inm_state = IGMP_OTHERMEMBER; } + IN_MULTI_UNLOCK(); break; } @@ -367,6 +370,8 @@ { int s = splnet(); + IN_MULTI_LOCK_ASSERT(); + if (inm->inm_addr.s_addr == igmp_all_hosts_group || inm->inm_ifp->if_flags & IFF_LOOPBACK) { inm->inm_timer = 0; @@ -391,6 +396,8 @@ igmp_leavegroup(struct in_multi *inm) { + IN_MULTI_LOCK_ASSERT(); + if (inm->inm_state == IGMP_IREPORTEDLAST && inm->inm_addr.s_addr != igmp_all_hosts_group && !(inm->inm_ifp->if_flags & IFF_LOOPBACK) && @@ -414,6 +421,7 @@ return; s = splnet(); + IN_MULTI_LOCK(); igmp_timers_are_running = 0; IN_FIRST_MULTI(step, inm); while (inm != NULL) { @@ -427,6 +435,7 @@ } IN_NEXT_MULTI(step, inm); } + IN_MULTI_UNLOCK(); splx(s); } @@ -458,6 +467,8 @@ struct ip *ip; struct ip_moptions imo; + IN_MULTI_LOCK_ASSERT(); + MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) return; --- //depot/vendor/freebsd/src/sys/netinet/in.c 2005/06/02 00:07:10 +++ //depot/projects/netsmp/src/sys/netinet/in.c 2005/07/23 00:17:48 @@ -68,7 +68,14 @@ SYSCTL_INT(_net_inet_ip, OID_AUTO, subnets_are_local, CTLFLAG_RW, &subnetsarelocal, 0, "Treat all subnets as directly connected"); +/* + * The IPv4 multicast list (in_multihead and associated structures) + * are protected by the global in_multi_mtx. See in_var.h for + * more details. + */ struct in_multihead in_multihead; /* XXX BSS initialization */ +struct mtx in_multi_mtx; +MTX_SYSINIT(in_multi_mtx, &in_multi_mtx, "in_multi_mtx", MTX_DEF); extern struct inpcbinfo ripcbinfo; extern struct inpcbinfo udbinfo; @@ -949,8 +956,8 @@ int error; struct sockaddr_in sin; struct ifmultiaddr *ifma; - int s = splnet(); + IN_MULTI_LOCK(); /* * Call generic routine to add membership or increment * refcount. It wants addresses in the form of a sockaddr, @@ -962,7 +969,7 @@ sin.sin_addr = *ap; error = if_addmulti(ifp, (struct sockaddr *)&sin, &ifma); if (error) { - splx(s); + IN_MULTI_UNLOCK(); return 0; } @@ -971,16 +978,14 @@ * a new record. Otherwise, we are done. */ if (ifma->ifma_protospec != NULL) { - splx(s); + IN_MULTI_UNLOCK(); return ifma->ifma_protospec; } - /* XXX - if_addmulti uses M_WAITOK. Can this really be called - at interrupt time? If so, need to fix if_addmulti. XXX */ inm = (struct in_multi *)malloc(sizeof(*inm), M_IPMADDR, M_NOWAIT | M_ZERO); if (inm == NULL) { - splx(s); + IN_MULTI_UNLOCK(); return (NULL); } @@ -994,7 +999,7 @@ * Let IGMP know that we have joined a new IP multicast group. */ igmp_joingroup(inm); - splx(s); + IN_MULTI_UNLOCK(); return (inm); } @@ -1005,10 +1010,11 @@ in_delmulti(inm) register struct in_multi *inm; { - struct ifmultiaddr *ifma = inm->inm_ifma; + struct ifmultiaddr *ifma; struct in_multi my_inm; - int s = splnet(); + IN_MULTI_LOCK(); + ifma = inm->inm_ifma; my_inm.inm_ifp = NULL ; /* don't send the leave msg */ if (ifma->ifma_refcount == 1) { /* @@ -1026,5 +1032,5 @@ if_delmulti(ifma->ifma_ifp, ifma->ifma_addr); if (my_inm.inm_ifp != NULL) igmp_leavegroup(&my_inm); - splx(s); + IN_MULTI_UNLOCK(); } --- //depot/vendor/freebsd/src/sys/netinet/in_var.h 2005/01/07 01:52:23 +++ //depot/projects/netsmp/src/sys/netinet/in_var.h 2005/07/22 02:48:12 @@ -167,6 +167,17 @@ extern LIST_HEAD(in_multihead, in_multi) in_multihead; /* + * Lock macros for IPv4 layer multicast address lists. IPv4 lock goes + * before link layer multicast locks in the lock order. In most cases, + * consumers of IN_*_MULTI() macros should acquire the locks before + * calling them; users of the in_{add,del}multi() functions should not. + */ +extern struct mtx in_multi_mtx; +#define IN_MULTI_LOCK() mtx_lock(&in_multi_mtx) +#define IN_MULTI_UNLOCK() mtx_unlock(&in_multi_mtx) +#define IN_MULTI_LOCK_ASSERT() mtx_assert(&in_multi_mtx, MA_OWNED) + +/* * Structure used by macros below to remember position when stepping through * all of the in_multi records. */ @@ -177,6 +188,8 @@ /* * Macro for looking up the in_multi record for a given IP multicast address * on a given interface. If no matching record is found, "inm" is set null. + * + * Caller must hold IF_ADDR_LOCK(). */ #define IN_LOOKUP_MULTI(addr, ifp, inm) \ /* struct in_addr addr; */ \ @@ -185,6 +198,8 @@ do { \ struct ifmultiaddr *ifma; \ \ + IN_MULTI_LOCK_ASSERT(); \ + IF_ADDR_LOCK(ifp); \ TAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { \ if (ifma->ifma_addr->sa_family == AF_INET \ && ((struct sockaddr_in *)ifma->ifma_addr)->sin_addr.s_addr == \ @@ -192,6 +207,7 @@ break; \ } \ (inm) = ifma ? ifma->ifma_protospec : 0; \ + IF_ADDR_UNLOCK(ifp); \ } while(0) /* @@ -205,6 +221,7 @@ /* struct in_multistep step; */ \ /* struct in_multi *inm; */ \ do { \ + IN_MULTI_LOCK_ASSERT(); \ if (((inm) = (step).i_inm) != NULL) \ (step).i_inm = LIST_NEXT((step).i_inm, inm_link); \ } while(0) @@ -213,6 +230,7 @@ /* struct in_multistep step; */ \ /* struct in_multi *inm; */ \ do { \ + IN_MULTI_LOCK_ASSERT(); \ (step).i_inm = LIST_FIRST(&in_multihead); \ IN_NEXT_MULTI((step), (inm)); \ } while(0) --- //depot/vendor/freebsd/src/sys/netinet/ip_input.c 2005/07/19 12:16:03 +++ //depot/projects/netsmp/src/sys/netinet/ip_input.c 2005/07/22 02:49:24 @@ -607,7 +607,9 @@ * See if we belong to the destination multicast group on the * arrival interface. */ + IN_MULTI_LOCK(); IN_LOOKUP_MULTI(ip->ip_dst, m->m_pkthdr.rcvif, inm); + IN_MULTI_UNLOCK(); if (inm == NULL) { ipstat.ips_notmember++; m_freem(m); --- //depot/vendor/freebsd/src/sys/netinet/ip_output.c 2005/07/05 23:40:38 +++ //depot/projects/netsmp/src/sys/netinet/ip_output.c 2005/07/22 02:49:24 @@ -291,9 +291,15 @@ ip->ip_src = IA_SIN(ia)->sin_addr; } + /* + * XXXRW: Should the in_multi_mtx be held over + * ip_mloopback() or ip_mforward()? + */ + IN_MULTI_LOCK(); IN_LOOKUP_MULTI(ip->ip_dst, ifp, inm); if (inm != NULL && (imo == NULL || imo->imo_multicast_loop)) { + IN_MULTI_UNLOCK(); /* * If we belong to the destination multicast group * on the outgoing interface, and the caller did not @@ -302,6 +308,7 @@ ip_mloopback(ifp, m, dst, hlen); } else { + IN_MULTI_UNLOCK(); /* * If we are acting as a multicast router, perform * multicast forwarding as if the packet had just --- //depot/vendor/freebsd/src/sys/netinet6/in6_var.h 2005/02/22 13:06:15 +++ //depot/projects/netsmp/src/sys/netinet6/in6_var.h 2005/07/23 00:13:17 @@ -543,6 +543,7 @@ /* struct in6_multi *in6m; */ \ do { \ struct ifmultiaddr *ifma; \ + IF_ADDR_LOCK(ifp); \ TAILQ_FOREACH(ifma, &(ifp)->if_multiaddrs, ifma_link) { \ if (ifma->ifma_addr->sa_family == AF_INET6 \ && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \ @@ -550,6 +551,7 @@ break; \ } \ (in6m) = (struct in6_multi *)(ifma ? ifma->ifma_protospec : 0); \ + IF_ADDR_UNLOCK(ifp); \ } while(0) /* --- //depot/vendor/freebsd/src/sys/netinet6/mld6.c 2005/07/21 15:10:30 +++ //depot/projects/netsmp/src/sys/netinet6/mld6.c 2005/07/23 00:06:01 @@ -266,6 +266,7 @@ mld6_all_nodes_linklocal.s6_addr16[1] = htons(ifp->if_index); /* XXX */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET6) continue; @@ -296,6 +297,7 @@ } } } + IF_ADDR_UNLOCK(ifp); if (IN6_IS_ADDR_MC_LINKLOCAL(&mldh->mld_addr)) mldh->mld_addr.s6_addr16[1] = 0; /* XXX */ --- //depot/vendor/freebsd/src/sys/pci/if_dc.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/pci/if_dc.c 2005/07/19 21:29:46 @@ -1110,6 +1110,7 @@ else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1117,6 +1118,7 @@ LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); sp[h >> 4] |= htole32(1 << (h & 0xF)); } + IF_ADDR_UNLOCK(ifp); if (ifp->if_flags & IFF_BROADCAST) { h = dc_mchash_le(sc, ifp->if_broadcastaddr); @@ -1179,6 +1181,7 @@ return; /* Now program new ones. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1193,6 +1196,7 @@ else hashes[1] |= (1 << (h - 32)); } + IF_ADDR_UNLOCK(ifp); CSR_WRITE_4(sc, DC_AL_MAR0, hashes[0]); CSR_WRITE_4(sc, DC_AL_MAR1, hashes[1]); @@ -1250,6 +1254,7 @@ return; /* now program new ones */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1259,6 +1264,7 @@ else hashes[1] |= (1 << (h - 32)); } + IF_ADDR_UNLOCK(ifp); CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_MAR0); CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[0]); @@ -1302,6 +1308,7 @@ else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1309,6 +1316,7 @@ LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); sp[h >> 4] |= htole32(1 << (h & 0xF)); } + IF_ADDR_UNLOCK(ifp); if (ifp->if_flags & IFF_BROADCAST) { h = dc_mchash_le(sc, ifp->if_broadcastaddr); --- //depot/vendor/freebsd/src/sys/pci/if_de.c 2005/07/21 16:45:20 +++ //depot/projects/netsmp/src/sys/pci/if_de.c 2005/07/23 00:06:01 @@ -2968,6 +2968,7 @@ #endif multicnt = 0; + IF_ADDR_LOCK(sc->tulip_ifp); TAILQ_FOREACH(ifma, &sc->tulip_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family == AF_LINK) @@ -3089,6 +3090,7 @@ #endif } } + IF_ADDR_UNLOCK(sc->tulip_ifp); #if defined(IFF_ALLMULTI) if (sc->tulip_flags & TULIP_ALLMULTI) sc->tulip_ifp->if_flags |= IFF_ALLMULTI; --- //depot/vendor/freebsd/src/sys/pci/if_pcn.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/pci/if_pcn.c 2005/07/19 21:29:46 @@ -351,6 +351,7 @@ pcn_csr_write(sc, PCN_CSR_MAR0 + i, 0); /* now program new ones */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -358,6 +359,7 @@ ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; hashes[h >> 4] |= 1 << (h & 0xF); } + IF_ADDR_UNLOCK(ifp); for (i = 0; i < 4; i++) pcn_csr_write(sc, PCN_CSR_MAR0 + i, hashes[i]); --- //depot/vendor/freebsd/src/sys/pci/if_rl.c 2005/06/11 01:40:36 +++ //depot/projects/netsmp/src/sys/pci/if_rl.c 2005/07/19 21:29:46 @@ -685,6 +685,7 @@ CSR_WRITE_4(sc, RL_MAR4, 0); /* now program new ones */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -696,6 +697,7 @@ hashes[1] |= (1 << (h - 32)); mcnt++; } + IF_ADDR_UNLOCK(ifp); if (mcnt) rxfilt |= RL_RXCFG_RX_MULTI; --- //depot/vendor/freebsd/src/sys/pci/if_sf.c 2005/06/11 01:40:36 +++ //depot/projects/netsmp/src/sys/pci/if_sf.c 2005/07/19 21:29:46 @@ -431,6 +431,7 @@ SF_SETBIT(sc, SF_RXFILT, SF_RXFILT_ALLMULTI); } else { i = 1; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -449,6 +450,7 @@ sf_sethash(sc, LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 0); } + IF_ADDR_UNLOCK(ifp); } } --- //depot/vendor/freebsd/src/sys/pci/if_sis.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/pci/if_sis.c 2005/07/19 21:29:46 @@ -763,6 +763,7 @@ CSR_WRITE_4(sc, SIS_RXFILT_DATA, 0); } + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -775,6 +776,7 @@ bit -= 0x10; SIS_SETBIT(sc, SIS_RXFILT_DATA, (1 << bit)); } + IF_ADDR_UNLOCK(ifp); CSR_WRITE_4(sc, SIS_RXFILT_CTL, filtsave); @@ -813,6 +815,7 @@ for (i = 0; i < n; i++) hashes[i] = 0; i = 0; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -821,6 +824,7 @@ hashes[h >> 4] |= 1 << (h & 0xf); i++; } + IF_ADDR_UNLOCK(ifp); if (i > n) { ctl |= SIS_RXFILTCTL_ALLMULTI; for (i = 0; i < n; i++) --- //depot/vendor/freebsd/src/sys/pci/if_sk.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/pci/if_sk.c 2005/07/19 21:29:46 @@ -823,6 +823,7 @@ hashes[1] = 0xFFFFFFFF; } else { i = 1; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -855,6 +856,7 @@ else hashes[1] |= (1 << (h - 32)); } + IF_ADDR_UNLOCK(ifp); } switch(sc->sk_type) { --- //depot/vendor/freebsd/src/sys/pci/if_ste.c 2005/07/08 13:11:56 +++ //depot/projects/netsmp/src/sys/pci/if_ste.c 2005/07/19 21:29:46 @@ -579,6 +579,7 @@ CSR_WRITE_2(sc, STE_MAR3, 0); /* now program new ones */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -589,6 +590,7 @@ else hashes[1] |= (1 << (h - 32)); } + IF_ADDR_UNLOCK(ifp); CSR_WRITE_2(sc, STE_MAR0, hashes[0] & 0xFFFF); CSR_WRITE_2(sc, STE_MAR1, (hashes[0] >> 16) & 0xFFFF); --- //depot/vendor/freebsd/src/sys/pci/if_ti.c 2005/07/07 01:10:31 +++ //depot/projects/netsmp/src/sys/pci/if_ti.c 2005/07/19 21:29:46 @@ -1621,6 +1621,7 @@ } /* Now program new ones. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1634,6 +1635,7 @@ SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries); ti_add_mcast(sc, &mc->mc_addr); } + IF_ADDR_UNLOCK(ifp); /* Re-enable interrupts. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, intrs); --- //depot/vendor/freebsd/src/sys/pci/if_tl.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/pci/if_tl.c 2005/07/19 21:29:46 @@ -960,6 +960,7 @@ hashes[1] = 0xFFFFFFFF; } else { i = 1; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -982,6 +983,7 @@ else hashes[1] |= (1 << (h - 32)); } + IF_ADDR_UNLOCK(ifp); } tl_dio_write32(sc, TL_HASH1, hashes[0]); --- //depot/vendor/freebsd/src/sys/pci/if_vr.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/pci/if_vr.c 2005/07/19 21:29:46 @@ -533,6 +533,7 @@ CSR_WRITE_4(sc, VR_MAR1, 0); /* Now program new ones. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -544,6 +545,7 @@ hashes[1] |= (1 << (h - 32)); mcnt++; } + IF_ADDR_UNLOCK(ifp); if (mcnt) rxfilt |= VR_RXCFG_RX_MULTI; --- //depot/vendor/freebsd/src/sys/pci/if_wb.c 2005/06/10 16:51:34 +++ //depot/projects/netsmp/src/sys/pci/if_wb.c 2005/07/19 21:29:46 @@ -614,6 +614,7 @@ CSR_WRITE_4(sc, WB_MAR1, 0); /* now program new ones */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -625,6 +626,7 @@ hashes[1] |= (1 << (h - 32)); mcnt++; } + IF_ADDR_UNLOCK(ifp); if (mcnt) rxfilt |= WB_NETCFG_RX_MULTI; --- //depot/vendor/freebsd/src/sys/pci/if_xl.c 2005/07/13 14:10:33 +++ //depot/projects/netsmp/src/sys/pci/if_xl.c 2005/07/19 21:29:46 @@ -777,8 +777,10 @@ return; } + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) mcnt++; + IF_ADDR_UNLOCK(ifp); if (mcnt) rxfilt |= XL_RXFILTER_ALLMULTI; @@ -817,6 +819,7 @@ CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_HASH|i); /* now program new ones */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -838,6 +841,7 @@ h | XL_CMD_RX_SET_HASH | XL_HASH_SET); mcnt++; } + IF_ADDR_UNLOCK(ifp); if (mcnt) rxfilt |= XL_RXFILTER_MULTIHASH; From owner-freebsd-net@FreeBSD.ORG Sat Jul 23 00:39:40 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4EBFF16A41F; Sat, 23 Jul 2005 00:39:40 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 06F6043D48; Sat, 23 Jul 2005 00:39:40 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with ESMTP id 996C546B4F; Fri, 22 Jul 2005 20:39:39 -0400 (EDT) Date: Sat, 23 Jul 2005 01:40:20 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Ed Maste In-Reply-To: <20050723012046.K40216@fledge.watson.org> Message-ID: <20050723013902.L40216@fledge.watson.org> References: <42CEF0EB.4000107@borderware.com> <42D006DB.8080108@errno.com> <20050712150224.GA38249@sandvine.com> <20050712162332.Q79478@fledge.watson.org> <20050712220452.GB38249@sandvine.com> <20050723012046.K40216@fledge.watson.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-net@freebsd.org, gnn@FreeBSD.org Subject: Re: what to replace splnet in FreeBSD 5.x? 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: Sat, 23 Jul 2005 00:39:40 -0000 On Sat, 23 Jul 2005, Robert Watson wrote: > The attached patch introduces locking around the link layer and IPv4 > multicast address lists, as well as updates drivers to use the locking. > It's a fairly large diff, but other than the changes to if.c, in.c, and > igmp.c, is fairly mechanical. It may well correct the problem you've > been seeing. If possible, and given sufficient review, I'd like to get > this change into 6.0, especially given that it affects the layout of > struct ifnet which is part of the ABI for network interface device > drivers. Updated version of the patch at: http://www.watson.org/~robert/freebsd/netperf/20050523-multicast.diff Spl-related cleanups (no longer useful documentation of old synchronization in many places), lock order hard-coded into WITNESS order rather than dynamically detected. Robert N M Watson From owner-freebsd-net@FreeBSD.ORG Sat Jul 23 02:07:20 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C860F16A41F for ; Sat, 23 Jul 2005 02:07:20 +0000 (GMT) (envelope-from gtsang@lnxw.com) Received: from smtp.lnxw.com (smtp.lnxw.com [207.21.185.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8426E43D4C for ; Sat, 23 Jul 2005 02:07:20 +0000 (GMT) (envelope-from gtsang@lnxw.com) Received: from pop.lnxw.com (pop.lnxw.com [207.21.185.6]) by smtp.lnxw.com (8.13.1/8.13.1) with ESMTP id j6N27JFU018539; Fri, 22 Jul 2005 19:07:19 -0700 Received: from [207.21.185.19] (cerebrus.Lynuxworks.com [207.21.185.19]) by pop.lnxw.com (8.12.8/8.12.8) with ESMTP id j6N27IHD030467; Fri, 22 Jul 2005 19:07:18 -0700 Message-ID: <42E1A655.1080505@lynuxworks.com> Date: Fri, 22 Jul 2005 19:07:17 -0700 From: Gilbert Tsang Organization: LynuxWorks Inc. User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en To: Max Laier , freebsd-net@freebsd.org References: <16911.51264.86063.604597@canoe.dclg.ca> <200502140157.36085.max@love2party.net> In-Reply-To: <200502140157.36085.max@love2party.net> Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-milter 0.1 (newbast) (http://www.amavis.org/) MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: altq for vlans? 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: Sat, 23 Jul 2005 02:07:20 -0000 I believe the solution is not patching ALTQ to the VLAN driver, but rather make ALTQ recognize rules that classify according to fields in Layer 2 header (fields such as VLANid and Priority, other than just src/dst addr/port and protocol in IP header). For example, build filter rules that specify priority tracking according to the 3-bit field in the VLAN tag as per 802.1p. For example in /etc/altq.conf: interface vx0 bandwidth 100M cbq class cbq vx0 root_class NULL pbandwidth 100 class cbq vx0 vlan1_class root_class pbandwidth 80 filter vx0 cs1_class vlan1_class vlanprio 6 # priority 6 takes more bandwidth class cbq vx0 vlan2_class root_class pbandwidth 15 filter vx0 cs2_class vlan2_class vlanprio 4 # priority 4 takes less bandwidth The discussion (patch) back then is good for a FreeBSD configured as end-host, but not as a MAC bridge: [1]http://lists.freebsd.org/pipermail/freebsd-net/2005-January/006240. html Regards, Gilbert Tsang. Max Laier wrote: On Sunday 13 February 2005 22:36, David Gilbert wrote: Has anyone considered patching the vlan driver to support altq? I gather that since tun works, so should vlan. This should be a FAQ. Anyway, here is the story: While you can do ALTQ queueing on vlan interfaces the usefulness of this is very little. If the physical interface supports ALTQ it is *always* better to do the queueing there. If the physical interface does not support ALTQ it must be patched. [snipped] References 1. http://lists.freebsd.org/pipermail/freebsd-net/2005-January/006240.html From owner-freebsd-net@FreeBSD.ORG Sat Jul 23 02:56:45 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 983E516A41F for ; Sat, 23 Jul 2005 02:56:45 +0000 (GMT) (envelope-from julian@elischer.org) Received: from postoffice.vicor-nb.com (postoffice.vicor.com [69.26.56.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3CA6A43D46 for ; Sat, 23 Jul 2005 02:56:44 +0000 (GMT) (envelope-from julian@elischer.org) Received: from localhost (localhost [127.0.0.1]) by postoffice.vicor-nb.com (Postfix) with ESMTP id 853AA4CEA8C; Fri, 22 Jul 2005 00:00:15 -0700 (PDT) Received: from postoffice.vicor-nb.com ([127.0.0.1]) by localhost (postoffice.vicor-nb.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 50665-02; Fri, 22 Jul 2005 00:00:15 -0700 (PDT) Received: from bigwoop.vicor-nb.com (bigwoop.vicor-nb.com [208.206.78.2]) by postoffice.vicor-nb.com (Postfix) with ESMTP id 0FFBF4CEA8B; Fri, 22 Jul 2005 00:00:15 -0700 (PDT) Received: from [208.206.78.97] (julian.vicor-nb.com [208.206.78.97]) by bigwoop.vicor-nb.com (Postfix) with ESMTP id 010867A425; Fri, 22 Jul 2005 00:00:15 -0700 (PDT) Message-ID: <42E0997E.2050009@elischer.org> Date: Fri, 22 Jul 2005 00:00:14 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.8) Gecko/20050629 X-Accept-Language: en, hu MIME-Version: 1.0 To: Anders Persson References: <91885646-8E16-4D06-91D7-307DD5836475@cs.ucla.edu> In-Reply-To: <91885646-8E16-4D06-91D7-307DD5836475@cs.ucla.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postoffice.vicor.com Cc: freebsd-net@freebsd.org Subject: Re: interface cleanup 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: Sat, 23 Jul 2005 02:56:45 -0000 Anders Persson wrote: > Hi all, > > > I have not had time to go through netgraph enough yet, but does > anyone have some ideas how to avoid using kvm to obtain netgraph info? what info do you want to get that isn't already avaliable? > Thanks a lot, > Anders > _______________________________________________ > 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"