Mapping network device names to their kernel modules?
From: JoSH Lehan (krellan_at_gmail.com)
Date: 10/26/04
- Previous message: Todd Knarr: "Re: kernel API mapping"
- Next in thread: Pete Zaitcev (OTID1): "Re: Mapping network device names to their kernel modules?"
- Reply: Pete Zaitcev (OTID1): "Re: Mapping network device names to their kernel modules?"
- Reply: John Fusco: "Re: Mapping network device names to their kernel modules?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Oct 2004 16:19:30 -0700
Is there a reliable way to map network device names (for instance
eth0, eth1, eth2, etc.) to the kernel modules responsible for loading
them?
There are user configuration files that can be set to manually keep
track of this information, such as "alias eth0 3c59x" in
/etc/modules.conf, but this must be manually maintained by the user
(or configuration utility) and is subject to breakage when the user
adds/removes various network cards.
What about at system installation time -- how would an installer
program know which kernel modules are responsible for creating various
network device names?
My guess is that a system installer will just attempt to load every
network device module in order, and query the table of device names
(/proc/net/dev) after *each* module has finished attempting to load.
The installer will watch for new devices appearing in this table, and
associate each new device with the module that was most recently
loaded. That way, a table will be built up over time, and the
information can be written out to /etc/modules.conf in the usual way.
The problem with this is that it breaks whenever the user adds or
removes (or even rearranges!) network cards after system installation.
If a new eth3 device were to suddenly appear in the system, for
instance, it would have no information. The user would need to know
which kernel module was responsible for recognizing it, and
automatically add it to the table in /etc/modules.conf so that the
kernel would load it upon demand. It could get very confusing if the
addition of the card changed the loading order of the modules, so that
eth0/eth1/eth2 were now pointing to different cards! This could even
be a security issue, for instance if a firewall were to become
misconfigured to allow packets through the wrong interfaces.
Are there any files in the /proc directory that contains this
information? /proc/modules has the names of modules that are
currently loaded and their usage count (e.g. the number of cards that
were recognized by each Ethernet device driver module). /proc/net/dev
has a list of user-visible network device names (eth0, eth1, and so
on). I couldn't find a file that relates these device names to their
relevant kernel modules. It would be wonderful if there was a way of
gathering this information and putting it all together.
Does anybody also see a useful need for this feature? Has such a
thing been already implemented, and if so, where?
Thanks!
Josh
krellan -at- gmail -dot- com
- Previous message: Todd Knarr: "Re: kernel API mapping"
- Next in thread: Pete Zaitcev (OTID1): "Re: Mapping network device names to their kernel modules?"
- Reply: Pete Zaitcev (OTID1): "Re: Mapping network device names to their kernel modules?"
- Reply: John Fusco: "Re: Mapping network device names to their kernel modules?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]