30 Jan 10:13
duration_id field in zd1211rw
Tomas Vanek <Tomas.Vanek <at> fbl.cz>
2012-01-30 09:13:10 GMT
2012-01-30 09:13:10 GMT
Hello developers,
first thank you for the rewrite of zd1211 driver.
I use a small x86 server currently with linux 3.2.1 and generic ZyDAS
wifi ZD1211B 802.11g (USB ID 0ace:1215), fw 1.4
hostapd v0.7.3 is used for AP mode with WPA2 security. 6 wifi clients
(ath and prism54 chips) connect without problems.
Unfortunately two notebooks with iwl5100 card cannot connect at all.
Tested with both linux and Win7 on the notebook.
I also tested without security and iwl5100 didn't work again.
Hostapd log shows that association worked but EAPOL frame is not replied
by iwl:
----------------------------------------------------------------------
STA 00:22:fb:xx:xx:xx sent probe request for our SSID
mgmt::auth
authentication: STA=00:22:fb:xx:xx:xx auth_alg=0 auth_transaction=1
status_code=0 wep=0
New STA
authentication reply: STA=00:22:fb:xx:xx:xx auth_alg=0
auth_transaction=2 resp=0 (IE len=0)
mgmt::proberesp cb
mgmt::auth cb
mgmt::assoc_req
association request: STA=00:22:fb:xx:xx:xx capab_info=0x411
listen_interval=10
new AID 1
nl80211: Set beacon (beacon_set=1)
mgmt::assoc_resp cb
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0xa057900 key_idx=0
set_tx=1 seq_len=0 key_len=0
addr=00:22:fb:xx:xx:xx
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0xa057900 key_idx=0
set_tx=1 seq_len=0 key_len=0
addr=00:22:fb:xx:xx:xx
WPA: 00:22:fb:xx:xx:xx WPA_PTK entering state INITIALIZE
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0xa057900 key_idx=0
set_tx=1 seq_len=0 key_len=0
addr=00:22:fb:xx:xx:xx
WPA: 00:22:fb:xx:xx:xx WPA_PTK_GROUP entering state IDLE
WPA: 00:22:fb:xx:xx:xx WPA_PTK entering state AUTHENTICATION
WPA: 00:22:fb:xx:xx:xx WPA_PTK entering state AUTHENTICATION2
WPA: 00:22:fb:xx:xx:xx WPA_PTK entering state INITPSK
WPA: 00:22:fb:xx:xx:xx WPA_PTK entering state PTKSTART
WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8
kde_len=0 keyidx=0 encr=0)
nl80211: Event message available
nl80211: Ignored unknown event (cmd=19)
IEEE 802.1X: 00:22:fb:xx:xx:xx TX status - version=2 type=3 length=95 -
ack=0
WPA: 00:22:fb:xx:xx:xx WPA_PTK entering state PTKSTART
WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8
kde_len=0 keyidx=0 encr=0)
IEEE 802.1X: 00:22:fb:xx:xx:xx TX status - version=2 type=3 length=95 -
ack=0
WPA: 00:22:fb:xx:xx:xx WPA_PTK entering state PTKSTART
WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8
kde_len=0 keyidx=0 encr=0)
IEEE 802.1X: 00:22:fb:xx:xx:xx TX status - version=2 type=3 length=95 -
ack=0
mgmt::deauth
deauthentication: STA=00:22:fb:xx:xx:xx reason_code=1
AP-STA-DISCONNECTED 00:22:fb:xx:xx:xx
wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=0xa057900 key_idx=0
set_tx=1 seq_len=0 key_len=0
addr=00:22:fb:xx:xx:xx
WPA: 00:22:fb:xx:xx:xx WPA_PTK entering state DISCONNECTED
WPA: 00:22:fb:xx:xx:xx WPA_PTK entering state INITIALIZE
----------------------------------------------------------------------
Sniffing wireless packets I found strange values in ieee80211 header of
EAPOL and other data packets:
duration_id was bigger than 60000, such values should be reserved for PS
poll.
Sniffer at iwl5100 didn't showed these packets at all. Management
packets with duration_id=0 were
received ok.
After some trials I reset the duration computed by mac80211 to zero:
----------------------------------------------------------------------
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c
b/drivers/net/wireless/zd1211rw/zd_mac.c
index 0a70149..ffbe208 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -866,6 +866,9 @@ static int fill_ctrlset(struct zd_mac *mac,
ZD_ASSERT(frag_len <= 0xffff);
+ /* firmware computes the duration itself and needs the field set
to 0 at input */
+ hdr->duration_id= 0;
+
txrate = ieee80211_get_tx_rate(mac->hw, info);
cs->modulation = txrate->hw_value;
----------------------------------------------------------------------
and surprisingly the ZD1211B firmware computes reasonable values of
duration.
iwl5100 connects ok with fixed driver.
This change probably breaks PS poll packets. They send assoc id in
duration_id field.
I don't know if non B version of ZD1211 has the same problem.
Best regards
Tomas Vanek
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
RSS Feed