linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: Volker Braun <volker.braun@physik.hu-berlin.de>
Subject: [RFC 08/11] mac80211: ignore key index on pairwise key (WEP only)
Date: Thu, 23 Aug 2007 18:45:09 +0200	[thread overview]
Message-ID: <20070823164524.424586000@sipsolutions.net> (raw)
In-Reply-To: 20070823164500.998912000@sipsolutions.net

Work-around for broken APs that use a non-zero key index for WEP
pairwise keys. With this patch, WEP encryption only is exempt from
providing a zero key index.

Signed-off-by: Volker Braun <volker.braun@physik.hu-berlin.de>
Acked-by: Johannes Berg <johannes@sipsolutions.net>

---
 net/mac80211/ieee80211_ioctl.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

--- wireless-dev.orig/net/mac80211/ieee80211_ioctl.c	2007-08-23 18:38:37.961897709 +0200
+++ wireless-dev/net/mac80211/ieee80211_ioctl.c	2007-08-23 18:38:44.581897709 +0200
@@ -385,17 +385,23 @@ static int ieee80211_set_encryption(stru
 
 	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
+	if (idx < 0 || idx >= NUM_DEFAULT_KEYS) {
+		printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n",
+		       dev->name, idx);
+		return -EINVAL;
+	}
+
 	if (is_broadcast_ether_addr(sta_addr)) {
 		sta = NULL;
-		if (idx >= NUM_DEFAULT_KEYS) {
-			printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n",
-			       dev->name, idx);
-			return -EINVAL;
-		}
 		key = sdata->keys[idx];
 	} else {
 		set_tx_key = 0;
-		if (idx != 0) {
+		/*
+		 * According to the standard, the key index of a pairwise
+		 * key must be zero. However, some AP are broken when it
+		 * comes to WEP key indices, so we work around this.
+		 */
+		if (idx != 0 && alg != ALG_WEP) {
 			printk(KERN_DEBUG "%s: set_encrypt - non-zero idx for "
 			       "individual key\n", dev->name);
 			return -EINVAL;

-- 


  parent reply	other threads:[~2007-08-23 16:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-23 16:45 [RFC 00/11] mac80211 updates Johannes Berg
2007-08-23 16:45 ` [RFC 01/11] mac80211: renumber and document the hardware flags Johannes Berg
2007-08-23 16:45 ` [RFC 02/11] mac80211: document a lot more Johannes Berg
2007-08-23 16:45 ` [RFC 03/11] wireless networking: move frame inline functions to generic header Johannes Berg
2007-08-23 16:45 ` [RFC 04/11] mac80211: yet more documentation Johannes Berg
2007-08-23 16:45 ` [RFC 05/11] mac80211: remove tx info sw_retry_attempt member Johannes Berg
2007-08-23 16:45 ` [RFC 06/11] mac80211: remove HW_KEY_IDX_INVALID Johannes Berg
2007-08-23 21:01   ` Michael Buesch
2007-08-24 10:09     ` Johannes Berg
2007-08-23 16:45 ` [RFC 07/11] mac80211: print out wiphy name instead of master device Johannes Berg
2007-08-23 16:45 ` Johannes Berg [this message]
2007-08-23 16:45 ` [RFC 09/11] mac80211, iwlwifi: remove atheros turbo modes Johannes Berg
2007-08-24  0:37   ` [RFC 09/11 v2] " Johannes Berg
2007-08-24  8:00   ` [RFC 09/11] " Zhu Yi
2007-08-24 10:09     ` Johannes Berg
2007-08-27  0:47       ` Zhu Yi
2007-08-27 10:49         ` Johannes Berg
2007-08-23 16:45 ` [RFC 10/11] mac80211: fix warnings introduced by the doc patches Johannes Berg
2007-08-23 16:45 ` [RFC 11/11] mac80211 maintainership Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070823164524.424586000@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=volker.braun@physik.hu-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).