1 |
On 07/06/13 18:05, Chris Stankevitz wrote: |
2 |
> On Fri, Jun 7, 2013 at 1:06 AM, Alan McKinnon <alan.mckinnon@×××××.com> wrote: |
3 |
>>> Regarding this string "eth0": |
4 |
>>> |
5 |
>>> 1. What does this string represent? Is it a file on a filesystem? |
6 |
>>> (no!) Is it okay for me to call it an "ethernet *device*" |
7 |
>> |
8 |
>> It's just a name. |
9 |
> |
10 |
> I'm interested in a bit more resolution here. I believe we |
11 |
> established that the name "eth0" is given by the kernel. Presumably |
12 |
> these names are made available through system calls. What is the name |
13 |
> of the system call that provides these monikers? I'm curious by what |
14 |
> moniker systemcalls refer to these devices. For example, is the |
15 |
> systemcall that retrieves these monikers called "GetEthernetNames"? |
16 |
|
17 |
http://www.kernel.org/doc/htmldocs/device-drivers/API-device-rename.html |
18 |
|
19 |
and top of this file will tell how the names calculate: |
20 |
|
21 |
http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c#n20 |
22 |
|
23 |
> |
24 |
>> What you CANNOT do with udev is eg switch the names eth0 and eth1 around |
25 |
>> after the kernel has named them. That was tried for years, it doesn't |
26 |
>> work. So now udev never interferes with kernel namespace, it create it's |
27 |
>> own namespace |
28 |
> |
29 |
> Okay. From your description I conclude that there are two classes of |
30 |
> names for ethernet devices. "Kernel ethernet names" and "udev |
31 |
> ethernet names". When a userland utility (wuch as ifconfig) takes an |
32 |
> "ethernet device name" as input are they expecting a "kernel ethernet |
33 |
> name" or the "udev ethernet name"? That question can be answered with |
34 |
> a simple "kernel" or "udev" but I'm interested in a little more |
35 |
|
36 |
everything will use the same, which is whatever you last used to rename |
37 |
the device as udev is userspace just as much `ip` command from iproute2 |
38 |
package is |
39 |
boot -> kernel assigns eth0 -> the name is now eth0 to userspace -> at |
40 |
this point you rename it to something else, using udev, ip, ipconfig, or |
41 |
whatever and use it everywhere, or don't rename at all and keep using |
42 |
the kernel assigned name |
43 |
|
44 |
case1: |
45 |
boot using net.ifnames=0 -> kernel assigns eth0 -> udev sees |
46 |
net.ifnames=0 and doesn't rename to anything -> user uses eth0 in |
47 |
whatever he is doing |
48 |
|
49 |
case2: |
50 |
boot with the default which is net.ifnames=1 -> kernel assigns to eth0 |
51 |
-> udev sees net-ifnames=1 and reads it's rules and renames accordingly |
52 |
to for example enp1s0 |
53 |
|
54 |
> detail. What do these userland utilities do with the name? Are these |
55 |
> utilities calling systemcalls such as |
56 |
> GivePropertiesOnEthernetNameInKernelNamespace("eth0")? Are they |
57 |
> establishing a connection to a udev server and querying based on udev |
58 |
> namespace names? |
59 |
> |
60 |
> The goal of these questions is not for me to determine if udev is good |
61 |
> or bad, debate global warming, etc. I just want to technically |
62 |
> understand these names, what their differences are, where they come |
63 |
> from, how they are referred in various function calls, etc. |
64 |
|
65 |
hope above links help explaining in better... |
66 |
|
67 |
> |
68 |
> Chris |
69 |
> |