Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 17378 - baselayout: Better way of bringing down dhcpcd
Summary: baselayout: Better way of bringing down dhcpcd
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-12 09:48 UTC by Wout Mertens (RETIRED)
Modified: 2004-03-04 23:30 UTC (History)
0 users

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


Attachments
The patch (dhcpcd.diff,11 bytes, patch)
2003-03-13 02:27 UTC, Wout Mertens (RETIRED)
Details | Diff
Second try :( (dhcpcd.diff,705 bytes, patch)
2003-03-13 02:30 UTC, Wout Mertens (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wout Mertens (RETIRED) gentoo-dev 2003-03-12 09:48:46 UTC
Currently, you have to wait 5 seconds every time you bring down a dhcpcd-managed
interface, so that restarts work. But what could be done instead is to
repeatedly call dhcpcd -k until it fails, meaning that there is no more dhcpcd
on that interface. Here's a patch to demonstrate:

--- /etc/init.d/net.eth0.orig   2003-02-28 13:01:10.000000000 +0000
+++ /etc/init.d/net.eth0        2003-03-12 15:01:04.000000000 +0000
@@ -144,18 +144,15 @@

        if [ "$(eval echo \$\{iface_${IFACE}\})" = "dhcp" ]
        then
-               /sbin/dhcpcd -k ${IFACE} &>/dev/null
-
-               # Give dhcpcd time to properly shutdown
                local count=0
-               einfon "  Waiting for dhcpcd to shutdown"
-               while [ "${count}" -lt 5 ]
-               do
-                       echo -n "."
+               while /sbin/dhcpcd -k ${IFACE} &>/dev/null && [ "${count}" -lt 9
]; do
+                       # Give dhcpcd time to properly shutdown
                        sleep 1
                        count=$((count + 1))
                done
-               echo "done"
+               if [ "${count}" -ge 9 ]; then
+                       eerror "Timed out trying to stop dhcpcd"
+               fi
        else
                /sbin/ifconfig ${IFACE} down >/dev/null
        fi

It works perfectly for me, and I don't see any reason why it wouldn't for anyone
else.

Reproducible: Always
Steps to Reproduce:

Actual Results:  
Now, restarting networks takes only as long as it needs.
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-12 17:56:32 UTC
Because its usually things 'that work perfectly for me' that blows up in one's
face.  Get 20 other people to vouch for this, and Ill consider it.
Comment 2 Wout Mertens (RETIRED) gentoo-dev 2003-03-13 02:27:36 UTC
Created attachment 9335 [details, diff]
The patch

apply this by running 'patch -p0 < [patchfile location]' in /etc/init.d/
Comment 3 Wout Mertens (RETIRED) gentoo-dev 2003-03-13 02:30:16 UTC
Created attachment 9336 [details, diff]
Second try :(

See above for installation instructions
Comment 4 Norberto Bensa 2003-03-13 12:54:36 UTC
Works here in FIVE different boxes. Does it count as 5 different users saying: "yes, it works 
for me too"??? :-) 
Comment 5 Jason Waldhelm 2003-03-13 14:40:38 UTC
works here. 
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-13 15:13:40 UTC
Ok, while you guys at it, what do you think about:

  http://bugs.gentoo.org/show_bug.cgi?id=17162

?

I think however that you could set the timeout option to 15 seconds, and
rather make it a default option in /etc/conf.d/net (with some comments) so
that its easy to change.
Comment 7 Abhishek Amit (RETIRED) gentoo-dev 2003-03-13 18:54:11 UTC
It works for me.
Comment 8 Christian Dietl 2003-03-14 07:41:02 UTC
works here
Comment 9 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-16 02:17:14 UTC
Ok, will be in baselayout-1.8.6.4, thanks.