Oh, hotplug, how do I hate thee? Let me count the ways...
First, the context. ifup, which I guess everyone knows by now, is a little
tool that brings network interfaces up. Hotplug, spawn of Satan that
it is, is a gizmo that the kernel calls whenever new hardware appears
so that userspace can do handle it -- so when you plug in a USB network
card it can be automagically configured, and so forth, in much the same
way as PCMCIA has worked forever.
Unfortunately, being the work of underbeings from Hell, hotplug isn't
quite this simple: in fact, it will tell userspace about every interface
that suddenly appears, whether it was physically added to the machine,
or has always been there. Which means that whenever you do:
# modprobe netdriver
the kernel will helpfully run `ifup ethX' for you behind the scenes.
This is annoying in and of itself -- you might not want this to
come up at all, you might just want to do some anonymous snooping or
something (see Bug#172671, eg) and if you're modprobe is a pre-up in
your /etc/network/interfaces you've got an irritating race condition
(which shouldn't cause problems now ifupdown does locking, but is still
obnoxious).
But, while it's annoying, that's not a major problem. What is,
is that "modprobe netdriver" will be invoked on your behalf by both
/etc/rcS.d/S20modutils and /etc/rcS.d/S36discover, and possibly other
things. hotplug will run ifup at this point, which is bad, because
S39ifupdown clears ifup's statefile, causing all sorts of confusion
(see Bug#141399, eg).
In essence, the question is, given:
a PCI network card is installed
the driver for that card is compiled in as a module
hotplug is installed
its module is listed in /etc/modules or discover is installed
what should happen, and how should it happen? Should:
* it behave as if the driver was compiled in directly (not as a
module) -- ie, hotplug not called at all; it only gets enabled
automatically if /etc/network/interfaces has an "auto" line
for it ?
* it get hotplug'ed just like dynamic cards, but in a way that
doesn't break ?
* hotplug not be called by the kernel for devices that were
already attached when the module was loaded ?
* something else ?
If hotplug's not going to get called for it, how do we arrange it? Can
we set /proc/sys/kernel/hotplug to /bin/true until we've finished booting?
Or is there some way to special case modprobe so that hotplug doesn't get
called for the modules you're loading? Or is something else possible?
If hotplug _is_ going to get called for it, it'll have to be delayed
somehow, at least until /etc/network/ifstate is writable. How can we
do that?
Cheers,
aj
--
Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. GPG signed mail preferred.
``Dear Anthony Towns: [...] Congratulations --
you are now certified as a Red Hat Certified Engineer!''
Attachment:
pgp4a5eKHYISp.pgp
Description: PGP signature