Subject: Various issues with rum(4)
To: None <current-users@netbsd.org>
From: Dave Huang <khym@azeotrope.org>
List: current-users
Date: 11/24/2006 14:33:03
I recently got an ASUS WL-167g (version 2) USB 802.11g adapter to use
in a Compaq IA1, and after patching the rum(4) driver to recognize the
vendor/product IDs, it kinda works:

rum0 at uhub0 port 1
rum0: Ralink 802.11 bg WLAN, rev 2.00/0.01, addr 2
rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, address 00:18:f3:63:bf:01
rum0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
rum0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps

However, I've run into a couple of issues:

It seems to hang after a while (I don't know exactly how long "a
while" is... a few hours?). I get messages from dhclient complaining
"dhclient: send_packet: No buffer space available". Doing
  ifconfig rum0 down && ifconfig rum0 up
will temporarily get it working again.

The above is with encryption on the AP disabled. I'd like to use WPA,
but I'm having issues getting that to work properly too. This is the
first time I've tried to set up WPA on NetBSD, so I don't know if the
problems are user error, the rum driver, or wpa_supplicant (or all of
the above :)

With the following in /etc/wpa_supplicant.conf:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel

network={
	ssid="meow"
	key_mgmt=IEEE8021X WPA-EAP
	identity="khym@azeotrope.org"
	eap=TLS
        ca_cert="/etc/openssl/certs/azeotropeCA.pem"
	client_cert="/etc/openssl/certs/ia1-wpaclient_cert.pem"
        private_key="/etc/openssl/private/ia1-wpaclient_key.pem"
	private_key_passwd="[removed]"
}

I run:
wpa_supplicant -i rum0 -c /etc/wpa_supplicant.conf

And I get:
Trying to associate with 00:17:9a:40:0f:3f (SSID='meow' freq=2412 MHz)
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
Associated with 00:17:9a:40:0f:3f
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
CTRL-EVENT-EAP-STARTED EAP authentication started
OpenSSL: pending error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
OpenSSL: pending error: error:140C800D:SSL routines:SSL_use_certificate_file:ASN1 lib
OpenSSL: pending error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
OpenSSL: pending error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
OpenSSL: pending error: error:0D09A00D:asn1 encoding routines:d2i_PrivateKey:ASN1 lib
OpenSSL: pending error: error:140CB00d:SSL routines:SSL_use_PrivateKey_file:ASN1 lib
CTRL-EVENT-EAP-METHOD EAP method 13 (TLS) selected
CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
Authentication with 00:17:9a:40:0f:3f timed out.
Trying to associate with 00:17:9a:40:0f:3f (SSID='meow' freq=2412 MHz)
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
Associated with 00:17:9a:40:0f:3f
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
CTRL-EVENT-EAP-FAILURE EAP authentication failed
Authentication with 00:17:9a:40:0f:3f timed out.
Trying to associate with 00:17:9a:40:0f:3f (SSID='meow' freq=2412 MHz)
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
Associated with 00:17:9a:40:0f:3f
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
WPA: Failed to get master session key from EAPOL state machines
WPA: Key handshake aborted
CTRL-EVENT-EAP-STARTED EAP authentication started
CTRL-EVENT-EAP-METHOD EAP method 13 (TLS) selected
CTRL-EVENT-EAP-FAILURE EAP authentication failed
Authentication with 00:17:9a:40:0f:3f timed out.
Trying to associate with 00:17:9a:40:0f:3f (SSID='meow' freq=2412 MHz)
Associated with 00:17:9a:40:0f:3f
CTRL-EVENT-EAP-STARTED EAP authentication started
TLS - SSL error: error:0B07C065:x509 certificate routines:X509_STORE_add-cert:cert already in hash table
OpenSSL: pending error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
OpenSSL: pending error: error:140C800D:SSL routines:SSL_use_certificate_file:ASN1 lib
OpenSSL: pending error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
OpenSSL: pending error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
OpenSSL: pending error: error:0D09A00D:asn1 encoding routines:d2i_PrivateKey:ASN1 lib
OpenSSL: pending error: error:140CB00d:SSL routines:SSL_use_PrivateKey_file:ASN1 lib
CTRL-EVENT-EAP-METHOD EAP method 13 (TLS) selected
CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
WPA: Key negotiation completed with 00:17:9a:40:0f:3f [PTK=TKIP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to 00:17:9a:40:0f:3f completed (auth)

With pauses of various lengths along the way... it takes about 5
minutes to finally get connected. But even after I've connected, all
is not well. If I run "dhclient rum0", I get a kernel message:

rum0: could not open Tx pipe: IN_USE

and dhclient complains "send_packet: Network is down". At the same
time, wpa_supplicant says:

CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
ioctl[SIOCS80211]: Invalid argument
ioctl[SIOCS80211, op 23, arg 0x0]: Invalid argument
Failed to initiate AP scan.

It then goes though its long routine of attempting to re-authenticate,
finally succeeding after a few minutes. Manually attempting to
configure an IP address with ifconfig does the same thing.

Interestingly, rtsol rum0 does get me a good IPv6 address from rtadvd
running on another machine, and ping6 works fine.

The same setup seems to work fine with a Windows XP client... I can
connect, get authenticated,  and get an IP address within a couple of
seconds).

And finally, if I put the following in /etc/ifconfig.rum0:
!wpa_supplicant -B -i rum0 -c /etc/wpa_supplicant.conf
up nwid meow

I get this during booting:
[ ... ]
IPv6 mode: autoconfigured host
Configuring network interfaces: rum0rum0: could not open Tx pipe: IN_USE
uvm_fault(0xc3a8ac40, 0, 1) -> 0xe
kernel: supervisor trap page fault, code=0
Stopped in pid 120.1 (wpa_supplicant) at        netbsd:usbd_close_pipe+0xa: movl     0xc(%ebx),%eax
db> t
usbd_close_pipe(...) at netbsd:usbd_close_pipe+0xa
rum_stop(...) at netbsd:rum_stop+0x92
rum_init(...) at netbsd:rum_init+0x17d
rum_ioctl(...) at netbsd:rum_ioctl+0xdc
in6_addmulti(...) at netbsd:in6_addmulti+0x272
in6_joingroup(...) at netbsd:in6_joingroup+0x3a
in6_update_ifa(...) at netbsd:in6_update_ifa+0x72f
in6_ifattach(...) at netbsd:in6_ifattach+0x1c3
in6_if_up(...) at netbsd:in6_if_up+0x5b
ifioctl(...) at netbsd:ifioctl+0x1f7
sys_ioctl(...) at netbsd:sys_ioctl+0x142
syscall_plain() at netbsd:syscall_plain+0x155
--- syscall (number 54) ---
0xbba2f7ef:
db>
[ typed in manually... function arguments removed, and there may be typos ]

Removing either the "nwid meow" part or the "!wpa_supplicant" line will stop
it from crashing.

Any suggestions on what I can do to debug this?
-- 
Name: Dave Huang         |  Mammal, mammal / their names are called /
INet: khym@azeotrope.org |  they raise a paw / the bat, the cat /
FurryMUCK: Dahan         |  dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 31 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++