32ca8e078d
for interfaces which were not configured for DHCP *unless* rc_force was set; the correct logic is to run dhclient for those interfaces *only if* rc_force is set. Broken by: des@ Noticed by: everybody and his dog Submitted by: rea@ PR: bin/161733
49 lines
897 B
Bash
Executable File
49 lines
897 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: dhclient
|
|
# KEYWORD: nojail nostart
|
|
|
|
. /etc/rc.subr
|
|
. /etc/network.subr
|
|
|
|
ifn="$2"
|
|
|
|
name="dhclient"
|
|
rcvar=
|
|
pidfile="/var/run/${name}.${ifn}.pid"
|
|
start_precmd="dhclient_prestart"
|
|
|
|
dhclient_prestart()
|
|
{
|
|
# Interface-specific flags (see rc.subr for $flags setting)
|
|
specific=$(get_if_var $ifn dhclient_flags_IF)
|
|
if [ -z "$flags" -a -n "$specific" ]; then
|
|
rc_flags=$specific
|
|
fi
|
|
|
|
background_dhclient=$(get_if_var $ifn background_dhclient_IF $background_dhclient)
|
|
if checkyesno background_dhclient; then
|
|
rc_flags="${rc_flags} -b"
|
|
fi
|
|
|
|
rc_flags="${rc_flags} ${ifn}"
|
|
}
|
|
|
|
load_rc_config $name
|
|
load_rc_config network
|
|
|
|
if [ -z $ifn ] ; then
|
|
# only complain if a command was specified but no interface
|
|
if [ -n "$1" ] ; then
|
|
echo 1>&2 "$0: no interface specified"
|
|
return 1
|
|
fi
|
|
elif [ -z "${rc_force}" ] && ! dhcpif $ifn; then
|
|
return 1
|
|
fi
|
|
|
|
run_rc_command "$1"
|