2007-08-28 23:13:56

by Adam Baker

[permalink] [raw]
Subject: [PATCH] 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

Signed-off-by: Adam Baker <[email protected]>
---

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.

---
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 9c02dff..5bf7185 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -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);


2007-08-29 08:37:48

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] Fix breakage on WEP for cards that rely on software decoding

On Tue, 2007-08-28 at 23:45 +0100, Adam Baker wrote:
> 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


> - 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


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-08-30 11:59:19

by Johannes Berg

[permalink] [raw]
Subject: Re: [Rt2400-devel] [PATCH] Fix breakage on WEP for cards that rely on software decoding

On Wed, 2007-08-29 at 22:23 +0100, Adam Baker wrote:

> 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


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-08-29 11:29:24

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] Fix breakage on WEP for cards that rely on software decoding

On Tue, 2007-08-28 at 23:45 +0100, Adam Baker wrote:

> 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


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-08-29 12:08:00

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] Fix breakage on WEP for cards that rely on software decoding

On Tue, 2007-08-28 at 23:45 +0100, Adam Baker wrote:
> 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


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-08-29 21:23:05

by Adam Baker

[permalink] [raw]
Subject: Re: [Rt2400-devel] [PATCH] Fix breakage on WEP for cards that rely on software decoding

On Wednesday 29 August 2007 13:09, Johannes Berg wrote:

>
> I think this patch ought to fix it as well:
> http://johannes.sipsolutions.net/patches/kernel/all/2007-08-29-12:08/023-re
>work-hardware-crypto-flags.patch
>
> but it should probably have a few more changes.
>

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

2007-08-30 12:24:08

by Robin Cornelius

[permalink] [raw]
Subject: Re: [Rt2400-devel] [PATCH] Fix breakage on WEP for cards that rely on software decoding

On 8/30/07, Johannes Berg <[email protected]> wrote:
> On Wed, 2007-08-29 at 22:23 +0100, Adam Baker wrote:
>
> > 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