rt73 & wpasupplicant 'Failed to get scan results'

Live forum: http://rt2x00.serialmonkey.com/viewtopic.php?t=4659

S00NY

09-03-2008 14:38:02

Hi,

I can't get my USB WLAN Adapter to work properly with my WPA encrypted wireless network
I'm on an ARM system (NSLU2) running Debian
[codeld6pc3xo]nslu:~/my-temp-03/WPA_Supplicant# uname -a
Linux nslu 2.6.18-5-ixp4xx #1 Sun Dec 23 05:17:39 UTC 2007 armv5tel GNU/Linux[/codeld6pc3xo]
The device is
[codeld6pc3xo]
nslu:~/my-temp-03/WPA_Supplicant# lsusb
: : :
Bus 003 Device 004: ID 148f:2573 Ralink Technology, Corp. RT2501USB Wireless Adapter
: : :
[/codeld6pc3xo]
I was able to make and install rt73 for my ARM architecture
[codeld6pc3xo]nslu:~/my-temp-01/rt73-cvs-2008030710/Module# make arm
make[1]: Entering directory `/usr/src/linux-headers-2.6.18-5-ixp4xx'
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rtmp_main.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/mlme.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/connect.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rtusb_bulk.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rtusb_io.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/sync.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/assoc.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/auth.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/auth_rsp.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rtusb_data.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rtmp_init.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/sanity.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rtmp_wep.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rtmp_info.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rtmp_tkip.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/wpa.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/md5.o
CC [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rt2x00debug.o
LD [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rt73.o
Building modules, stage 2.
MODPOST
CC /root/my-temp-01/rt73-cvs-2008030710/Module/rt73.mod.o
LD [M] /root/my-temp-01/rt73-cvs-2008030710/Module/rt73.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.18-5-ixp4xx'
*** Module rt73.ko built successfully
nslu:~/my-temp-01/rt73-cvs-2008030710/Module#
nslu:~/my-temp-01/rt73-cvs-2008030710/Module#
nslu:~/my-temp-01/rt73-cvs-2008030710/Module# make install
*** Install module in /lib/modules/2.6.18-5-ixp4xx/extra ...
make[1]: Entering directory `/usr/src/linux-headers-2.6.18-5-ixp4xx'
INSTALL /root/my-temp-01/rt73-cvs-2008030710/Module/rt73.ko
DEPMOD 2.6.18-5-ixp4xx
[/codeld6pc3xo]
I was also able to load the rt73 module successfully
[codeld6pc3xo]
nslu:~/my-temp-03/WPA_Supplicant# ifconfig wlan0 up

nslu:~# tail -f /var/log/syslog
Mar 9 14:57:19 nslu kernel: rt73: init
Mar 9 14:57:19 nslu kernel: rt73: idVendor = 0x148f, idProduct = 0x2573
Mar 9 14:57:20 nslu kernel: rt73: Interface up for first time, activating permanent MAC
Mar 9 14:57:20 nslu kernel: rt73: Active MAC is: 00:10:60:a0:9e:ac.
Mar 9 14:57:20 nslu kernel: rt73: Local MAC = 00:10:60:a0:9e:ac
Mar 9 14:57:20 nslu kernel: usbcore: registered new driver rt73
Mar 9 14:57:20 nslu kernel: rt73: driver version - 1.0.3.6 CVS

