How to map network device names to module names?

How to map network device names to module names?

Post by Krell » Wed, 22 Jan 2003 20:07:45



I've a question: What is the best way to map network devices name to
their associated module names?

By this, I mean mapping network devices as they appear in "ifconfig"
(eth0, eth1, eth2, ppp0, tr0, and so on) to the names of the
appropriate kernel modules for each driver (such as eepro100, e1000,
3c509, and so on).

I know about /etc/modules.conf, but the alias mappings in there are
only shortcuts to make usage more convenient.  They are not binding.
For example, if the user insmod's a module into memory manually, it
may allocate some network devices for itself that do not appear in
this file.  Since Linux allocates network device names in strict
numerical sequence, it could cause mass confusion if their order gets
shuffled around!

Is there a way to see, for sure, what the kernel currently considers
to be the mapping of device names to modules?

This would be a boon to GUI configuration tools, which currently have
to guess (by scanning modules.conf, the /etc/sysconfig directory on
Red Hat, the MAC addresses of cards, or some other heuristic).

Perhaps a /proc file, perhaps /proc/net/devices, with a format like
this:

# ifindex  devname  modname  modinstance
0          lo
1          eth0     eepro100 0
2          eth1     eepro100 1
3          eth2     e1000    0

This is a system with a localhost device compiled directly into the
kernel (so no module information is available), two eepro100 cards
installed, and one e1000 card installed.

"ifindex" is the interface index, used with traditional ioctl() calls
such as SIOCGIFCONF.
"devname" is the device name, as it appears to the user tools
(ifconfig, etc.).
"modname" is the name of that interface's device driver module.  If a
device has been compiled directly into the kernel, it is blank.
"modinstance" is the internal number of the interface, as used within
the driver for that device.  This could be useful when passing command
line configuration parameters to a module that supports multiple
cards, to see which card actually corresponds to which parameter
setting!

Does something like this already exist?

To me, this seems useful, and easy to add.  I could probably code up a
quick patch to implement this if anyone is interested.

Thanks!
Josh

krellan -=at=- krellan =-dot-= com
(Please use this address to avoid spam-filtering)

 
 
 

How to map network device names to module names?

Post by Andi Klee » Wed, 22 Jan 2003 21:35:32



> Is there a way to see, for sure, what the kernel currently considers
> to be the mapping of device names to modules?

The mapping depends on the module load order unfortunately, which
is when you use kmod like most distributions do, usually depends on
the order the init scripts initialize the network interface.

One alternative is to load the modules first, then use nameif(8)
which allows you to assign interface names to MAC addresses.
(it has to be done before the ip addresses are set but after the
modules have been loaded). Beware that it should be only used for
real interfaces, not alias interfaces.

-Andi

 
 
 

How to map network device names to module names?

Post by Kasper Dupon » Wed, 22 Jan 2003 21:38:30



> Does something like this already exist?

I haven't seen such a thing. But it surely could be useful
in some cases. But wouldn't it be as useful to be able to
specify the name as argument for the moudle instead of
having everything named ethNNN, then we might even avoid
the renaming of devices if load order is changed.

Quote:

> To me, this seems useful, and easy to add.

Useful yes, but easy? I don't know. Does the kernel keep
track of this kind of information? In the filesystem
implementation a lot of structs contains a struct module
* owner field, does something similar exist for network
devices?

Quote:> I could probably code up a
> quick patch to implement this if anyone is interested.

Renaming of network devices can be a problem. I don't
know if it is important enough for anybody to care about
it. Anyway I would be interested in seeing what you can
come up with.

--
Kasper Dupont -- der bruger for meget tid p? usenet.

for(_=52;_;(_%5)||(_/=5),(_%5)&&(_-=2))putchar(_);

 
 
 

How to map network device names to module names?

Post by Joshua Jone » Thu, 23 Jan 2003 04:26:50



> I've a question: What is the best way to map network devices name to
> their associated module names?

> Does something like this already exist?

Well, I've used Intel's "iANS" network redundancy software, and you
can specify a name for a new virtual interface, which it creates.
Maybe you could look at this to see how they do it.

--
 josh(at)cc.gatech.edu  |  http://intmain.net:800

 7713 local keystrokes since last reboot (1 day ago)

 
 
 

1. How to map device name to module name?

I've a question: What is the best way to map a network device name to
a module name?

By this, I mean mapping network devices as they appear in "ifconfig"
(eth0, eth1, eth2, ppp0, tr0, and so on) to the names of the
appropriate kernel modules for each driver (such as eepro100, e1000,
3c509, and so on).

I know about /etc/modules.conf, but the alias mappings in there are
only shortcuts to make usage more convenient.  They are not binding.
For example, if the user insmod's a module into memory manually, it
may allocate some network devices for itself that do not appear in
this file.  Since Linux allocates network device names in strict
numerical sequence, it could cause mass confusion if their order gets
shuffled around!

Is there a way to see, for sure, what the kernel currently considers
to be the mapping of device names to modules?

This would be a boon to GUI configuration tools, which currently have
to guess (by scanning modules.conf, the /etc/sysconfig directory on
Red Hat, the MAC addresses of cards, or some other heuristic).

Perhaps a /proc file, perhaps /proc/net/devices, with a format like
this:

# ifindex  devname  modname  modinstance
0          lo
1          eth0     eepro100 0
2          eth1     eepro100 1
3          eth2     e1000    0

This is a system with a localhost device compiled directly into the
kernel (so no module information is available), two eepro100 cards
installed, and one e1000 card installed.

"ifindex" is the interface index, used with traditional ioctl() calls
such as SIOCGIFCONF.
"devname" is the device name, as it appears to the user tools
(ifconfig, etc.).
"modname" is the name of that interface's device driver module.  If a
device has been compiled directly into the kernel, it is blank.
"modinstance" is the internal number of the interface, as used within
the driver for that device.  This could be useful when passing command
line configuration parameters to a module that supports multiple
cards, to see which card actually corresponds to which parameter
setting!

Does something like this already exist?

To me, this seems useful, and easy to add.  I could probably code up a
quick patch to implement this if anyone is interested.

Thanks!
Josh

krellan -=at=- krellan =-dot-= com
(Please use this address to avoid spam-filtering)

2. Linux on a NT domain

3. mapping device name and minor device number

4. UNISYS UNIX

5. Host name, primary name, domain name...?

6. HP DeskJet 1220C/PS

7. Which named ?...Solaris 2.5 in.named or Berkley named ?

8. Syquest EZFlyer 320

9. Translating device name to readable name

10. Bluez on familiar arm-linux (ipaq 3870), cannot get class name and device name

11. how does linux map devices names (under /dev/ ) into physical ports?

12. Mapping device name.

13. how to get TUN device's name and its map fd