RT5572 可以使用 WPA2 进行身份验证,但无法从 DHCP 获取 IP 地址

RT5572 可以使用 WPA2 进行身份验证,但无法从 DHCP 获取 IP 地址

我有一个运行开放式嵌入式 Linux 的系统,带有 Ralink RT5572 无线 USB 卡。我安装了驱动程序和 wpa_supplicant,我需要能够连接到 WPA2 安全网络。据我所知,我可以使用正确的配置启动接口,几秒钟后它就会进行身份验证。我在 Wireshark 上看到来自设备的 2 个身份验证数据包,日志显示它已通过。此时我想在接口上运行 udhcpc 或 dhclient 以获取 IP 地址,但它们都不起作用。我没有在网络上看到来自该设备的更多数据包。我还尝试设置静态 IP,但即使这样,我也无法 ping 网关或网络上的任何其他计算机。

这是我的 wpa_supplicant.conf 文件:

ctrl_interface=/var/run/wpa_supplicant
update_config=1
ap_scan=1

network={
    ssid="HTC One M9 8506"
    psk=###########################################
    scan_ssid=1
    key_mgmt=WPA-PSK
    proto=WPA2
    pairwise=CCMP TKIP
    group=CCMP TKIP
    auth_alg=OPEN
}

这是我的来自 wpa_supplicant 的日志:

