tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Patch to implement SIOCGIFINDEX

On Apr 2, 2013, at 4:55 PM, Lloyd Parkes 
<> wrote:
> On 3/04/2013, at 5:52 AM, Ty Sarna <> wrote:
>> Still, what I've done now is to add an "ifname" field as well. By default 
>> it's
>> ignored and so the interface is backwards compatible, but I allow setting the
>> index to -1, in which case the name is used instead.
> I'm pretty sure that ifname isn't especially useful.

It's really the most useful thing for this use (sockaddr_can), because it's
stable across the attachment life of an interface, and it's the only identifier
a user knows for an interface anyway -- so it makes the most sense to use it
directly rather than indirecting through index numbers, which only add fragility
anyway, as we've seen.

> Something working as a VPN concentrator for remote users will have a lot of 
> churn and a lot of reused interfaces names. I would look at using a 
> generation number, an unsigned 32 bit number that is incremented every time 
> an interface is added or removed. Maybe we even have one already? That way 
> someone who really cares can just check the generation number and the people 
> that don't care can ignore it.

That's a completely different use case. But, I think there is indeed a 
number within the interface system, though I don't know if it's exposed outside
the kernel or not.

Home | Main Index | Thread Index | Old Index