From 4c258131c9b578a2b87a198138bc4d8971e50b05 Mon Sep 17 00:00:00 2001 From: Daniel Fojt Date: Thu, 18 Jun 2020 08:16:04 +0200 Subject: [PATCH] etc/network.subr: enhance wlan initialization 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 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/etc/network.subr b/etc/network.subr index b8b663a411..5e3e20b8b3 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -453,9 +453,16 @@ wlan_up() _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 - 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}" @@ -511,7 +518,14 @@ wlan_down() _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 -- 2.41.0