嵌入式设备 wpa_supplicant 重新连接

嵌入式设备 wpa_supplicant 重新连接

我们有一个嵌入式arm设备,运行基于Debian 9的操作系统,运行内核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/系统日志

# 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”没有帮助。

如果需要任何其他信息或输出日志,请告诉我,我很乐意提供。

答案1

几天前我还询问了设备制造商他们是否有任何建议,虽然他们花了一些时间才做出回应,但他们的建议似乎很有效。

我拥有的基本功能/etc/network/interfaces很好,但是当我尝试所有不同的选项时,我缺少了 1 行,其中/etc/wpa_supplicant/wpa_supplicant.confdisable_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={...}

答案2

http://w1.fi/wpa_supplicant/devel/ctrl_iface_page.html

SELECT_NETWORK 选择一个网络 (禁用其他人)。网络 ID 可以从 LIST_NETWORKS 命令输出中接收。

ENABLE_NETWORK 启用网络。网络 ID 可以从 LIST_NETWORKS 命令输出中接收。特殊网络ID全部可用于启用所有网络。

由此我了解到,一旦选择了一个网络,其他网络就会被禁用(conf 文件更改为所有其他网络的禁用 1)。所以我发送命令: 全部启用_网络 连接到特定网络后。

如果由于某种原因设备连接到的网络变得不可用,WPA 会自动将设备连接到其他“已知”网络之一。

并且有效!!!!

(我想补充的是,由于密码错误而设备以前从未连接过的任何网络都应从网络列表中删除,而不仅仅是保留为“禁用”)

相关内容