大家好,我又来了~
秀一波最近解BUG学到的东西:WIFI连接和断链。其实本文也不算问题分析,顶多算是问题定位吧?!
目录
1、密码错误导致的连接失败
2、关联被拒绝
3、热点未回复AUTH_RSP或者STA未收到AUTH_RSP
4、热点未回复ASSOC_RSP或者STA未收到ASSOC_RSP
5、DHCP FAILURE
6、发送roaming
7、AP发送了DEAUTH帧导致断开连接
其实有的时候并不是用户真的输入了错误密码,有可能WIFI底层驱动存在异常。
再者,可以查看一下WIFI配置文件中保存的AP密码是否与期望值一致。
wpa_supplicant: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
wpa_supplicant: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="xiaoxiaoxin" aut
wpa_supplicant: wlan0: CTRL-EVENT-ASSOC-REJECT status_code=1
wpa_supplicant: wlan0: Request to deauthenticate - bssid=00:00:00:00:00:00 pending_bssid=00:00:00:00:00:00 reason=3 state=ASSOCIATING
wpa_supplicant: wpa_driver_nl80211_disconnect(reason_code=3)
正常情况下,STA发送AUTH request后,会收到一个AUTH_RSP,即正确情况下,内核LOG中会有如下两行打印,异常情况下,仅有第一行。
这种情况下,可以用其他设备接入AP,看是否存在同样的问题,则基本判断出是否为热点问题。
4,20619,2759068545,-;AUTH - Send AUTH request seq#1 (Alg=0)...
4,20620,2759170874,-;AUTH - Receive AUTH_RSP seq#2 to me (Alg=0, Status=0)
异常情况下,STA端不会有下面的第二行日志打印。
[ 2854.218696] ASSOC - Send ASSOC request...
[ 2854.238083] PeerAssocRspAction():ASSOC - receive ASSOC_RSP to me (status=0)
四次握手成功但是获取IP地址失败:
WifiConfigStore: message=DHCP FAILURE
正常情况下的流程如下:
DhcpClient: Broadcasting DHCPDISCOVER
DhcpClient: Received packet: 10:c7:53:71:ae:7c OFFER, ip /192.168.236.146, mask /255.255.255.0, DNS servers: /192.168.236.1 , gateways [/192.168.236.1] lease time 86400, domain null
DhcpClient: Got pending lease: IP address 192.168.236.146/24 Gateway 192.168.236.1 DNS servers: [ 192.168.236.1 ] Domains DHCP server /192.168.236.1 Vendor info null lease 86400seconds
DhcpClient: Broadcasting DHCPREQUEST ciaddr=0.0.0.0 request=192.168.236.146 serverid=192.168.236.1
DhcpClient: Received packet: 10:c7:53:71:ae:7c ACK: your new IP /192.168.236.146, netmask /255.255.255.0, gateways [/192.168.236.1] DNS servers: /192.168.236.1 , lease time 86400
DhcpClient: Confirmed lease: IP address 192.168.236.146/24 Gateway 192.168.236.1 DNS servers: [ 192.168.236.1 ] Domains DHCP server /192.168.236.1 Vendor info null lease 86400 seconds
当前连接AP1信号太弱,此时又扫描到了已连接过的AP2,AP2的信号强度更好,则会断开AP1,连接AP2,这一系列动作就叫roaming。
如下列中,断开了与10:0e:0e:20:66:15热点的连接,连接到了10:0e:0e:20:5e:6d热点。
wpa_supplicant: nl80211: Associated on 2422 MHz
wpa_supplicant: nl80211: Associated with 10:0e:0e:20:66:15
wpa_supplicant: nl80211: Drv Event 47 (NL80211_CMD_ROAM) received for wlan0
wpa_supplicant: nl80211: Roam event
wpa_supplicant: nl80211: Associated on 2472 MHz
wpa_supplicant: nl80211: Associated with 10:0e:0e:20:5e:6d
此时可以连接其他AP测试一下,进而判断是否是刚才这个AP的问题
[ 1555.321037] (1)[3319:tx_thread][wlan] Rx Deauth frame from BSSID=[aa:63:df:4c:db:c2]
[ 1555.321093] (1)[3319:tx_thread][wlan] Reason code = 7
目前遇到的问题暂时有这么几类,以后再遇到了会再做补充,欢迎一起探讨~
相关内容:
WIFI接入之Authentication和Association流程梳理
WIFI接入之supplicant 四次握手流程
持续关注本博客内容,请微信关注个人公众号:万物互联技术