Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Oct 2003 09:57:21 +0200 (CEST)
From:      Harti Brandt <brandt@fokus.fraunhofer.de>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        Vincent Jardin <vjardin@wanadoo.fr>
Subject:   Re: adding if_dev member to struct ifnet
Message-ID:  <20031002095404.C11328@beagle.fokus.fraunhofer.de>
In-Reply-To: <20031001185458.GA29576@Odin.AC.HMC.Edu>
References:  <20030930174815.GC31908@Odin.AC.HMC.Edu> <20031001164036.GA1263@Odin.AC.HMC.Edu> <20031001185458.GA29576@Odin.AC.HMC.Edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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@fokus.fraunhofer.de, harti@freebsd.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031002095404.C11328>