Browse Source

wifi interface down before scan

Bob Mottram 8 years ago
parent
commit
5a37cf14be
2 changed files with 8 additions and 15 deletions
  1. 6
    9
      src/freedombone-utils-wifi
  2. 2
    6
      src/freedombone-wifi

+ 6
- 9
src/freedombone-utils-wifi View File

@@ -71,8 +71,7 @@ function setup_wifi_atheros {
71 71
     update_wifi_adaptors
72 72
     if [ $IFACE ]; then
73 73
         wpa_cli -i ${IFACE} terminate
74
-        ifdown --force $IFACE
75
-        ifup $IFACE
74
+        ifconfig $IFACE up
76 75
     fi
77 76
 }
78 77
 
@@ -208,9 +207,8 @@ function hotspot_off {
208 207
         echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
209 208
     fi
210 209
 
211
-    systemctl restart network-manager
212 210
     wpa_cli -i ${WIFI_INTERFACE} terminate
213
-    ifdown --force ${WIFI_INTERFACE}
211
+    systemctl restart network-manager
214 212
 }
215 213
 
216 214
 function hotspot_on {
@@ -277,7 +275,7 @@ function hotspot_on {
277 275
     echo "    bridge_ports $WIFI_INTERFACE eth0" >> /etc/network/interfaces
278 276
 
279 277
     systemctl restart network-manager
280
-    ifup $WIFI_INTERFACE
278
+    ifconfig $WIFI_INTERFACE up
281 279
     systemctl restart hostapd
282 280
 }
283 281
 
@@ -305,7 +303,7 @@ function wifi_wpa2_psk {
305 303
     wpa_passphrase "$ssid" "$passphrase" > $WIFI_CONFIG
306 304
 
307 305
     systemctl restart network-manager
308
-    ifup ${WIFI_INTERFACE}
306
+    ifconfig ${WIFI_INTERFACE} up
309 307
 }
310 308
 
311 309
 function wifi_none {
@@ -334,7 +332,7 @@ function wifi_none {
334 332
     echo '}' >> $WIFI_CONFIG
335 333
 
336 334
     systemctl restart network-manager
337
-    ifup ${WIFI_INTERFACE}
335
+    ifconfig ${WIFI_INTERFACE} up
338 336
 }
339 337
 
340 338
 function networks_from_file {
@@ -402,7 +400,7 @@ function networks_from_file {
402 400
 
403 401
     chattr -i /etc/resolv.conf
404 402
     systemctl restart network-manager
405
-    ifup ${WIFI_INTERFACE}
403
+    ifconfig ${WIFI_INTERFACE} up
406 404
 }
407 405
 
408 406
 function create_networks_interactive {
@@ -497,7 +495,6 @@ function disable_wifi {
497 495
         echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
498 496
         systemctl restart network-manager
499 497
         wpa_cli -i ${WIFI_INTERFACE} terminate
500
-        ifdown --force ${WIFI_INTERFACE}
501 498
     else
502 499
         networks_from_file
503 500
     fi

+ 2
- 6
src/freedombone-wifi View File

@@ -85,9 +85,6 @@ do
85 85
             WIFI_INTERFACE=${1}
86 86
             wifi_interface_specified=1
87 87
             write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE"
88
-            wpa_cli -i ${WIFI_INTERFACE} terminate
89
-            ifdown --force ${WIFI_INTERFACE}
90
-            ifup ${WIFI_INTERFACE}
91 88
             ;;
92 89
         -t|--type)
93 90
             shift
@@ -136,6 +133,7 @@ if [ ${NETWORKS_INTERACTIVE} ]; then
136 133
 fi
137 134
 
138 135
 if [ ! ${wifi_interface_specified} ]; then
136
+    wpa_cli -i ${WIFI_INTERFACE} terminate
139 137
     update_wifi_adaptors
140 138
     if [ ! $IFACE ]; then
141 139
         echo $'No wifi adaptors were found'
@@ -144,9 +142,7 @@ if [ ! ${wifi_interface_specified} ]; then
144 142
     WIFI_INTERFACE=${IFACE}
145 143
     echo "Adaptor: $WIFI_INTERFACE"
146 144
     write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE"
147
-    wpa_cli -i ${WIFI_INTERFACE} terminate
148
-    ifdown --force ${WIFI_INTERFACE}
149
-    ifup ${WIFI_INTERFACE}
145
+    ifconfig ${WIFI_INTERFACE} up
150 146
 fi
151 147
 
152 148
 if [ ${WIFI_DISABLE} ]; then