* [gentoo-user] Without udev, who/what names ethernet devices?
@ 2013-06-07 4:12 Chris Stankevitz
2013-06-07 8:06 ` Alan McKinnon
0 siblings, 1 reply; 7+ messages in thread
From: Chris Stankevitz @ 2013-06-07 4:12 UTC (permalink / raw
To: gentoo-user@lists.gentoo.org
Hello,
A USB serial device is identified by the characters "/dev/ttyUSB0".
One might call this string a "device on your filesystem" and it can be
opened/closed just like any other entry in the filesystem.
An ethernet device is sometimes represented by the string "eth0".
Regarding this string "eth0":
1. What does this string represent? Is it a file on a filesystem?
(no!) Is it okay for me to call it an "ethernet *device*"
2. Assuming udev is not running, who/what comes up with the name
"eth0"? How does that person/thing know how many ethernet devices
there are and in what order to enumerate them? What happens if
ethernet devices are dynamically added (e.g. a USB ethernet device or
a driver being loaded/unloaded)?
3. How does (2) change when udev is running?
Thank you,
Chris
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] Without udev, who/what names ethernet devices?
2013-06-07 4:12 [gentoo-user] Without udev, who/what names ethernet devices? Chris Stankevitz
@ 2013-06-07 8:06 ` Alan McKinnon
2013-06-07 13:47 ` Mick
2013-06-07 15:05 ` Chris Stankevitz
0 siblings, 2 replies; 7+ messages in thread
From: Alan McKinnon @ 2013-06-07 8:06 UTC (permalink / raw
To: gentoo-user
On 07/06/2013 06:12, Chris Stankevitz wrote:
> Hello,
>
> A USB serial device is identified by the characters "/dev/ttyUSB0".
> One might call this string a "device on your filesystem" and it can be
> opened/closed just like any other entry in the filesystem.
>
> An ethernet device is sometimes represented by the string "eth0".
> Regarding this string "eth0":
>
> 1. What does this string represent? Is it a file on a filesystem?
> (no!) Is it okay for me to call it an "ethernet *device*"
It's just a name. Your name is Chris, mine is Alan and it's is eth0.
We usually just call it an interface
>
> 2. Assuming udev is not running, who/what comes up with the name
> "eth0"? How does that person/thing know how many ethernet devices
> there are and in what order to enumerate them? What happens if
> ethernet devices are dynamically added (e.g. a USB ethernet device or
> a driver being loaded/unloaded)?
The kernel driver gives it that name based on what it finds when it
probes your hardware. Kernel drivers strives for some form of
consistency in picking names, but the order they are found in is
somewhat random-ish. This means you cannot guarantee that the number on
the end is always going to be the same every boot - hardware just does
not work that way
When you hotplug a device, the driver does what it's coded to do -
usually assign the next available number. There is no guarantee all
drivers will always do this always - it's by convention
>
> 3. How does (2) change when udev is running?
Depends.
If you like the kernel naming scheme and want to keep it, just tell udev
to not fiddle with names and keep them as they are.
If you like the way udev does things and want to go with it's scheme,
follow recent recommendations on this list. udev will rename the
interfaces to it's own scheme based on the rules you set up.
What you CANNOT do with udev is eg switch the names eth0 and eth1 around
after the kernel has named them. That was tried for years, it doesn't
work. So now udev never interferes with kernel namespace, it create it's
own namespace
For more info, research this list going back about 4 months. The whole
topic was discussed at length. Search for "udev persistent names". A
word of warning - it wasn't pretty at the time and nothing changed just
becuase those mails are now archived :-)
--
Alan McKinnon
alan.mckinnon@gmail.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] Without udev, who/what names ethernet devices?
2013-06-07 8:06 ` Alan McKinnon
@ 2013-06-07 13:47 ` Mick
2013-06-07 15:05 ` Chris Stankevitz
1 sibling, 0 replies; 7+ messages in thread
From: Mick @ 2013-06-07 13:47 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: Text/Plain, Size: 1144 bytes --]
On Friday 07 Jun 2013 09:06:47 Alan McKinnon wrote:
> On 07/06/2013 06:12, Chris Stankevitz wrote:
> > An ethernet device is sometimes represented by the string "eth0".
> > Regarding this string "eth0":
> >
> > 1. What does this string represent? Is it a file on a filesystem?
> > (no!) Is it okay for me to call it an "ethernet *device*"
[snip...]
> For more info, research this list going back about 4 months. The whole
> topic was discussed at length. Search for "udev persistent names". A
> word of warning - it wasn't pretty at the time and nothing changed just
> becuase those mails are now archived :-)
Let's hope that the mere mention of that thread does not kick off another
rant-storm about udev, systemd, banking bailouts, global warming, ... LOL!
More detail on the <aheam!> predictable interface naming scheme can be found
here:
http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
and some suggestions for upgrading to the latest stable version of udev in
Gentoo were published here:
http://wiki.gentoo.org/wiki/Udev/upgrade
HTH.
--
Regards,
Mick
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] Without udev, who/what names ethernet devices?
2013-06-07 8:06 ` Alan McKinnon
2013-06-07 13:47 ` Mick
@ 2013-06-07 15:05 ` Chris Stankevitz
2013-06-07 18:09 ` Samuli Suominen
1 sibling, 1 reply; 7+ messages in thread
From: Chris Stankevitz @ 2013-06-07 15:05 UTC (permalink / raw
To: gentoo-user@lists.gentoo.org
On Fri, Jun 7, 2013 at 1:06 AM, Alan McKinnon <alan.mckinnon@gmail.com> wrote:
>> Regarding this string "eth0":
>>
>> 1. What does this string represent? Is it a file on a filesystem?
>> (no!) Is it okay for me to call it an "ethernet *device*"
>
> It's just a name.
I'm interested in a bit more resolution here. I believe we
established that the name "eth0" is given by the kernel. Presumably
these names are made available through system calls. What is the name
of the system call that provides these monikers? I'm curious by what
moniker systemcalls refer to these devices. For example, is the
systemcall that retrieves these monikers called "GetEthernetNames"?
> What you CANNOT do with udev is eg switch the names eth0 and eth1 around
> after the kernel has named them. That was tried for years, it doesn't
> work. So now udev never interferes with kernel namespace, it create it's
> own namespace
Okay. From your description I conclude that there are two classes of
names for ethernet devices. "Kernel ethernet names" and "udev
ethernet names". When a userland utility (wuch as ifconfig) takes an
"ethernet device name" as input are they expecting a "kernel ethernet
name" or the "udev ethernet name"? That question can be answered with
a simple "kernel" or "udev" but I'm interested in a little more
detail. What do these userland utilities do with the name? Are these
utilities calling systemcalls such as
GivePropertiesOnEthernetNameInKernelNamespace("eth0")? Are they
establishing a connection to a udev server and querying based on udev
namespace names?
The goal of these questions is not for me to determine if udev is good
or bad, debate global warming, etc. I just want to technically
understand these names, what their differences are, where they come
from, how they are referred in various function calls, etc.
Chris
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] Without udev, who/what names ethernet devices?
2013-06-07 15:05 ` Chris Stankevitz
@ 2013-06-07 18:09 ` Samuli Suominen
2013-06-07 18:12 ` Samuli Suominen
0 siblings, 1 reply; 7+ messages in thread
From: Samuli Suominen @ 2013-06-07 18:09 UTC (permalink / raw
To: gentoo-user
On 07/06/13 18:05, Chris Stankevitz wrote:
> On Fri, Jun 7, 2013 at 1:06 AM, Alan McKinnon <alan.mckinnon@gmail.com> wrote:
>>> Regarding this string "eth0":
>>>
>>> 1. What does this string represent? Is it a file on a filesystem?
>>> (no!) Is it okay for me to call it an "ethernet *device*"
>>
>> It's just a name.
>
> I'm interested in a bit more resolution here. I believe we
> established that the name "eth0" is given by the kernel. Presumably
> these names are made available through system calls. What is the name
> of the system call that provides these monikers? I'm curious by what
> moniker systemcalls refer to these devices. For example, is the
> systemcall that retrieves these monikers called "GetEthernetNames"?
http://www.kernel.org/doc/htmldocs/device-drivers/API-device-rename.html
and top of this file will tell how the names calculate:
http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c#n20
>
>> What you CANNOT do with udev is eg switch the names eth0 and eth1 around
>> after the kernel has named them. That was tried for years, it doesn't
>> work. So now udev never interferes with kernel namespace, it create it's
>> own namespace
>
> Okay. From your description I conclude that there are two classes of
> names for ethernet devices. "Kernel ethernet names" and "udev
> ethernet names". When a userland utility (wuch as ifconfig) takes an
> "ethernet device name" as input are they expecting a "kernel ethernet
> name" or the "udev ethernet name"? That question can be answered with
> a simple "kernel" or "udev" but I'm interested in a little more
everything will use the same, which is whatever you last used to rename
the device as udev is userspace just as much `ip` command from iproute2
package is
boot -> kernel assigns eth0 -> the name is now eth0 to userspace -> at
this point you rename it to something else, using udev, ip, ipconfig, or
whatever and use it everywhere, or don't rename at all and keep using
the kernel assigned name
case1:
boot using net.ifnames=0 -> kernel assigns eth0 -> udev sees
net.ifnames=0 and doesn't rename to anything -> user uses eth0 in
whatever he is doing
case2:
boot with the default which is net.ifnames=1 -> kernel assigns to eth0
-> udev sees net-ifnames=1 and reads it's rules and renames accordingly
to for example enp1s0
> detail. What do these userland utilities do with the name? Are these
> utilities calling systemcalls such as
> GivePropertiesOnEthernetNameInKernelNamespace("eth0")? Are they
> establishing a connection to a udev server and querying based on udev
> namespace names?
>
> The goal of these questions is not for me to determine if udev is good
> or bad, debate global warming, etc. I just want to technically
> understand these names, what their differences are, where they come
> from, how they are referred in various function calls, etc.
hope above links help explaining in better...
>
> Chris
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] Without udev, who/what names ethernet devices?
2013-06-07 18:09 ` Samuli Suominen
@ 2013-06-07 18:12 ` Samuli Suominen
2013-06-07 18:35 ` Chris Stankevitz
0 siblings, 1 reply; 7+ messages in thread
From: Samuli Suominen @ 2013-06-07 18:12 UTC (permalink / raw
To: gentoo-user
On 07/06/13 21:09, Samuli Suominen wrote:
[ .. ]
One more link related,
http://cgit.freedesktop.org/systemd/systemd/commit/src/udev?id=97595710b77aa162ca5e20da57d0a1ed7355eaad
From there you can find the code that does the renaming in udev.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-user] Without udev, who/what names ethernet devices?
2013-06-07 18:12 ` Samuli Suominen
@ 2013-06-07 18:35 ` Chris Stankevitz
0 siblings, 0 replies; 7+ messages in thread
From: Chris Stankevitz @ 2013-06-07 18:35 UTC (permalink / raw
To: gentoo-user@lists.gentoo.org
On Fri, Jun 7, 2013 at 11:12 AM, Samuli Suominen <ssuominen@gentoo.org> wrote:
> http://cgit.freedesktop.org/systemd/systemd/commit/src/udev?id=97595710b77aa162ca5e20da57d0a1ed7355eaad
>
> From there you can find the code that does the renaming in udev.
Thank you for the description and links... that was the kind of info I
was hoping to get.
Chris
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-06-07 18:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-07 4:12 [gentoo-user] Without udev, who/what names ethernet devices? Chris Stankevitz
2013-06-07 8:06 ` Alan McKinnon
2013-06-07 13:47 ` Mick
2013-06-07 15:05 ` Chris Stankevitz
2013-06-07 18:09 ` Samuli Suominen
2013-06-07 18:12 ` Samuli Suominen
2013-06-07 18:35 ` Chris Stankevitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox