RT5572 can authenticate using WPA2, but can't get an IP address from DHCP

0

I have a system running open embedded Linux with the Ralink RT5572 wireless usb card. I have the driver installed along with wpa_supplicant and I need to be able to connect to a WPA2 secured network. As far as I can tell, I can bring the interface up with the correct configuration and after a few seconds it authenticates. I see 2 authentication packets on Wireshark coming from the device, and the log says it passes. At that point I want to run udhcpc or dhclient on the interface to get an IP address, but neither of them will work. I see no more packets on the network from the device. I also tried setting a static IP, and even then I can't ping the gateway or any other computers on the network.

Here is my wpa_supplicant.conf file:

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
}

Here is my log from 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

Has anyone ever seen an issue like this where you can authenticate but any packets after that don't get through?

Smurph269

Posted 2015-07-30T21:22:06.430

Reputation: 1

Answers

0

This ended up being a driver issue. I was using drivers from Mediatek, which is the chip manufacturer for the rt5572. I switched to drivers from SparkLAN, which is the producer of the actual USB Wifi card that I am using with the rt5572 on it. They appear to be the same driver but SparkLAN must have tweaked something. Cross compiling and installing the SparkLAN drivers got WPA2 to work.

Smurph269

Posted 2015-07-30T21:22:06.430

Reputation: 1

I have the exact same problem with drivers from mediatek... But I have D-Link's DWA-160 B2 USB card, and the official D-Link's drivers are from 2008. – jeremija – 2017-05-21T22:30:02.360

0

Has anyone ever seen an issue like this where you can authenticate but any packets after that don't get through?

Actually yes. I had this problem with RT3572- and RT5572-based USB WLAN dongles and some Access Points from Cisco Systems (WLC 2500 business series), Hirschmann, and Symbol Technologies. I temporary solved this by switching to the rt2800usb OSS community driver but this driver has a fairly poor performance compared to the RTxxxxSTA manufacturer driver. Your solution worked for me too with both, RT3572 and RT5572-based dongles. Thanks a lot! :)

Grisha

Posted 2015-07-30T21:22:06.430

Reputation: 1