| Summary: | hotplug can cause net scripts to start in wrong order | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Matt Drew (RETIRED) <aetius> |
| Component: | [OLD] baselayout | Assignee: | Gentoo's Team for Core System packages <base-system> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | normal | CC: | base-system, manuel, remy |
| Priority: | High | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Attachments: |
Patch to make net.agent ignore interfaces that should be brought up in a runlevel.
modifies /etc/hotplug/net.agent to keep network interfaces from being started in non-network runlevels |
||
|
Description
Matt Drew (RETIRED)
2004-07-13 12:35:01 UTC
Created attachment 42637 [details, diff]
Patch to make net.agent ignore interfaces that should be brought up in a runlevel.
In my opinion, hotplug should not start any network interfaces that are started by scripts linked into any of the runlevel directories - if you put an interface into a runlevel with "rc-update add eth0 default", there's an expectation that the interface won't come up until the runlevel is started. I have attached a patch to net.agent that will cause it to ignore any interfaces that have been set to start up in a runlevel. I would go one step further and say that I don't think hotplug should be bringing up any interfaces at all -- that should be controlled by the runlevel scripts. Allowing hotplug to (silently!) bring up interfaces I think would be possibly dangerous, and at the very least unexpected for most users. I don't agree with that. I find it most useful that I can plug in a PCMCIA WiFi card, and it starts automatically. Sounds like there are requirements on both sides. My fix works for Remy, as long as he doesn't put the net.* entry in the runlevel. But I can see people with the requirement "only hotplug this interface if we're in this runlevel". It seems like we need a map of runlevels at which a specific interface should/should not be active. Perhaps we can make the semantics "if the interface is in a certain runlevel, when that runlevel becomes active set the "hotplugging allowed for this interface" flag and bring up the interface if the hardware is plugged in. When you leave the runlevel for another that does not have the interface in it, unset the hotplug flag and shut down the interface if active." This should give the best of both worlds, though I don't have a clue of how to implement it :) Over the holidays I took another look at this. Give the attached patch a try -- basically, it blocks hotplug from starting network interfaces in runlevels unknown,0,1,2, and 6. This removes the "boot" runlevel problem (when run at that point, /sbin/runlevel returns "unknown" because /var/run/utmp isn't available) and keeps network interfaces from starting in runlevels where they aren't protected. It also gives total freedom to normal users to hot-plug away, and I even added messages to the script so that you can see when net.agent is at work. I also removed the --quiet on all the net.$INTERFACE calls so people can see what's going on. Someone with more knowledge of the initscripts and bash should *definitely* go over this when/if it gets included. Created attachment 47056 [details, diff]
modifies /etc/hotplug/net.agent to keep network interfaces from being started in non-network runlevels
I'm going to mark this as a dupe as there's more discussion going on at bug #78495. Feel free to give input there to an alternative patch which does not affect hotplug but has a similar affect as your patch. *** This bug has been marked as a duplicate of 78495 *** |