diff options
Diffstat (limited to 'etc/network.subr')
-rw-r--r-- | etc/network.subr | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/etc/network.subr b/etc/network.subr index 73ed575..5087a93 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -1249,6 +1249,70 @@ ifscript_down() fi } +# wlan_up +# Create IEEE802.3 interfaces. +# +wlan_up() +{ + local _list _iflist wlan parent ifn + _list= + _iflist=$* + + for wlan in `set | egrep ^wlans_[a-z]+[0-9]+=[a-z]+[0-9]+`; do + # Parse wlans_$parent=$ifn + wlan=`echo $wlan | sed -E 's/wlans_([a-z]+[0-9]+)=([a-z]+[0-9]+)/\1:\2/'` + OIFS=$IFS; IFS=:; set -- $wlan; parent=$1; ifn=$2; IFS=$OIFS + case $_iflist in + ""|$ifn|$ifn\ *|*\ $ifn\ *|*\ $ifn) ;; + *) continue ;; + esac + # Skip if ${ifn} already exists. + if ${IFCONFIG_CMD} $ifn > /dev/null 2>&1; then + continue + fi + ${IFCONFIG_CMD} ${ifn} create wlandev ${parent} + if [ $? -eq 0 ]; then + _list="$_list $ifn" + fi + done + if [ -n "${_list# }" ]; then + echo "Created wlan(4) interfaces: ${_list# }." + fi + debug "Created wlan(4)s: ${_list# }" +} + +# wlan_down +# Destroy IEEE802.3 interfaces. +# +wlan_down() +{ + local _list _iflist wlan parent ifn + _list= + _iflist=$* + + for wlan in `set | egrep ^wlans_[a-z]+[0-9]+=[a-z]+[0-9]+`; do + # Parse wlans_$parent=$ifn + wlan=`echo $wlan | sed -E 's/wlans_([a-z]+[0-9]+)=([a-z]+[0-9]+)/\1:\2/'` + OIFS=$IFS; IFS=:; set -- $wlan; parent=$1; ifn=$2; IFS=$OIFS + case $_iflist in + ""|$ifn|$ifn\ *|*\ $ifn\ *|*\ $ifn) ;; + *) continue ;; + esac + # Skip if ${ifn} doesn't exists. + if ! ${IFCONFIG_CMD} $ifn > /dev/null 2>&1; then + continue + fi + ${IFCONFIG_CMD} -n ${ifn} destroy + if [ $? -eq 0 ]; then + _list="$_list $ifn" + fi + done + if [ -n "${_list# }" ]; then + echo "Destroyed wlan(4) interfaces: ${_list# }." + fi + debug "Destroyed wlan(4)s: ${_list# }" +} + # clone_up # Create cloneable interfaces. # @@ -1398,6 +1462,9 @@ clone_down() # Create and configure child interfaces. Return 0 if child # interfaces are created. # +# XXXGL: the wlan code in this functions is superseded by wlan_up(), +# and will go away soon. +# childif_create() { local cfg child child_vlans child_wlans create_args debug_flags ifn i |