Skip to contentSkip to conversation

Fix breakage on WEP for cards that rely on software decoding

PATCH In review Adam Baker 4 participants 7 messages Aug 28, 2007 – Aug 30, 2007 mac80211

lore
Share & tools
lore

Adam Baker

author
#0 lore raw

PATCH 1/1 Fix breakage on WEP for cards that rely on software decoding

The test to drop out of ieee80211_rx_h_load_key if we don't know the IV should check if the packet has already been decrypted, otherwise we need to load the key to be able to decrypt it

---

When using rt2x00 with WEP we get continuous reports of "RX WEP frame, but no key set" without this patch. As the rt2x00 driver currently relies on mac80211 to perform the decryption I believe it would be incorrect for the driver to set IEEE80211_HW_WEP_INCLUDE_IV. Also reading some of the code comments it appears that even for a card that does HW decryption there are circumstances where the SW decryption will get used and in those cases we need to set the key.

The patch was generated against the rt2x00 git but looks like it applies to the current wireless-dev everything.

---

net/mac80211/rx.c +2 -1
index 9c02dff..5bf7185 100644
@@ -363,7 +363,8 @@ ieee80211_rx_h_load_key(struct ieee80211
 		 * we somehow allow the driver to tell us which key
 		 * the hardware used if this flag is set?
 		 */
-		if (!(rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV))
+		if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
+		    (!(rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV)))
 			return TXRX_CONTINUE;
 
 		hdrlen = ieee80211_get_hdrlen(rx->fc);
maintainer
#1 lore raw

net/mac80211/rx.c ieee80211_rx_h_load_key(struct ieee80211 · line 368

Quoted 9 lines · Adam Baker

The test to drop out of ieee80211_rx_h_load_key if we don't know the IV should check if the packet has already been decrypted, otherwise we need to load the key to be able to decrypt it

net/mac80211/rx.c +2 -1
-		if (!(rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV))
+		if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) &&
+		    (!(rx->local->hw.flags & IEEE80211_HW_WEP_INCLUDE_IV)))
 			return TXRX_CONTINUE;

Huh, yes, this patch is correct, I just never noticed because my later patch changes it again when introducing the per-frame INCLUDE_IV flag.

johannes

maintainer
#2 lore raw
In reply to Adam Baker
Quoted 10 lines · Adam Baker

When using rt2x00 with WEP we get continuous reports of "RX WEP frame, but no key set" without this patch. As the rt2x00 driver currently relies on mac80211 to perform the decryption I believe it would be incorrect for the driver to set IEEE80211_HW_WEP_INCLUDE_IV. Also reading some of the code comments it appears that even for a card that does HW decryption there are circumstances where the SW decryption will get used and in those cases we need to set the key.

The patch was generated against the rt2x00 git but looks like it applies to the current wireless-dev everything.

This seems correct but it looks like we need to fix a few more instances of similar checks, especially those involving "KEY_FLAG_UPLOADED_TO_HARDWARE". I'll take a look.

johannes

maintainer
#3 lore raw
In reply to Adam Baker
Quoted 3 lines · Adam Baker

The test to drop out of ieee80211_rx_h_load_key if we don't know the IV should check if the packet has already been decrypted, otherwise we need to load the key to be able to decrypt it

I think this patch ought to fix it as well:
http://johannes.sipsolutions.net/patches/kernel/all/2007-08-29-12:08/023-rework-hardware-crypto-flags.patch

but it should probably have a few more changes.

johannes

maintainer
#5 lore raw
Quoted 2 lines · Adam Baker

I can confirm that with that patch WEP is working for me. Another user on the rt2x00 forum is also reporting success with it.

Good. I'll be posting this patch for inclusion soon.

johannes

#6 lore raw
Quoted 7 lines · Johannes Berg
Quoted 2 lines · Adam Baker

I can confirm that with that patch WEP is working for me. Another user on the rt2x00 forum is also reporting success with it.

Good. I'll be posting this patch for inclusion soon.

Hi Johannes,

A bit behind the boat here but another successful test (rt2x00:- rt61pci, rt73usb and rt2500usb) here as well. Clears the issue for me.

Robin Cornelius