From owner-freebsd-net@FreeBSD.ORG Thu Apr 29 05:23:04 2004 Return-Path: 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 AC00C16A4CF for ; Thu, 29 Apr 2004 05:23:04 -0700 (PDT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.184]) by mx1.FreeBSD.org (Postfix) with ESMTP id C454B43D58 for ; Thu, 29 Apr 2004 05:23:03 -0700 (PDT) (envelope-from max@love2party.net) Received: from [212.227.126.161] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1BJAZD-0003wV-00; Thu, 29 Apr 2004 14:23:03 +0200 Received: from [80.131.159.221] (helo=donor.laier.local) by mrelayng.kundenserver.de with asmtp (TLSv1:RC4-MD5:128) (Exim 3.35 #1) id 1BJAZ9-00064j-00; Thu, 29 Apr 2004 14:23:01 +0200 From: Max Laier To: freebsd-net@freebsd.org Date: Thu, 29 Apr 2004 14:22:47 +0200 User-Agent: KMail/1.6.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Boundary-03=_gOPkAMMSZWkUB4J"; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200404291422.56670.max@love2party.net> X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:e28873fbe4dbe612ce62ab869898ff08 X-Content-Filtered-By: Mailman/MimeDel 2.1.1 cc: Artis Caune Subject: Re: 'struct ifnet' question! X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 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, 29 Apr 2004 12:23:04 -0000 --Boundary-03=_gOPkAMMSZWkUB4J Content-Type: multipart/mixed; boundary="Boundary-01=_XOPkAY1L7EC/vgS" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_XOPkAY1L7EC/vgS Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 29 April 2004 12:15, Artis Caune wrote: <...> > Yeh, this works as expected, but I wonder if I can > use ifp->index instead of ifp->if_xname. > Using 'index + array pointer feature' I can find decision > tree in just one? memory access step, compared to > if_xname where I should make expensive strcmp() calls. ;) > > I'm worried about 'dynamic' interfaces. e.x: > # ifconfig vlan0 create; ... > # load rules with 'shape in on vlan0' > # ifconfig vlan0 destroy > # ifconfig vlan0 create; ... > > I belive at this point if_index is not the same > when rules was loaded. How safe is to use if_index > instead of if_xname? How safe is to use if_xname > with interface renaming feature (-current)? > > Is there some way to track interface changes events? Yes there is, in -current you will find some eventhandlers (in if_var.h and= =20 if_clone.h) which allow you to get a notification when an interface arrives= =20 or leaves. Pf (from OpenBSD 3.5) will use them to do exactly what you are=20 planning, to have O(1) interface look-ups. The other (big) problem in this field is, how to handle yet unknown interfa= ces=20 (e.g. USB/Cardbus/ppp/tun/...). Attached is my WIP version of the pf interface handling, which might be a b= it=20 too complex for your purpose, but should give you the idea. =2D-=20 Best regards, | mlaier@freebsd.org Max Laier | ICQ #67774661 http://pf4freebsd.love2party.net/ | mlaier@EFnet --Boundary-01=_XOPkAY1L7EC/vgS-- --Boundary-03=_gOPkAMMSZWkUB4J Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQBAkPOgXyyEoT62BG0RAo4RAJ42m8ilLZMm3Vn8CViL4Bhid0XisgCeMA2g K23VgL7OtBwNpk/g/Pt5C18= =JAqU -----END PGP SIGNATURE----- --Boundary-03=_gOPkAMMSZWkUB4J--