Summary: | /etc/init.d/net.eth0 erroneously checks if interface is "up" | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | David Mitchell <gentoo> |
Component: | [OLD] Core system | Assignee: | Martin Schlemmer (RETIRED) <azarah> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | brad, mark, mholzer, wmertens |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
David Mitchell
2003-09-10 09:06:19 UTC
Martin, I agree here. ifplugd won't work on many network cards unless they are "up". Thinking about it, I think that you put the check in there for systems that were booted with "ip=dhcp" kernel-level autoconfiguration. However, could you in that case not just add the "-T" switch to dhcpcd? From the manual: === -T Test case, when dhcpcd goes through the DHCP negotiation sequence but doesn't actually configure the interface. It does however write the <ConfigDir>/dhcpcd-<interface>.info and /var/cache/dhcpcd-<interface>.cache files and it does attempt to execute <ConfigDir>/dhcpcd.exe script. The pathname of === I do it on my nfs-root thin client boot, and it works perfectly. Could you at the very least make the check optional? Add a variable to conf.d/net which enables the test? Something like: # Prevent dhcpcd from changing already configured interfaces? # Set this to "no" if you are using ifplugd without the -a option. noclobber_<iface>="yes" and the actual test: # Check that eth0 was not brough up by the kernel ... if [ "$(noclobber_IFACE)" == "no" ] || [ "${status_IFACE}" != "up" ] But still, I think that it's better to just believe the user if he wants to start dhcpcd. Another way of going about it would be to make ifplugd part of net.eth0, where setting an interface as "detect" would run ifplugd on it. Then the script that starts the network from ifplugd would need to be rewritten to start dhcpcd by itself. As a consequence, bootscripts that depend on "net" would work as expected. The disadvantage is that, if you want a static interface or a different route, you would need to copy that code from net.eth0, never a good thing. Thoughts? I still think the whole net thing is a bit of a mess :(. Martin, how about checking if the interface is up, _and_ has an ip address assigned, instead? ================================= # If the interface is up _and_ has an ip address, it's "up" status_IFACE="$(ifconfig ${iface} | gawk '/addr:/{a=1}/ UP /{ if (a == 1) print "up" }')" ================================= And for niceness, add a message: ================================= if [ "${status_IFACE}" != "up" ] then [...] else einfo "Not starting dhcpcd because interface is already up" fi ================================= Works perfectly for me, but I can't test it for ipv6. I think this is the correct way to handle this... I just checked and this will also work with IPv6. What do you think? There's a lot of bugs being opened on this problem... Wout. |