som9g45:~# ifup ra0
+ '[' ra0 = lo ']'
+ '[' -n '' ']'
+ WPA_IFACE=ra0
+ '[' -f /etc/wpa_supplicant/functions.sh ']'
+ . /etc/wpa_supplicant/functions.sh
++ WPA_SUP_BIN=/usr/sbin/wpa_supplicant
++ WPA_SUP_PNAME=wpa_supplicant
++ WPA_SUP_PIDFILE=/var/run/wpa_supplicant.ra0.pid
++ WPA_CLI_BIN=/usr/sbin/wpa_cli
++ WPA_CLI_PNAME=wpa_cli
++ WPA_CLI_PIDFILE=/var/run/wpa_action.ra0.pid
++ WPA_CLI_LOGFILE=/var/log/wpa_action.log
++ WPA_CLI_TIMESTAMP=/var/run/wpa_action.ra0.timestamp
++ '[' -z '' ']'
++ WPA_CTRL_DIR=/var/run/wpa_supplicant
++ '[' -n '' ']'
++ '[' '' = 1 ']'
++ TO_NULL=/dev/null
++ DAEMON_VERBOSITY=--quiet
+ '[' '!' -x /usr/sbin/wpa_supplicant ']'
+ '[' '!' -x /usr/sbin/wpa_cli ']'
+ test_wpa_cli
+ test_daemon_pidfile /usr/sbin/wpa_cli /var/run/wpa_action.ra0.pid
+ local DAEMON PIDFILE
+ '[' -n /usr/sbin/wpa_cli ']'
+ DAEMON=/usr/sbin/wpa_cli
+ '[' -f /var/run/wpa_action.ra0.pid ']'
+ '[' -n /usr/sbin/wpa_cli ']'
+ '[' -f '' ']'
+ return 1
+ echo 'Initial WPA Checks Pass'
Initial WPA Checks Pass
+ '[' -n '' ']'
+ '[' -n /etc/wpa_supplicant.conf ']'
+ '[' '!' -s /etc/wpa_supplicant.conf ']'
++ sed -n 's/[[:space:]]*#.*//g;s/[[:space:]]\+.*$//g;s/^\(ctrl_interface\|DIR\)=\(.*\)/\2/p' /etc/wpa_supplicant.conf
+ WPA_SUP_CONF_CTRL_DIR=/var/run/wpa_supplicant
+ '[' -n /var/run/wpa_supplicant ']'
+ WPA_CTRL_DIR=/var/run/wpa_supplicant
+ WPA_SUP_CONF='-c /etc/wpa_supplicant.conf -C /var/run/wpa_supplicant'
+ case "$MODE" in
+ PHASE=pre-up
+ echo 'WPA: Configuring Interface'
WPA: Configuring Interface
+ case "$PHASE" in
+ kill_wpa_supplicant
+ test_wpa_supplicant
+ test_daemon_pidfile /usr/sbin/wpa_supplicant /var/run/wpa_supplicant.ra0.pid
+ local DAEMON PIDFILE
+ '[' -n /usr/sbin/wpa_supplicant ']'
+ DAEMON=/usr/sbin/wpa_supplicant
+ '[' -f /var/run/wpa_supplicant.ra0.pid ']'
+ '[' -n /usr/sbin/wpa_supplicant ']'
+ '[' -f '' ']'
+ return 1
+ '[' -S /var/run/wpa_supplicant/ra0 ']'
+ init_wpa_supplicant
+ '[' -n '-c /etc/wpa_supplicant.conf -C /var/run/wpa_supplicant' ']'
+ '[' -n '' ']'
+ local WPA_SUP_DRIVER WPA_SUP_OPTIONS
+ '[' -n '' ']'
+ WPA_SUP_OPTIONS='-B -P /var/run/wpa_supplicant.ra0.pid -i ra0'
+ '[' -n '' ']'
+ '[' -n ralink ']'
+ WPA_SUP_DRIVER=ralink
+ wpa_msg verbose 'wpa-driver ralink'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo 'wpa_supplicant: wpa-driver ralink'
+ wpa_msg verbose '/usr/sbin/wpa_supplicant -B -P /var/run/wpa_supplicant.ra0.pid -i ra0 -D ralink -c /etc/wpa_supplicant.conf -C /var/run/wpa_supplicant'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo 'wpa_supplicant: /usr/sbin/wpa_supplicant -B -P /var/run/wpa_supplicant.ra0.pid -i ra0 -D ralink -c /etc/wpa_supplicant.conf -C /var/run/wpa_supplicant'
+ start-stop-daemon --start --oknodo --quiet --name wpa_supplicant --startas /usr/sbin/wpa_supplicant --pidfile /var/run/wpa_supplicant.ra0.pid -- -B -P /var/run/wpa_supplicant.ra0.pid -i ra0 -D ralink -c /etc/wpa_supplicant.conf -C /var/run/wpa_supplicant
+ '[' 0 '!=' 0 ']'
+ local WPA_SOCKET_WAIT MAX_WPA_SOCKET_WAIT
+ WPA_SOCKET_WAIT=0
+ MAX_WPA_SOCKET_WAIT=5
+ '[' -S /var/run/wpa_supplicant/ra0 ']'
+ wpa_msg verbose 'ctrl_interface socket located at /var/run/wpa_supplicant/ra0'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo 'wpa_supplicant: ctrl_interface socket located at /var/run/wpa_supplicant/ra0'
+ conf_wpa_supplicant
+ '[' -n '' ']'
+ '[' ralink = wired ']'
+ '[' -n '' ']'
+ wpa_cli_do '' raw ap_scan wpa-ap-scan
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw preauthenticate wpa-preauthenticate
+ '[' -z '' ']'
+ return 0
+ '[' -n '"HTC One M9 8506"' ']'
+ case "$IF_WPA_SSID" in
++ echo -n '"HTC One M9 8506"'
++ sed 's/^"//;s/"$//'
+ IF_WPA_SSID='HTC One M9 8506'
++ wpa_cli add_network
++ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 add_network
+ WPA_ID=1
+ wpa_msg verbose 'configuring network block -- 1'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo 'wpa_supplicant: configuring network block -- 1'
+ wpa_cli_do 'HTC One M9 8506' ascii set_network ssid wpa-ssid
+ '[' -z 'HTC One M9 8506' ']'
+ local WPACLISET_VALUE WPACLISET_VARIABLE WPACLISET_DESC
+ case "$2" in
+ WPACLISET_VALUE='"HTC One M9 8506"'
+ case "$3" in
+ '[' -z 1 ']'
+ shift
+ WPACLISET_VARIABLE='set_network 1 ssid'
+ case "$4" in
+ WPACLISET_DESC='wpa-ssid "HTC One M9 8506"'
+ wpa_msg action 'wpa-ssid "HTC One M9 8506"'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo -n 'wpa_supplicant: wpa-ssid "HTC One M9 8506" -- '
+ wpa_cli set_network 1 ssid '"HTC One M9 8506"'
+ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 set_network 1 ssid '"HTC One M9 8506"'
+ wpa_cli_do '' raw set_network priority wpa-priority
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network bssid wpa-bssid
+ '[' -z '' ']'
+ return 0
+ '[' -s '' ']'
+ '[' -s '' ']'
+ '[' -n '' ']'
+ '[' -n 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b ']'
+ wpa_key_check_and_set 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ '[' -z 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b ']'
+ local KEY KEY_TYPE
+ case "$1" in
+ KEY=8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ ishex 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ '[' -z 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b ']'
+ case "$1" in
+ return 0
+ '[' 64 -eq 64 ']'
+ KEY_TYPE=raw
+ wpa_cli_do 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b raw set_network psk wpa-psk
+ '[' -z 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b ']'
+ local WPACLISET_VALUE WPACLISET_VARIABLE WPACLISET_DESC
+ case "$2" in
+ WPACLISET_VALUE=8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ case "$3" in
+ '[' -z 1 ']'
+ shift
+ WPACLISET_VARIABLE='set_network 1 psk'
+ case "$4" in
+ WPACLISET_DESC='wpa-psk *****'
+ wpa_msg action 'wpa-psk *****'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo -n 'wpa_supplicant: wpa-psk ***** -- '
+ wpa_cli set_network 1 psk 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 set_network 1 psk 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ wpa_cli_do '' raw set_network pairwise wpa-pairwise
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do 'TKIP CCMP' raw set_network group wpa-group
+ '[' -z 'TKIP CCMP' ']'
+ local WPACLISET_VALUE WPACLISET_VARIABLE WPACLISET_DESC
+ case "$2" in
+ WPACLISET_VALUE='TKIP CCMP'
+ case "$3" in
+ '[' -z 1 ']'
+ shift
+ WPACLISET_VARIABLE='set_network 1 group'
+ case "$4" in
+ WPACLISET_DESC='wpa-group TKIP CCMP'
+ wpa_msg action 'wpa-group TKIP CCMP'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo -n 'wpa_supplicant: wpa-group TKIP CCMP -- '
+ wpa_cli set_network 1 group 'TKIP CCMP'
+ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 set_network 1 group 'TKIP CCMP'
+ wpa_cli_do '' raw set_network mode wpa-mode
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network frequency wpa-frequency
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do WPA-PSK raw set_network key_mgmt wpa-key-mgmt
+ '[' -z WPA-PSK ']'
+ local WPACLISET_VALUE WPACLISET_VARIABLE WPACLISET_DESC
+ case "$2" in
+ WPACLISET_VALUE=WPA-PSK
+ case "$3" in
+ '[' -z 1 ']'
+ shift
+ WPACLISET_VARIABLE='set_network 1 key_mgmt'
+ case "$4" in
+ WPACLISET_DESC='wpa-key-mgmt WPA-PSK'
+ wpa_msg action 'wpa-key-mgmt WPA-PSK'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo -n 'wpa_supplicant: wpa-key-mgmt WPA-PSK -- '
+ wpa_cli set_network 1 key_mgmt WPA-PSK
+ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 set_network 1 key_mgmt WPA-PSK
+ wpa_cli_do '' raw set_network proto wpa-proto
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network auth_alg wpa-auth-alg
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network scan_ssid wpa-scan-ssid
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network identity wpa-identity
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network anonymous_identity wpa-anonymous-identity
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network eap wpa-eap
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network eappsk wpa-eappsk
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network nai wpa-nai
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network password wpa-password
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network ca_cert wpa-ca-cert
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network ca_path wpa-ca-path
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network client_cert wpa-client-cert
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network private_key wpa-private-key
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network private_key_passwd wpa-private-key-passwd
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network dh_file wpa-dh-file
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network subject_match wpa-subject-match
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network altsubject_match wpa-altsubject-match
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network ca_cert2 wpa-ca-cert2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network ca_path2 wpa-ca-path2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network client_cert2 wpa-client-cert2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network private_key2 wpa-private-key2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network private_key_passwd2 wpa-private-key-passwd2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network dh_file2 wpa-dh-file2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network subject_match2 wpa-subject-match2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network altsubject_match2 wpa-altsubject-match2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network eap_methods wpa-eap-methods
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network phase1 wpa-phase1
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network phase2 wpa-phase2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network pcsc wpa-pcsc
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network pin wpa-pin
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network engine wpa-engine
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network engine_id wpa-engine-id
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network key_id wpa-key-id
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network eapol_flags wpa-eapol-flags
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network wep_key0 wpa-wep-key0
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network wep_key1 wpa-wep-key1
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network wep_key2 wpa-wep-key2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network wep_key3 wpa-wep-key3
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network wep_tx_keyidx wpa-wep-tx-keyidx
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network proactive_key_caching wpa-proactive-key-caching
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network pac_file wpa-pac-file
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network mode wpa-mode
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network peerkey wpa-peerkey
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network fragment_size wpa-fragment-size
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network id_str wpa-id-str
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do 1 raw enable_network 'enabling network block'
+ '[' -z 1 ']'
+ local WPACLISET_VALUE WPACLISET_VARIABLE WPACLISET_DESC
+ case "$2" in
+ WPACLISET_VALUE=1
+ case "$3" in
+ WPACLISET_VARIABLE=enable_network
+ case "$4" in
+ WPACLISET_DESC='enabling network block 1'
+ wpa_msg action 'enabling network block 1'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo -n 'wpa_supplicant: enabling network block 1 -- '
+ wpa_cli enable_network 1
+ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 enable_network 1
+ exit 0
udhcpc (v1.13.3) started
SCANNING 0 0
SCANNING 1 0
SCANNING 2 0
SCANNING 3 0
4WAY_HANDSHAKE 4 0
COMPLETED 21 1
Sending discover...
Sending discover...
Sending discover...
COMPLETED 21 1
DHCP network address discovery failure!
Setting default address of 192.168.2.127...
deleting routers
adding default dns 192.168.2.1
No lease, failing

是否有人见过这样的问题:您可以进行身份​​验证,但之后的任何数据包都无法通过?

答案1

这最终是一个驱动程序问题。我使用的是 Mediatek 的驱动程序,它是 rt5572 的芯片制造商。我改用了 SparkLAN 的驱动程序,它是我使用的实际 USB Wifi 卡的生产商,上面有 rt5572。它们看起来是相同的驱动程序,但 SparkLAN 一定做了一些调整。交叉编译和安装 SparkLAN 驱动程序使 WPA2 可以正常工作。

答案2

是否有人见过这样的问题:您可以进行身份​​验证,但之后的任何数据包都无法通过?

确实如此。我在使用基于 RT3572 和 RT5572 的 USB WLAN 适配器以及 Cisco Systems(WLC 2500 商务系列)、Hirschmann 和 Symbol Technologies 的一些接入点时遇到了这个问题。我通过切换到 rt2800usb OSS 社区驱动程序暂时解决了这个问题,但与 RTxxxxSTA 制造商驱动程序相比,该驱动程序的性能相当差。您的解决方案也适用于基于 RT3572 和 RT5572 的适配器。非常感谢!:)

相关内容