瀏覽代碼

wifi interface down before scan

Bob Mottram 8 年之前
父節點
當前提交
5a37cf14be
共有 2 個檔案被更改,包括 8 行新增15 行删除
  1. 6
    9
      src/freedombone-utils-wifi
  2. 2
    6
      src/freedombone-wifi

+ 6
- 9
src/freedombone-utils-wifi 查看文件

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

+ 2
- 6
src/freedombone-wifi 查看文件

85
             WIFI_INTERFACE=${1}
85
             WIFI_INTERFACE=${1}
86
             wifi_interface_specified=1
86
             wifi_interface_specified=1
87
             write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE"
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
         -t|--type)
89
         -t|--type)
93
             shift
90
             shift
136
 fi
133
 fi
137
 
134
 
138
 if [ ! ${wifi_interface_specified} ]; then
135
 if [ ! ${wifi_interface_specified} ]; then
136
+    wpa_cli -i ${WIFI_INTERFACE} terminate
139
     update_wifi_adaptors
137
     update_wifi_adaptors
140
     if [ ! $IFACE ]; then
138
     if [ ! $IFACE ]; then
141
         echo $'No wifi adaptors were found'
139
         echo $'No wifi adaptors were found'
144
     WIFI_INTERFACE=${IFACE}
142
     WIFI_INTERFACE=${IFACE}
145
     echo "Adaptor: $WIFI_INTERFACE"
143
     echo "Adaptor: $WIFI_INTERFACE"
146
     write_config_param "WIFI_INTERFACE" "$WIFI_INTERFACE"
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
 fi
146
 fi
151
 
147
 
152
 if [ ${WIFI_DISABLE} ]; then
148
 if [ ${WIFI_DISABLE} ]; then