Networking

嵌入式設備 wpa_supplicant 重新連接

  • February 24, 2020

我們有一個執行基於 Debian 9 的作業系統的嵌入式 arm 設備,執行核心 4.14.67-1.0.6+。

**編輯:**根據@AB 的要求,以下也是供未來觀眾使用的驅動程序/晶片組資訊——我在提問時不知道如何找到它。

filename:       /lib/modules/4.14.67-1.0.6+/extra/mlan.ko
license:        GPL
version:        C605
author:         Marvell International Ltd.
description:    M-WLAN MLAN Driver
srcversion:     103492D596FC10822F1F391
depends:
name:           mlan
vermagic:       4.14.67-1.0.6+ SMP preempt mod_unload modversions ARMv7 p2v8

我們能夠在啟動時連接到 WiFi,但是當信號失去時,設備不會自動重新連接。我一遍又一遍地檢查文件,/etc/network/interfaces嘗試wpa_supplicant不同的選項,雖然我取得了一些進展,但仍然無法正確重新連接。

我的配置如下所示。我試過用手動 iface 設置來玩wpa-confvs 。wpa-roam我嘗試對 wpa_supplicant 使用不同autoscanap_scan設置。我們過去曾嘗試使用 NetworkManager,但事實證明這台設備上的 GSM 介面存在一些問題。

/etc/網路/介面

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

allow-hotplug mlan0
iface mlan0 inet dhcp
       wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/wpa_supplicant/wpa_supplicant.conf

ap_scan=2

# Networks SSIDs
network={
       ssid="1+ Benji"
       psk="REDACTED"
       key_mgmt=WPA-PSK
}

我正在通過重新啟動設備並確保其連接良好,然後關閉並打開手機上的 WiFi 熱點來對此進行測試。當它重新啟動時,wpa_supplicant 現在會掃描以嘗試重新連接(以前不是這樣),但連接一直失敗,只是說車站正在離開。

/var/log/syslog

# Network manually turned off
Feb 11 15:56:08 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-DISCONNECTED bssid=94:65:2d:83:c2:0d reason=3
Feb 11 15:56:08 arm kernel: [  154.302149] wlan: EVENT: Disassociated (reason 0x3)
Feb 11 15:56:08 arm kernel: [  154.302166] wlan: REASON: (Deauth) Sending STA is leaving (or has left) IBSS or ESS
Feb 11 15:56:08 arm kernel: [  154.302339] wlan: Disconnected from 94:XX:XX:XX:c2:0d: Reason code 3
Feb 11 15:56:08 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Feb 11 15:56:08 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:13 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=1
Feb 11 15:56:13 arm kernel: [  159.732160] wlan: SCAN COMPLETED: scanned AP count=0
Feb 11 15:56:14 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:19 arm kernel: [  165.291259] usb 2-1: USB disconnect, device number 5
Feb 11 15:56:19 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=1
Feb 11 15:56:19 arm kernel: [  165.572172] wlan: SCAN COMPLETED: scanned AP count=0
Feb 11 15:56:20 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:26 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=1
Feb 11 15:56:26 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="1+ Benji" auth_failures=1 duration=10 reason=CONN_FAILED
Feb 11 15:56:26 arm kernel: [  171.912043] wlan: SCAN COMPLETED: scanned AP count=0
Feb 11 15:56:31 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:36 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=1
Feb 11 15:56:36 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="1+ Benji" auth_failures=2 duration=20 reason=CONN_FAILED
Feb 11 15:56:36 arm kernel: [  182.252181] wlan: SCAN COMPLETED: scanned AP count=0

# Network AP manually turned back on 
Feb 11 15:56:46 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:51 arm kernel: [  197.512170] wlan: SCAN COMPLETED: scanned AP count=1
Feb 11 15:56:51 arm kernel: [  197.682452] wlan: Connected to bssid 94:XX:XX:XX:c2:0d successfully
Feb 11 15:56:51 arm kernel: [  197.685349] wlan: Received disassociation request on mlan0, reason: 3
Feb 11 15:56:51 arm kernel: [  197.685361] wlan: REASON: (Deauth) Sending STA is leaving (or has left) IBSS or ESS
Feb 11 15:56:53 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-DISCONNECTED bssid=94:65:2d:83:c2:0d reason=3 locally_generated=1
Feb 11 15:56:53 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Feb 11 15:56:53 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:54 arm kernel: [  199.872319] wlan: Connected to bssid 94:XX:XX:XX:c2:0d successfully
Feb 11 15:56:54 arm kernel: [  199.874233] wlan: Received disassociation request on mlan0, reason: 3
Feb 11 15:56:54 arm kernel: [  199.874247] wlan: REASON: (Deauth) Sending STA is leaving (or has left) IBSS or ESS
Feb 11 15:56:55 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-DISCONNECTED bssid=94:65:2d:83:c2:0d reason=3 locally_generated=1
Feb 11 15:56:55 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Feb 11 15:56:55 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:55 arm kernel: [  201.702474] wlan: Connected to bssid 94:XX:XX:XX:c2:0d successfully
Feb 11 15:56:55 arm kernel: [  201.704140] wlan: Received disassociation request on mlan0, reason: 3
Feb 11 15:56:55 arm kernel: [  201.704152] wlan: REASON: (Deauth) Sending STA is leaving (or has left) IBSS or ESS
Feb 11 15:56:57 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-DISCONNECTED bssid=94:65:2d:83:c2:0d reason=3 locally_generated=1
Feb 11 15:56:57 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="1+ Benji" auth_failures=3 duration=30 reason=CONN_FAILED
Feb 11 15:56:57 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Feb 11 15:56:57 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:58 arm kernel: [  203.872352] wlan: Connected to bssid 94:XX:XX:XX:c2:0d successfully
Feb 11 15:56:58 arm kernel: [  203.874052] wlan: Received disassociation request on mlan0, reason: 3
Feb 11 15:56:58 arm kernel: [  203.874064] wlan: REASON: (Deauth) Sending STA is leaving (or has left) IBSS or ESS

正如您在我重新打開設備上的網路 AP 後所看到的那樣,設備一直嘗試重新連接,但由於原因 3 失敗。我已經查找了該原因,但我找不到任何實際說明任何有意義的資訊以及“正在發送”的消息STA 正在離開(或已經離開)IBSS 或 ESS”沒有幫助。

如果需要任何其他資訊或輸出日誌,請告訴我,我很樂意提供。

幾天前我還詢問了設備製造商是否有任何建議,雖然他們花了一點時間才做出回應,但他們的建議似乎運作良好。

我擁有的基本/etc/network/interfaces功能很好,但是當我嘗試所有各種選項時,我缺少 1 行,/etc/wpa_supplicant/wpa_supplicant.conf其中是disable_scan_offload=1… With ap_scan=1

最終配置:

# Enable WiFi scanning on network disconnect.
ap_scan=1
autoscan=periodic:10
disable_scan_offload=1
# This above line is crucial for making wpa_supplicant do the scan instead of relying
# on the driver, which in this case didn't appear to be scanning to reconnect.

# Users saved network list
network={
       ssid="1+ Benji"
       psk="REDACTED"
       key_mgmt=WPA-PSK
}
#network={...}
#network={...}

引用自:https://unix.stackexchange.com/questions/566992