adding if_dev member to struct ifnet

Harti Brandt brandt at fokus.fraunhofer.de
Thu Oct 2 00:57:26 PDT 2003


On Wed, 1 Oct 2003, Brooks Davis wrote:

BD>On Wed, Oct 01, 2003 at 08:38:13PM +0200, Vincent Jardin wrote:
BD>> > > messier BD>example is in the new ATM code where interfaces are looked up
BD>> > > by name.
BD>> > >
BD>> > > Where is this?
BD>> >
BD>> > One example would be in sys/netatm/atm_if.c around line 1081.
BD>>
BD>> Do you mean pif_name and pif_unit ?
BD>
BD>Yes.
BD>
BD>> This code could be updated. It uses pif_unit and pif_name that could become
BD>> pif_xname.
BD>
BD>I've done something like this in my perforce branch
BD>(//depot/user/brooks/xname/...), but it isn't a real solution because
BD>I plan to follow up by breaking the assumption that if_xname remains
BD>constant for the life of the interface.  If either if_dev or
BD>if_d{name,unit} are added, you could use those as you do now.

I think we need one of those to support SNMP semantics for interfaces.
The SNMP RFC says, that the interface index to physical instance binding
must be persistant even if the interface is renamed. This requires an
identification for the interface that is tied to the hardware.

BD>You might consider using if_index instead since that's both unchanged
BD>over the life of the device and quick to check.

The PIF has no ifnet and hence no if_index.

harti

BD>
BD>>                     snprintf(nip->nif_xname, sizeof(nip->nif_xname), "%s%d",
BD>>                        asr->asr_nif_pref, count);
BD>>                     nip->nif_sel = count; /* we need to keep a selector to
BD>> build the UNI ATM address  */
BD>>
BD>>                     ifp->if_xname = nip->nif_xname;
BD>
BD>Actually, this needs to be a strlcpy.  if_xname is stored in the ifnet,
BD>not as a pointer, but that's a minor detail.
BD>
BD>-- Brooks
BD>
BD>

-- 
harti brandt,
http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private
brandt at fokus.fraunhofer.de, harti at freebsd.org


More information about the freebsd-arch mailing list