'struct ifnet' question!

From: Artis Caune (ac-lists_at_latnet.lv)
Date: 04/29/04

  • Next message: Max Laier: "Re: 'struct ifnet' question!"
    To: net@freebsd.org
    Date: Thu, 29 Apr 2004 13:15:17 +0300
    
    

    I'm writing kld module for traffic shaping (5.x only).
    It use PFIL hooks.

    There will be seperate decision trees for
    every interface + IN/OUT pair.

    Let's say we have rules:
        shape in on fxp0 ...
        shape out on fxp0 ...
        shape in on vlan0 ...
    in this example we have 3 decision trees:
         - rules with 'fxp0 in'
         - rules with 'fxp0 out'
         - rules with 'vlan0 in'

    When PFIL pass packet, I need find pointer
    to right decision tree:
         tree = find_decision_tree(ifp->if_xname, direction);

    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?

    thanks,

    -- 
    Artis
    _______________________________________________
    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"
    

  • Next message: Max Laier: "Re: 'struct ifnet' question!"

    Relevant Pages