[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <EDA0A4495861324DA2618B4C45DCB3EE5895AF@blrx3m08.blr.amer.dell.com>
Date: Mon, 19 Oct 2009 17:00:50 +0530
From: <Narendra_K@...l.com>
To: <dannf@...com>, <bhutchings@...arflare.com>
Cc: <netdev@...r.kernel.org>, <linux-hotplug@...r.kernel.org>,
<Matt_Domsch@...l.com>, <Jordan_Hargrave@...l.com>,
<Charles_Rose@...l.com>
Subject: RE: PATCH: Network Device Naming mechanism and policy
>> > > And how would the regular file look like in terms of holding
>> > > ifindex of the interface, which can be passed to libnetdevname.
>> >
>> > I can't think of anything we need to store in the regular file. If
>> > we have the kernel name for the device, we can look up the ifindex
>> > in /sys. Correct me if I'm wrong, but storing it ourselves seems
>> > redundant.
>>
>> But the name of a netdev can change whereas its ifindex never does.
>> Identifying netdevs by name would require additional work to update
>> the links when a netdev is renamed and would still be prone to race
>> conditions. This is why Narendra and Matt were proposing to
>store the
>> ifindex in the node all along...
>
>Matt, Ben and I talked about a few other possibilities on IRC.
>The one I like the most at the moment is an idea Ben had to
>creat dummy files named after the ifindex. Then, use symlinks
>for the kernel name and the various by-$property
>subdirectories. This means the KOBJ events will need to expose
>the ifindex.
>
I suppose the KOBJ events already expose the ifindex of a network
interface. The file "/sys/class/net/ethN/uevent" contains INTERFACE=ethN
and IFINDEX=n already. But it looks like udev doesn't use it in any way.
For example, with the kernel patch the "/sys/class/net/ethN/uevent"
contains in addition to the above details, MAJOR=M and MINOR=m which the
udev knows how to make use of with a rule like
SUBSYSTEM=="net", KERNEL!="tun", NAME="netdev/%k", MODE="0600".
>I'm a novice at net programming, but I'm told that ifindex is
>the information apps ultimately require here.
Yes. The minor number of the device node is retreived by libnetdevname
by "stat"ing the pathname which happens to be ifindex of the device and
it is mapped to corresponding kernel name by "if_indextoname" call.
With regards,
Narendra K
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists