Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/network.subr
Show First 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | ifconfig_up() | ||||
_ifconfig_descr=`get_if_var $1 ifconfig_IF_descr` | _ifconfig_descr=`get_if_var $1 ifconfig_IF_descr` | ||||
if [ -n "${_ifconfig_descr}" ]; then | if [ -n "${_ifconfig_descr}" ]; then | ||||
${IFCONFIG_CMD} $1 description "${_ifconfig_descr}" | ${IFCONFIG_CMD} $1 description "${_ifconfig_descr}" | ||||
fi | fi | ||||
if wpaif $1; then | if wpaif $1; then | ||||
/etc/rc.d/wpa_supplicant start $1 | /etc/rc.d/wpa_supplicant start $1 | ||||
# NOTE: wpa_supplicant(8) needs to control the interface's | |||||
# state in order to perform the SSID scan. But | |||||
# dhcpcd(8), which may be started by the "dhcp_client" | |||||
# below, can race against wpa_supplicant(8) and modify | |||||
# the interface's state, breaking the SSID scan and | |||||
# preventing the SSID association. | |||||
# Insert a small delay here to workaround the issue. | |||||
sleep 1 | |||||
bz: We've had plenty of these sleep / no sleeps lately and @cperciva probably not happy with… | |||||
Not Done Inline ActionsIndeed, I have a VM where 80% of the boot process is sleeps for IPv6 DAD. Please, no more sleeps in rc.d scripts! (To make it even crazier, the only network interface on that VM is lo0...) cperciva: Indeed, I have a VM where 80% of the boot process is sleeps for IPv6 DAD. Please, no more… | |||||
Not Done Inline Actions
See D5469 for a solution to that. roy_marples.name: > Indeed, I have a VM where 80% of the boot process is sleeps for IPv6 DAD. Please, no more… | |||||
Not Done Inline Actionsdhcpcd can and will react to proper interface status. It should not require this change here or break wpa_suppliant. roy_marples.name: dhcpcd can and will react to proper interface status. It should not require this change here or… | |||||
_cfg=0 # XXX: not sure this should count | _cfg=0 # XXX: not sure this should count | ||||
elif hostapif $1; then | elif hostapif $1; then | ||||
/etc/rc.d/hostapd start $1 | /etc/rc.d/hostapd start $1 | ||||
_cfg=0 | _cfg=0 | ||||
elif [ ${_cfg} -eq 0 ]; then | elif [ ${_cfg} -eq 0 ]; then | ||||
${IFCONFIG_CMD} $1 up | ${IFCONFIG_CMD} $1 up | ||||
fi | fi | ||||
if ! noafif $1 && afexists inet6; then | if ! noafif $1 && afexists inet6; then | ||||
ipv6_accept_rtadv_up $1 && _cfg=0 | ipv6_accept_rtadv_up $1 && _cfg=0 | ||||
fi | fi | ||||
if dhcpif $1; then | if dhcpif $1; then | ||||
if [ $_cfg -ne 0 ] ; then | if [ $_cfg -ne 0 ] ; then | ||||
${IFCONFIG_CMD} $1 up | ${IFCONFIG_CMD} $1 up | ||||
fi | fi | ||||
if syncdhcpif $1; then | if syncdhcpif $1; then | ||||
/etc/rc.d/dhclient start $1 | /etc/rc.d/dhcp_client start $1 | ||||
fi | fi | ||||
_cfg=0 | _cfg=0 | ||||
fi | fi | ||||
return $_cfg | return $_cfg | ||||
} | } | ||||
# ifconfig_down if | # ifconfig_down if | ||||
# returns 1 if wpa_supplicant or dhclient was stopped or | # returns 1 if wpa_supplicant or the dhcp client were stopped, or | ||||
# the interface exists. | # the interface exists. | ||||
# | # | ||||
ifconfig_down() | ifconfig_down() | ||||
{ | { | ||||
local _cfg | local _cfg | ||||
_cfg=1 | _cfg=1 | ||||
if wpaif $1; then | if wpaif $1; then | ||||
/etc/rc.d/wpa_supplicant stop $1 | /etc/rc.d/wpa_supplicant stop $1 | ||||
_cfg=0 | _cfg=0 | ||||
elif hostapif $1; then | elif hostapif $1; then | ||||
/etc/rc.d/hostapd stop $1 | /etc/rc.d/hostapd stop $1 | ||||
_cfg=0 | _cfg=0 | ||||
elif dhcpif $1; then | elif dhcpif $1; then | ||||
/etc/rc.d/dhclient stop $1 | /etc/rc.d/dhcp_client stop $1 | ||||
_cfg=0 | _cfg=0 | ||||
fi | fi | ||||
if ifexists $1; then | if ifexists $1; then | ||||
${IFCONFIG_CMD} $1 down | ${IFCONFIG_CMD} $1 down | ||||
_cfg=0 | _cfg=0 | ||||
fi | fi | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | [Nn][Oo][Aa][Uu][Tt][Oo]) | ||||
return 1 | return 1 | ||||
;; | ;; | ||||
esac | esac | ||||
done | done | ||||
return 0 | return 0 | ||||
} | } | ||||
# dhcpif if | # dhcpif if [af] | ||||
# Returns 0 if the interface is a DHCP interface and 1 otherwise. | # Returns 0 if the interface needs DHCP for IPv4/IPv6 and 1 otherwise. | ||||
# If the second argument is "ipv4" (or "ipv6"), then only IPv4 (or | |||||
# IPv6) is checked, otherwise both are checked. | |||||
dhcpif() | dhcpif() | ||||
{ | { | ||||
local _tmpargs _arg | local _tmpargs _arg _if _af | ||||
_tmpargs=`_ifconfig_getargs $1` | _if=$1 | ||||
_af=$2 | |||||
case $1 in | case $1 in | ||||
lo[0-9]*|\ | lo[0-9]*|\ | ||||
stf[0-9]*|\ | stf[0-9]*|\ | ||||
lp[0-9]*|\ | lp[0-9]*|\ | ||||
sl[0-9]*) | sl[0-9]*) | ||||
return 1 | return 1 | ||||
;; | ;; | ||||
esac | esac | ||||
if noafif $1; then | if noafif $1; then | ||||
return 1 | return 1 | ||||
fi | fi | ||||
if [ -z "$_af" -o "$_af" = "ipv4" ]; then | |||||
_tmpargs=`_ifconfig_getargs $_if` | |||||
for _arg in $_tmpargs; do | for _arg in $_tmpargs; do | ||||
case $_arg in | case $_arg in | ||||
[Dd][Hh][Cc][Pp]) | [Dd][Hh][Cc][Pp]) | ||||
return 0 | return 0 | ||||
;; | ;; | ||||
[Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) | [Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) | ||||
return 0 | return 0 | ||||
;; | ;; | ||||
[Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) | [Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) | ||||
return 0 | return 0 | ||||
;; | ;; | ||||
esac | esac | ||||
done | done | ||||
fi | |||||
if [ -z "$_af" -o "$_af" = "ipv6" ] && ipv6if $_if; then | |||||
_tmpargs=`_ifconfig_getargs $_if ipv6` | |||||
for _arg in $_tmpargs; do | |||||
case $_arg in | |||||
[Dd][Hh][Cc][Pp]) | |||||
return 0 | |||||
;; | |||||
[Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) | |||||
return 0 | |||||
;; | |||||
[Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) | |||||
return 0 | |||||
;; | |||||
esac | |||||
done | |||||
fi | |||||
return 1 | return 1 | ||||
} | } | ||||
# syncdhcpif | # syncdhcpif | ||||
# Returns 0 if the interface should be configured synchronously and | # Returns 0 if the interface should be configured synchronously and | ||||
# 1 otherwise. | # 1 otherwise. | ||||
syncdhcpif() | syncdhcpif() | ||||
▲ Show 20 Lines • Show All 1,364 Lines • Show Last 20 Lines |
We've had plenty of these sleep / no sleeps lately and @cperciva probably not happy with another one (even though wireless is not on his agenda). Why can dhcpcd not get the proper interface status and on sun when wlan interfaces as associated? [sorry lately asked myself that also for the current in-tree situation]. [just mentioning @cy as he probably wants to think about this as well]