Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 28362 - /etc/init.d/net.eth0 erroneously checks if interface is "up"
Summary: /etc/init.d/net.eth0 erroneously checks if interface is "up"
Status: RESOLVED DUPLICATE of bug 34484
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Martin Schlemmer (RETIRED)
Depends on:
Reported: 2003-09-10 09:06 UTC by David Mitchell
Modified: 2005-07-17 13:06 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description David Mitchell 2003-09-10 09:06:19 UTC
The net.eth0 startup script now checks to see if the interface is "up" before starting dhcpcd. This conflicts with ifplugd which needs to keep the interface "up" but unconfigured in order to watch the link status. The result is that when ifplugd attempts to perform a "net.eth0 start" upon cable attachement, net.eth0 fails to try to start dhcpcd because it thinks the interface is already "up".  I don't know what the reason was for including the check in the first place, so I don't know what other effects there might be from removing the check.  

Reproducible: Always
Steps to Reproduce:

 I would suggest that the Gentoo developers think about adopting ifplugd as a standard part of the network scripts. The current default of being completely insensitive to the link status of the interfaces is really just dumb. Especially on a laptop where link status often changes. It really bugs me when Microsoft Windows is _much_ better at something out of the box than Linux, and this is a perfect example.
Comment 1 Wout Mertens (RETIRED) gentoo-dev 2003-11-15 06:54:00 UTC

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.

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.
Comment 2 Wout Mertens (RETIRED) gentoo-dev 2003-11-15 07:16:31 UTC
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 :(.
Comment 3 Wout Mertens (RETIRED) gentoo-dev 2003-12-12 03:59:22 UTC

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" ]
            einfo "Not starting dhcpcd because interface is already up"

Works perfectly for me, but I can't test it for ipv6. I think this is the correct way to handle this...
Comment 4 Wout Mertens (RETIRED) gentoo-dev 2004-03-01 02:18:55 UTC
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...

Comment 5 Guilherme Barile 2004-05-04 08:01:06 UTC
bug 34484 fixes this.
Comment 6 Aron Griffis (RETIRED) gentoo-dev 2004-05-07 16:11:51 UTC
bug 34484 has more info and suggested solutions, marking this as a dup

*** This bug has been marked as a duplicate of 34484 ***