network.subr: Properly bring up/down interfaces
authorAaron LI <aly@aaronly.me>
Wed, 12 Dec 2018 03:29:10 +0000 (11:29 +0800)
committerAaron LI <aly@aaronly.me>
Wed, 12 Dec 2018 15:24:40 +0000 (23:24 +0800)
Now that the interface will be properly brought up in ifconfig_up(),
clean up the rc.d/wpa_supplicant script.

etc/network.subr
etc/rc.d/wpa_supplicant

index 275ec7d..e62b6b8 100644 (file)
@@ -45,10 +45,12 @@ ifconfig_up()
        ifconfig_args=`ifconfig_getargs $1`
        if [ -n "${ifconfig_args}" ]; then
                ifconfig $1 ${ifconfig_args}
+               ifconfig $1 up
                _cfg=0
        fi
 
        if wpaif $1; then
+               ifconfig $1 up
                /etc/rc.d/wpa_supplicant start $1
                _cfg=0          # XXX: not sure this should count
        fi
@@ -100,6 +102,11 @@ ifconfig_down()
                _cfg=0
        fi
 
+       if ifexists $1; then
+               ifconfig $1 down
+               _cfg=0
+       fi
+
        return $_cfg
 }
 
index 9031916..bd5eeb8 100644 (file)
@@ -14,20 +14,10 @@ name="wpa_supplicant"
 rcvar=
 command="/usr/sbin/wpa_supplicant"
 conf_file="/etc/wpa_supplicant.conf"
-start_precmd="wpa_supplicant_precmd"
 start_postcmd="wpa_supplicant_postcmd"
 
-wpa_supplicant_precmd()
-{
-       ifconfig $ifn up
-}
-
 wpa_supplicant_postcmd()
 {
-# don't wait for wpa_supplicant to associate
-#      while ! ifconfig $ifn | grep -qw "status: associated"; do
-#              sleep 1
-#      done
        if [ "${command}" = "/usr/sbin/wpa_supplicant" ];
        then
                cat << EOF