On Sun, 27.01.13 01:06, Oron Peled (o...@actcom.co.il) wrote:

> On Wednesday 23 January 2013 23:49:48 Kay Sievers wrote:
> > ...
> > We had no better idea really, than to copy the successful model we do
> > for disks (and other subsystems) with /dev/disk/by-*/ symlinks. It was
> > a well-known scheme, but it was certainly not know for network devices
> > so far. So we picked up the basic ideas from biosdevname and combined
> > them with the proven scheme we do for all other subsystems in udev.
> > This necessarily lead to different names, but from udev's point of
> > view they are entirely justified.
> 
> The /dev/disk/... is nice because of *two* properties:
>  * It indeed provides unique, persistent names
>  * But people can still use /dev/sda
>    Which is useful in the super-common case of single disk PC
> 
> I.e: the predictable names are just aliases for the traditional names.
> 
> In another mail on this thread, someone mentioned that this possibility
> was looked into, but the related kernel code cannot be easily modified
> to support multiple-names per interface.
> 
> However, maybe implementing this aliasing in user-space is more tractable?
> 
> IMO, my following proposal is only feasible if (and it's a big iff),
> the number of system calls and library functions that accept a network
> interface name is not large [things like if_nameindex(), the "ifreq" 
> ioctl()'s, etc.]
> 
> If that's the case, we can map "predictable" names to traditional ones
> in user-space, on the entry to said library functions, or entry
> to the said glibc syscall wrappers.
> 
> Example of a possible mapping scheme:
>  * Have udev create a symlink that maps the predictable name into the
>    string of the traditional name. E.g:
>            /dev/netdev/enp2s0 -> eth0
> 
>  * Of course, there's no eth0 file, but nevertheless the symlink can
>    contain this string.
> 
>  * Now implement ifname_mapto(const char *name, char *new_name) as follows:
>    - If there's no /dev/netdev/<name>, use <name> as <new_name> (identity)
>    - Otherwise, <new_name> is the result of readlink("/dev/netdev/<name>")
> 
> Now if there aren't zillions of functions that process network interface
> names, modifying them seems reasonable. The advantage is that
> it allows the use the traditional names for the most common cases
> (e.g: a laptop with one eth0 and one wlan0) while still providing a
> predictable naming to be used when needed.

Actually there quite a few of kernel-level interfaces that expose
interface names, and applications use them. There's netlink, there are
the ioctl()s, there is /sys, there's /proc/sys, and there's more. For
many of those interfaces the libc doesn't even know that has something
to do with networking.

Hence: if people want aliasing, this would have to happen in the kernel, but
even then it's really complex, since many apis don't really cater for
that, and this would mean breakage.

We figured in this it's better to just stick to a single name for each
iface, pick a good default scheme for it, and support alternative
schemes.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel

Reply via email to