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 
if_clone.h) which allow you to get a notification when an interface arrives 
or leaves. Pf (from OpenBSD 3.5) will use them to do exactly what you are 
planning, to have O(1) interface look-ups.

The other (big) problem in this field is, how to handle yet unknown interfaces 
(e.g. USB/Cardbus/ppp/tun/...).

Attached is my WIP version of the pf interface handling, which might be a bit 
too complex for your purpose, but should give you the idea.

-- 
Best regards,                           | [EMAIL PROTECTED]
Max Laier                               | ICQ #67774661
http://pf4freebsd.love2party.net/       | [EMAIL PROTECTED]

Attachment: pgp00000.pgp
Description: signature

Reply via email to