Sync with current merging revs 1.27 and 1.31.

1.27:
Use get_if_var() to retrieve interface specific values of dhclient_flags
and background_dhclient.  This allows interfaces who's names are not
valid parts of shell variables and shortens the code.

1.31:
When the state of the interface changes rapidly enough 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.
This commit is contained in:
brooks 2008-03-12 17:41:37 +00:00
parent 3355824a91
commit 7f99930208

View File

@ -21,22 +21,22 @@ 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
# Override for $ifn specific flags (see rc.subr for $flags setting)
eval specific=\$dhclient_flags_$ifn
specific=`get_if_var $ifn dhclient_flags_IF`
if [ -z "$flags" -a -n "$specific" ]; then
rc_flags=$specific
fi
eval specific=\$background_dhclient_$ifn
if [ -n "$specific" ]; then
if checkyesno background_dhclient_$ifn; then
rc_flags="${rc_flags} -b"
fi
elif checkyesno background_dhclient; then
background_dhclient=`get_if_var $ifn background_dhclient_IF $background_dhclient`
if checkyesno background_dhclient; then
rc_flags="${rc_flags} -b"
fi