etc/network.subr: enhance wlan initialization
authorDaniel Fojt <df@neosystem.org>
Thu, 18 Jun 2020 06:16:04 +0000 (08:16 +0200)
committerDaniel Fojt <df@neosystem.org>
Thu, 18 Jun 2020 06:16:04 +0000 (08:16 +0200)
Teach wlan_up() and wlan_down() to process just a single interface
passed as optional argument. If no argument is given, process all
"net.wlan.devices" just like before.

Reviewed by: Aaron LI

etc/network.subr

index b8b663a..5e3e20b 100644 (file)
@@ -453,9 +453,16 @@ wlan_up()
        _rcconf=""
        _auto=""
 
        _rcconf=""
        _auto=""
 
+       local wlan_devices
+       if [ -n "$1" ]; then
+               wlan_devices="$1"
+       else
+               wlan_devices="`${SYSCTL_N} -q net.wlan.devices`"
+       fi
+
        # Order detected devices so that interfaces configured via rc.conf are
        # created first, and then all other devices are automatically assigned
        # Order detected devices so that interfaces configured via rc.conf are
        # created first, and then all other devices are automatically assigned
-       for parent in `${SYSCTL_N} -q net.wlan.devices`; do
+       for parent in ${wlan_devices}; do
                child_wlans=`get_if_var $parent wlans_IF`
                if [ -n "${child_wlans}" ]; then
                        _rcconf="${_rcconf} ${parent}"
                child_wlans=`get_if_var $parent wlans_IF`
                if [ -n "${child_wlans}" ]; then
                        _rcconf="${_rcconf} ${parent}"
@@ -511,7 +518,14 @@ wlan_down()
        _prefix=
        _list=
 
        _prefix=
        _list=
 
-       for parent in `${SYSCTL_N} -q net.wlan.devices`; do
+       local wlan_devices
+       if [ -n "$1" ]; then
+               wlan_devices="$1"
+       else
+               wlan_devices="`${SYSCTL_N} -q net.wlan.devices`"
+       fi
+
+       for parent in ${wlan_devices}; do
                child_wlans=`get_if_var $parent wlans_IF`
                for child in ${child_wlans}; do
                        if ! ifexists $child; then
                child_wlans=`get_if_var $parent wlans_IF`
                for child in ${child_wlans}; do
                        if ! ifexists $child; then