From 983daa047fa53780feb7cac8f49764ca110ba329 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Fri, 1 Feb 2008 23:43:58 +0000 Subject: [PATCH] When the state of the interface changes rapidly enough (usually due to rapid wireless association changes in my experience), there is a race where dhclient is in the process of exiting due to the link going down when the link coming up causes devd to try and start a new one. This results is the link being up, but no dhclient running. Work around this race by checking a second time after a one second delay before refusing to start a dhclient instance due to one already being running. MFC after: 1 week --- etc/rc.d/dhclient | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/rc.d/dhclient b/etc/rc.d/dhclient index d18221470dd..890aeaface8 100755 --- a/etc/rc.d/dhclient +++ b/etc/rc.d/dhclient @@ -21,7 +21,11 @@ dhclient_start() if [ -x /bin/pgrep ]; then pids=`/bin/pgrep -f "dhclient: $ifn(\$| .*)"` if [ -n "$pids" ]; then - exit 0 + sleep 1 + pids=`/bin/pgrep -f "dhclient: $ifn(\$| .*)"` + if [ -n "$pids" ]; then + exit 0 + fi fi fi