Wpa_supplicant 调试故障原因分析

背景

在使用Wpa_supplicant 工具调试Linux的wifi的时候,发现有一些问题。特此记录一下。有些问题是遇到的并已经有了解决方法,一些问题比较发杂,只能作为思路。

问题以及解决办法

1.没有在后台运行的错误

Failed to connect to non-global ctrl_ifname: (nil) error: No such file or directory 

解决办法:
wpa_supplicant 运行在后台,例如:

nohup wpa_supplicant -c wpa.conf > /tmp/wpa_supplicant.log &

2.传参有问题

Failed to connect to non-global ctrl_ifname: wlan0  error: No such file or directory

解决方法:-i 指定的参数所在的设备名错误,可以通过ifconfig查看以后自行改正,一般是因为没有正确的网卡驱动。

3.服务多开导致的问题

ctrl_iface exists and seems to be in use - cannot override it 
Delete ‘/var/run/wpa_supplicant/wlo1’ manually if it is not used anymore 
Failed to initialize control interface ‘/var/run/wpa_supplicant’. 
You may have another wpa_supplicant process already running or the file was 
left by an unclean termination of wpa_supplicant in which case you will need 
to manually remove this file before starting wpa_supplicant again. 

解决方法:系统已经存在打开的多个wpa_supplicant实例,执行killall wpa_supplicant杀死所有wpa_supplicant即可。

4.内核没有对应驱动导致的错误
rfkill: Cannot open RFKILL control device
解决方法:
内核添加对应的驱动即可。

Networking support
        <*>   RF switch subsystem support  --->
                [*]   Power off on suspend (NEW)
                <*>   Generic rfkill regulator driver 

5:在ASSOCIATING阶段由于丢包导致ASSOC REJECT

Event [IFNAME=wlan0 CTRL-EVENT-DISCONNECTED bssid=08:cc:68:9e:ac:20 reason=3 locally_generated=1]
I/wpa_supplicant(23065): wlan0: CTRL-EVENT-ASSOC-REJECT bssid=0e:bd:51:c7:b6:33 status_code=1

解决方法

6.在4WAY_HANDSHAKE阶段由于密码错误、丢帧或者弱信号丢包导致WRONG_KEY

分为以下情况:

  • 密码错误在4WAY_HANDSHAKE阶段中的2/4次握手会显示wrong key

如果已经连接过则显示:

01-01 23:19:01.778 I/wpa_supplicant(19043): wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=1 ssid="Onetouch Idol 3 (4.7)" > auth_failures=1 duration=5 reason=WRONG_KEY。
  • 丢帧导致连接断开:
Line 127671:< 3>[86294.177961] wlan: [24597:E :PE ] limHandleMissedBeaconInd: 2121: Sending EXIT_BMPS_IND to SME due to Missed beacon from FW
  • 信号弱导致断开:
02-28 21:56:59.703 I/wpa_supplicant(31023): wlan0: CTRL-EVENT-DISCONNECTED bssid=c8:3a:35:2b:71:30 reason=0

02-28 21:56:59.713 E/WifiStateMachine( 821): NETWORK_DISCONNECTION_EVENT in connected state BSSID=c8:3a:35:2b:71:30 RSSI=-89 freq=2437 was debouncing=false reason=0 ajst=0

# reason=0表示因为信号弱而断开。

7:4WAY_HANDSHAK成功但DHCP FAILURE(四步握手成功但获取IP地址失败)

03-14 14:21:59.681 E/WifiStateMachine(28360): WifiStateMachine DHCP failure count=0

03-14 14:21:59.705 E/WifiConfigStore(28360): message=DHCP FAILURE

8.被AP踢出,这个原因需要sniffer log分析

reason=2,reason=7,reason=15代表被AP踢出,在kernel log中可以找到对应的deauth信息。

03-14 14:21:29.932 I/wpa_supplicant(28064): wlan0: CTRL-EVENT-DISCONNECTED bssid=c4:14:3c:29:47:05 reason=7
< 3>[86553.353983] wlan: [28055:E :PE ] limProcessDeauthFrame: 144: Received Deauth frame for Addr: 44:a4:2d:52:bc:a5 (mlm state = eLIM_MLM_LINK_ESTABLISHED_STATE, sme state = 12 systemrole = 3) with reason code 7 from c4:14:3c:29:47:05

03-14 14:20:03.274 I/wpa_supplicant(28064): wlan0: CTRL-EVENT-DISCONNECTED bssid=1c:1d:86:e9:e2:85 reason=15

<3>[86568.199309] wlan: [28055:E :PE ] limProcessDeauthFrame: 144: Received Deauth frame for Addr: 44:a4:2d:52:bc:a5 (mlm state = eLIM_MLM_LINK_ESTABLISHED_STATE, sme state = 12 systemrole = 3) with reason code 15 from 1c:1d:86:e9:e2:85

03-14 13:42:24.354 I/wpa_supplicant(28064): wlan0: CTRL-EVENT-DISCONNECTED bssid=c4:14:3c:29:47:25 reason=2

< 3>[85195.665538] wlan: [28055:E :PE ] limProcessDeauthFrame: 144: Received Deauth frame for Addr: 44:a4:2d:52:bc:a5 (mlm state = eLIM_MLM_LINK_ESTABLISHED_STATE, sme state = 12 systemrole = 3) with reason code 2 from c4:14:3c:29:47:25

9.在信号相差5-10rssi的时候会发生roam,roam是在firmware层发生的,不会断开。

03-14 14:19:24.774 I/WifiHAL (28360): event received NL80211_CMD_ROAM, vendor_id = 0x0

03-14 14:19:24.781 I/wpa_supplicant(28064): wlan0: CTRL-EVENT-CONNECTED - Connection to c4:14:3c:29:47:25 completed [id=0 id_str=]

03-14 14:19:30.298 I/WifiHAL (28360): event received NL80211_CMD_ROAM, vendor_id = 0x0

03-14 14:19:30.316 I/wpa_supplicant(28064): wlan0: CTRL-EVENT-CONNECTED - Connection to c4:14:3c:29:47:05 completed [id=0 id_str=]

03-14 14:19:48.681 I/WifiHAL (28360): event received NL80211_CMD_ROAM, vendor_id = 0x0

03-14 14:20:00.162 I/wpa_supplicant(28064): wlan0: CTRL-EVENT-CONNECTED - Connection to 1c:1d:86:e9:e2:85 completed [id=0 id_str=]

10.在打开auoto join的情况下,也会发生roam,也不会断开

03-14 12:09:32.171 E/WifiStateMachine(28360): WifiStateMachine shouldSwitchNetwork txSuccessRate=0.00 rxSuccessRate=0.00 delta 1000 -> 1000

03-14 12:09:34.505 I/wpa_supplicant(28064): wlan0: CTRL-EVENT-CONNECTED - Connection to 6c:99:89:b0:01:85 completed [id=0 id_str=]

03-14 12:09:55.132 I/wpa_supplicant(28064): wlan0: CTRL-EVENT-DISCONNECTED bssid=6c:99:89:b0:01:85 reason=0

03-14 13:10:51.805 E/WifiStateMachine(28360): WifiStateMachine shouldSwitchNetwork txSuccessRate=0.00 rxSuccessRate=0.00 delta 1000 -> 100
posted @ 2020-01-03 16:28  schips  阅读(18050)  评论(0编辑  收藏  举报