linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Volker Braun <vbraun@physics.upenn.edu>
To: Jouni Malinen <j@w1.fi>
Cc: Linux Wireless <linux-wireless@vger.kernel.org>,
	Michael Wu <flamingice@sourmilk.net>,
	Johannes Berg <johannes@sipsolutions.net>
Subject: [PATCH 2/2 v2] mac80211: ignore key index on pairwise key (WEP  only)
Date: Sat, 18 Aug 2007 00:44:33 -0400	[thread overview]
Message-ID: <1187412273.3515.4.camel@thinkpad> (raw)
In-Reply-To: <20070818034613.GD1415@jm.kir.nu>

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>


diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index fbdd1d1..2a45e54 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -385,13 +385,14 @@ static int ieee80211_set_encryption(struct net_device *dev
 
        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];
 
                /* TODO: consider adding hwaccel support for these; at least
@@ -405,9 +406,15 @@ static int ieee80211_set_encryption(struct net_device *dev,
                 * being, this can be only set at compile time. */
        } else {
                set_tx_key = 0;
-               if (idx != 0) {
-                       printk(KERN_DEBUG "%s: set_encrypt - non-zero idx for "
-                              "individual key\n", dev->name);
+
+               /*
+                * 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 "
+                               "pairwise key\n", dev->name);
                        return -EINVAL;
                }
 



      reply	other threads:[~2007-08-18  4:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-18  3:00 [PATCH 2/2] mac80211: ignore key index on pairwise key Volker Braun
2007-08-18  3:46 ` Jouni Malinen
2007-08-18  4:44   ` Volker Braun [this message]

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=1187412273.3515.4.camel@thinkpad \
    --to=vbraun@physics.upenn.edu \
    --cc=flamingice@sourmilk.net \
    --cc=j@w1.fi \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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).