Hello again!

I tested the patch with pspoll check and concluded it works as it should. I'm planing to post your patch (+ pspoll fix) to upstream, so may I add your 'Signed-off-by' to it?


-Jussi

ps. patch attached.

Quoting Jussi Kivilinna <jussi.kivili...@mbnet.fi>:

Quoting Tomas Vanek <tomas.va...@fbl.cz>:

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.

Looking at vendor's zd1211 driver, it appears that duration_id is kept
at zero for all packets except PSPoll. So following should work:

+       /* firmware computes the duration itself and needs the field set to 0
+        * at input for all packet types than PSPoll.
+        */
+       if (!ieee80211_is_pspoll(hdr->fc))
+               hdr->duration_id = 0;


I don't know if non B version of ZD1211 has the same problem.


Both are handled same for duration_id by vendor driver.


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
_______________________________________________
Zd1211-devs mailing list - http://zd1211.wiki.sourceforge.net/
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/zd1211-devs






------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
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-d2d
_______________________________________________
Zd1211-devs mailing list - http://zd1211.wiki.sourceforge.net/
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/zd1211-devs




zd1211rw: firmware needs duration_id to be set zero for frames other than pspoll

From: Tomas Vanek <tomas.va...@fbl.cz>

Report and v1-patch at:
  http://sourceforge.net/mailarchive/message.php?msg_id=28759111

v2, Jussi Kivilinna <jussi.kivili...@mbnet.fi>: add check for pspoll

Some devices (iwl5100) cannot connect to zd1211rw based AP. It appears that zd1211
firmware messes up duration_id is it is not set to zero by driver. Sniffing traffic
shows that zd1211 is outputing frames with duration_id bits 14 and 15 set, which
are rejected by iwl5100 devices/firmware. Setting duration_id to zero results
zd1211 outputting sane duration_id, which means that firmware is setting correct
values itself and expects duration_id to be zero in first place.

Looking at vendor driver shows that only PSPoll frames have duration_id set by
driver, for other frames duration_id left zero.

Signed-off-by: ---
Signed-off-by: Jussi Kivilinna <jussi.kivili...@mbnet.fi>
---
 drivers/net/wireless/zd1211rw/zd_mac.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 0a70149..98a574a 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -866,6 +866,14 @@ static int fill_ctrlset(struct zd_mac *mac,
 
 	ZD_ASSERT(frag_len <= 0xffff);
 
+	/*
+	 * Firmware computes the duration itself (for all frames except PSPoll)
+	 * and needs the field set to 0 at input, otherwise firmware messes up
+	 * duration_id and sets bits 14 and 15 on.
+	 */
+	if (!ieee80211_is_pspoll(hdr->frame_control))
+		hdr->duration_id = 0;
+
 	txrate = ieee80211_get_tx_rate(mac->hw, info);
 
 	cs->modulation = txrate->hw_value;
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
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-d2d
_______________________________________________
Zd1211-devs mailing list - http://zd1211.wiki.sourceforge.net/
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/zd1211-devs

Reply via email to