Date: Thu, 29 Apr 2004 14:22:47 +0200 From: Max Laier <max@love2party.net> To: freebsd-net@freebsd.org Cc: Artis Caune <ac-lists@latnet.lv> Subject: Re: 'struct ifnet' question! Message-ID: <200404291422.56670.max@love2party.net> In-Reply-To: <opr67qrrcccpfy5d@mail.latnet.lv> References: <opr67qrrcccpfy5d@mail.latnet.lv>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404291422.56670.max>