nslu:~/my-temp-03/WPA_Supplicant# ifconfig
eth0 Link encap:Ethernet HWaddr 00:18:39:36:CE:28
inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27304 errors:0 dropped:0 overruns:0 frame:0
TX packets:26515 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:2004458 (1.9 MiB) TX bytes:2797416 (2.6 MiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:68 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5352 (5.2 KiB) TX bytes:5352 (5.2 KiB)

wlan0 Link encap:Ethernet HWaddr 00:10:60:A0:9E:AC
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7485 errors:0 dropped:0 overruns:0 frame:0
TX packets:7476 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:740373 (723.0 KiB) TX bytes:493680 (482.1 KiB)
[/codeld6pc3xo]
Everything seems fine so far
[codeld6pc3xo]
nslu:~/my-temp-03/WPA_Supplicant# iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wlan0 RT73 WLAN ESSID:""
Mode:Managed Frequency=2.412 GHz Bit Rate:54 Mb/s
RTS thr:off Fragment thr:off
Encryption key:off
Link Quality=0/100 Signal level:-121 dBm Noise level:-115 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0


nslu:~/my-temp-03/WPA_Supplicant# iwlist scan
lo Interface doesn't support scanning.

eth0 Interface doesn't support scanning.

wlan0 Scan completed :
Cell 01 - Address: 00:1C:4A:D5:57:97
ESSID:"FRITZ!Box 9911"
Mode:Managed
Channel:6
Encryption key:on
Bit Rates:130 Mb/s
Cell 02 - Address: 00:03:C9:36:73:5D
ESSID:"WLAN"
Mode:Managed
Channel:11
Encryption key:on
Bit Rates:6 Mb/s
Cell 03 - Address: 00:12:17:B3:05:96
ESSID:"abcnetwork"
Mode:Managed
Channel:11
Encryption key:on
Bit Rates:234 Mb/s
[/codeld6pc3xo]
So the USB-WLAN-adapter can see my AP which is Cell 03 abcnetwork

The original wpasupplicant that comes with debian does not work
[codeld6pc3xo]
nslu:~/my-temp-01/rt73-cvs-2008030710/Module# wpa_supplicant -d -iwlan0 -c/etc/wpa_supplicant/wp_supplicant.conf
Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
ctrl_interface='/var/run/wpa_supplicant'
Priority group 0
id=0 ssid='tux@domus'
Initializing interface (2) 'wlan0'
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
SIOCGIWRANGE: WE(compiled)=20 WE(source)=14 enc_capa=0x0
capabilities: key_mgmt 0x0 enc 0x3
WEXT: Operstate: linkmode=1, operstate=5
Own MAC address: 00:10:60:a0:9e:ac
wpa_driver_hostap_set_wpa: enabled=1
ioctl[PRISM2_IOCTL_PRISM2_PARAM]: Invalid argument
ioctl[PRISM2_IOCTL_PRISM2_PARAM]: Invalid argument
Driver does not support WPA.
wpa_driver_hostap_set_key: alg=none key_idx=0 set_tx=0 seq_len=0 key_len=0
ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported
Failed to set encryption.
wpa_driver_hostap_set_key: alg=none key_idx=1 set_tx=0 seq_len=0 key_len=0
ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported
Failed to set encryption.
wpa_driver_hostap_set_key: alg=none key_idx=2 set_tx=0 seq_len=0 key_len=0
ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported
Failed to set encryption.
wpa_driver_hostap_set_key: alg=none key_idx=3 set_tx=0 seq_len=0 key_len=0
ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported
Failed to set encryption.
wpa_driver_hostap_set_countermeasures: enabled=0
ioctl[PRISM2_IOCTL_PRISM2_PARAM]: Invalid argument
wpa_driver_hostap_set_drop_unencrypted: enabled=1
ioctl[PRISM2_IOCTL_PRISM2_PARAM]: Invalid argument
Setting scan request: 0 sec 100000 usec
Using existing control interface directory.
bind(PF_UNIX): Address already in use
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore
Failed to initialize control interface '/var/run/wpa_supplicant'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.

Failed to add interface wlan0
State: DISCONNECTED -> DISCONNECTED
Segmentation fault
[/codeld6pc3xo]

So I uninstalled it and found somwhere on this forum a patch for the wpasupplicant on the Ralink site.
But now wpasupplicant can't find any AP on scan although iwlist scan finds some
[codeld6pc3xo]
nslu:~/my-temp-03/WPA_Supplicant# wpa_supplicant -dd -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf
Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
ctrl_interface='/var/run/wpa_supplicant'
eapol_version=1
ap_scan=1
fast_reauth=1
Line: 5 - start of a new network block
ssid - hexdump_ascii(len=9):
74 75 78 40 64 6f 6d 75 73 tux@domus
scan_ssid=1 (0x1)
key_mgmt: 0x2
proto: 0x1
pairwise: 0x8
group: 0x8
PSK - hexdump(len=32): [REMOVED]
Priority group 0
id=0 ssid='tux@domus'
Initializing interface (2) 'wlan0'
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
wpa_driver_wired_init: Added multicast membership with packet socket
Own MAC address: 00:10:60:a0:9e:ac
Setting scan request: 0 sec 100000 usec
Added interface wlan0
State: DISCONNECTED -> SCANNING
Starting AP scan (specific SSID)
Scan SSID - hexdump_ascii(len=9):
74 75 78 40 64 6f 6d 75 73 tux@domus
Trying to get current scan results first without requesting a new scan to speed up initial association
Scan results: -1
Failed to get scan results
Failed to get scan results - try scanning again
Setting scan request: 0 sec 0 usec
Starting AP scan (broadcast SSID)
Failed to initiate AP scan.
Setting scan request: 10 sec 0 usec
Starting AP scan (specific SSID)
Scan SSID - hexdump_ascii(len=9):
74 75 78 40 64 6f 6d 75 73 tux@domus
Failed to initiate AP scan.
Setting scan request: 10 sec 0 usec
Starting AP scan (broadcast SSID)
Failed to initiate AP scan.
Setting scan request: 10 sec 0 usec
CTRL-EVENT-TERMINATING - signal 2 received
Removing interface wlan0
State: SCANNING -> DISCONNECTED
No keys have been configured - skip key clearing
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
No keys have been configured - skip key clearing
Cancelling scan request
Cancelling authentication timeout
[/codeld6pc3xo]

So, actually I'm completely lost
shock


S00NY

Spy84464

09-03-2008 16:57:47

Hello,
rt73 doesn't work with wpa_supplicant out of the box. You need to instruct wpa_supplicant to use a special driver, called "ralink", it's bundled with recent releases of wpa_supplicant, or you can recompile an older version with it, should that be needed.
But this is not the preferred method to set wpa settings with rt73, use "iwpriv" instead, check the file "iwpriv_usage.txt", coming with the driver, for examples. This can only be used for WPAPSK and WPA2PSK though.

Regards,
Romain

S00NY

09-03-2008 17:54:36

Hello,
rt73 doesn't work with wpa_supplicant out of the box. You need to instruct wpa_supplicant to use a special driver, called "ralink", it's bundled with recent releases of wpa_supplicant, or you can recompile an older version with it, should that be needed.
But this is not the preferred method to set wpa settings with rt73, use "iwpriv" instead, check the file "iwpriv_usage.txt", coming with the driver, for examples. This can only be used for WPAPSK and WPA2PSK though.

Regards,
Romain[/quote2x11hkcd]

Hi Romain,

thanks for that hint. iwpriv finally did the trick.
Unfortunately i've got a new problem now., and this is a really strange one shock

The interfaces wlan0 and eth0 seems to be the same !!?!

i can see wlan0 is authenticated now, MAC address of Ap is correct detected, Encryption key is set
[code2x11hkcd]
nslu:~# iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wlan0 RT73 WLAN ESSID:"tux@domus"
Mode:Managed Frequency=2.462 GHz Access Point: 00:12:17:B3:05:96
Bit Rate:11 Mb/s
RTS thr:off Fragment thr:off
Encryption key:8557-D815-FE8F-2849-1D56-05F5-37D8-EF4C-596F-3774-D733-F42B-55FE-B0E1-2B05-4D71
Link Quality=51/100 Signal level:-78 dBm Noise level:-115 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

nslu:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:18:39:36:CE:28
inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4245 errors:0 dropped:0 overruns:0 frame:0
TX packets:3735 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:203126 (198.3 KiB) TX bytes:755205 (737.5 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:66 errors:0 dropped:0 overruns:0 frame:0
TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5032 (4.9 KiB) TX bytes:5032 (4.9 KiB)

wlan0 Link encap:Ethernet HWaddr 00:10:60:A0:9E:AC
inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21710 errors:0 dropped:0 overruns:0 frame:0
TX packets:306 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1992176 (1.8 MiB) TX bytes:21228 (20.7 KiB
[/code2x11hkcd]

I can ping it, connect via ssh onto it,
but when i pull out the eth0 ethernet cable wlan0 does not work anymore.
ifconfig eth0 down makes my box unreachable too.

Using dhcp or static IP for wlan0 makes no difference at all.

My current /etc/network/interfaces is as follows
[code2x11hkcd]
nslu:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
address 192.168.0.3
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.0.1
dns-search example.org
post-up /usr/bin/beep -l 100 -f 6

#auto wlan0
#iface wlan0 inet static
# pre-up iwpriv wlan0 set NetworkType=Infra
# pre-up iwpriv wlan0 set AuthMode=WPAPSK
# pre-up iwpriv wlan0 set EncrypType=TKIP
# pre-up iwpriv wlan0 set SSID="tux@domus"
# pre-up iwpriv wlan0 set WPAPSK=89xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx52
# pre-up iwpriv wlan0 set SSID="tux@domus"
# address 192.168.0.50
# netmask 255.255.255.0
# network 192.168.0.0
# broadcast 192.168.0.255
# gateway 192.168.0.1
# dns-nameservers 192.168.0.1
# dns-search domus
# post-up /usr/bin/beep -l 100 -f 12

auto wlan0
iface wlan0 inet dhcp
pre-up iwpriv wlan0 set NetworkType=Infra
pre-up iwpriv wlan0 set AuthMode=WPAPSK
pre-up iwpriv wlan0 set EncrypType=TKIP
pre-up iwpriv wlan0 set SSID="tux@domus"
pre-up iwpriv wlan0 set WPAPSK=89xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx52
pre-up iwpriv wlan0 set SSID="tux@domus"
[/code2x11hkcd]

What kind of magic is this?
Any idea?

S00NY

defcon

09-03-2008 23:29:13

The rt73 driver itself handles wpa, so why are you using wpa supplicant?

S00NY

10-03-2008 18:24:10

The rt73 driver itself handles wpa, so why are you using wpa supplicant?[/quote1b4rcuky]

Romain told me, so I'm using iwpriv now.
Seems to be ok but I can't use the interface wlan0 without eth0.
Really strange...
is there anybody using a Linksys NSLU2 with a WLAN dongle on this forum?

S00NY