Change the default value of synchronous_dhclient to NO.
To preserve the existing behavior of etc/rc.d/netif, add code to wait up to if_up_delay seconds (30 seconds by default) for a default route to be configured if there are any dhcp interfaces. This should be extended to test that the interface is actually up. X-MFC after:
This commit is contained in:
parent
d0c63cd27f
commit
ace19032cf
@ -103,7 +103,7 @@ dhclient_flags="" # Extra flags to pass to dhcp client.
|
||||
#dhclient_flags_fxp0="" # Extra dhclient flags for fxp0 only
|
||||
background_dhclient="NO" # Start dhcp client in the background.
|
||||
#background_dhclient_fxp0="YES" # Start dhcp client on fxp0 in the background.
|
||||
synchronous_dhclient="YES" # Start dhclient directly on configured
|
||||
synchronous_dhclient="NO" # Start dhclient directly on configured
|
||||
# interfaces during startup.
|
||||
wpa_supplicant_program="/usr/sbin/wpa_supplicant"
|
||||
wpa_supplicant_flags="-s" # Extra flags to pass to wpa_supplicant
|
||||
@ -178,6 +178,7 @@ tcp_drop_synfin="NO" # Set to YES to drop TCP packets with SYN+FIN
|
||||
icmp_drop_redirect="NO" # Set to YES to ignore ICMP REDIRECT packets
|
||||
icmp_log_redirect="NO" # Set to YES to log ICMP REDIRECT packets
|
||||
network_interfaces="auto" # List of network interfaces (or "auto").
|
||||
if_up_delay="30" # Time to wait for interfaces to come up.
|
||||
cloned_interfaces="" # List of cloned network interfaces to create.
|
||||
#cloned_interfaces="gif0 gif1 gif2 gif3" # Pre-cloning GENERIC config.
|
||||
ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
|
||||
|
@ -768,6 +768,29 @@ list_net_interfaces()
|
||||
return 0
|
||||
}
|
||||
|
||||
# get_default_if -address_family
|
||||
# Get the interface of the default route for the given address family.
|
||||
# The -address_family argument must be suitable passing to route(8).
|
||||
#
|
||||
get_default_if()
|
||||
{
|
||||
routeget="`route -n get $1 default 2>/dev/null`"
|
||||
oldifs="$IFS"
|
||||
IFS="
|
||||
"
|
||||
defif=
|
||||
for line in $routeget ; do
|
||||
case $line in
|
||||
*interface:*)
|
||||
defif=${line##*: }
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS=${oldifs}
|
||||
|
||||
echo $defif
|
||||
}
|
||||
|
||||
hexdigit()
|
||||
{
|
||||
if [ $1 -lt 10 ]; then
|
||||
|
@ -70,6 +70,29 @@ network_start()
|
||||
# Configure the interface(s).
|
||||
network_common ifn_start
|
||||
|
||||
if [ -z "$cmdifn" ]; then
|
||||
dhcp_interfaces=`list_net_interfaces dhcp`
|
||||
if [ -n "${dhcp_interfaces}" ]; then
|
||||
delay=${if_up_delay}
|
||||
while [ ${delay} -gt 0 ]; do
|
||||
defif=`get_default_if -inet`
|
||||
if [ -n "${defif}" ]; then
|
||||
if [ ${delay} -ne ${if_up_delay} ]; then
|
||||
echo "($defif)"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
if [ ${delay} -eq ${if_up_delay} ]; then
|
||||
echo -n "Waiting for an interface to come up: "
|
||||
else
|
||||
echo -n .
|
||||
fi
|
||||
sleep 1
|
||||
delay=`expr $delay - 1`
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f /etc/rc.d/ipfilter ] ; then
|
||||
# Resync ipfilter
|
||||
/etc/rc.d/ipfilter quietresync
|
||||
|
@ -393,10 +393,10 @@ only.
|
||||
.It Va synchronous_dhclient
|
||||
.Pq Bt bool
|
||||
Set to
|
||||
.Dq Li NO
|
||||
.Dq Li YES
|
||||
to start
|
||||
.Xr dhclient 8
|
||||
only in response to interface events and not synchronously at startup.
|
||||
synchronously at startup.
|
||||
This behavior can be overridden on a per-interface basis by replacing
|
||||
the
|
||||
.Dq Li DHCP
|
||||
@ -406,6 +406,10 @@ variable with
|
||||
.Dq Li SYNCDHCP
|
||||
or
|
||||
.Dq Li NOSYNCDHCP .
|
||||
.It Va if_up_delay
|
||||
.Pq Vt int
|
||||
When set to a positive value, wait up to this long after configuring
|
||||
DHCP interfaces at startup to give the interfaces time to receive a lease.
|
||||
.It Va firewall_enable
|
||||
.Pq Vt bool
|
||||
Set to
|
||||
|
Loading…
Reference in New Issue
Block a user