linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dcbw@redhat.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, stable@kernel.org,
	Chris Siebenmann <cks-rhbugzilla@cs.toronto.edu>,
	Stanislaw Gruszka <sgruszka@redhat.com>
Subject: [PATCH] airo: fix WEP key clearing after c0380693520b1a1e4f756799a0edc379378b462a
Date: Thu, 04 Feb 2010 23:06:54 -0800	[thread overview]
Message-ID: <1265353614.11066.11.camel@localhost.localdomain> (raw)
In-Reply-To: <1265353178.11066.5.camel@localhost.localdomain>

The firmware apparently needs the WEP key RID touched when turning WEP
off, otherwise it gets angry and refuses to return scan results.  The
firmware doesn't handle zero-length WEP keys so quite the warning
message that was inadvertently printed when disabling WEP, which
wpa_supplicant could trigger repeatedly.

Signed-off-by: Dan Williams <dcbw@redhat.com>

---

diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 4331d67..38902c7 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -5254,11 +5254,8 @@ static int set_wep_key(struct airo_info *ai, u16 index, const char *key,
 	WepKeyRid wkr;
 	int rc;
 
-	if (keylen == 0) {
-		airo_print_err(ai->dev->name, "%s: key length to set was zero",
-			       __func__);
+	if (WARN_ON (keylen == 0))
 		return -1;
-	}
 
 	memset(&wkr, 0, sizeof(wkr));
 	wkr.len = cpu_to_le16(sizeof(wkr));
@@ -6532,7 +6529,7 @@ static int airo_set_encodeext(struct net_device *dev,
 	struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
 	int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 );
 	__le16 currentAuthType = local->config.authType;
-	int idx, key_len, alg = ext->alg, set_key = 1, rc;
+	int idx, key_len, alg = ext->alg, rc;
 	wep_key_t key;
 
 	if (!local->wep_capable)
@@ -6566,10 +6563,9 @@ static int airo_set_encodeext(struct net_device *dev,
 			               idx, rc);
 			return rc;
 		}
-		set_key = ext->key_len > 0 ? 1 : 0;
 	}
 
-	if (set_key) {
+	if (ext->key_len > 0) {
 		/* Set the requested key first */
 		memset(key.key, 0, MAX_KEY_SIZE);
 		switch (alg) {
@@ -6600,12 +6596,20 @@ static int airo_set_encodeext(struct net_device *dev,
 	}
 
 	/* Read the flags */
-	if(encoding->flags & IW_ENCODE_DISABLED)
+	if (encoding->flags & IW_ENCODE_DISABLED) {
+		/* The firmware seems to need the WEP key RID touched when
+		 * setting WEP disabled; resetting the transmit key index to 0
+		 * is good enough.  Otherwise it gets confused and stops
+		 * delivering scan results (!).
+		 */
+		if (!(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY))
+			set_wep_tx_idx(local, 0, 0, 1);
 		local->config.authType = AUTH_OPEN;	// disable encryption
-	if(encoding->flags & IW_ENCODE_RESTRICTED)
+	} else if (encoding->flags & IW_ENCODE_RESTRICTED)
 		local->config.authType = AUTH_SHAREDKEY;	// Only Both
-	if(encoding->flags & IW_ENCODE_OPEN)
+	else if (encoding->flags & IW_ENCODE_OPEN)
 		local->config.authType = AUTH_ENCRYPT;	// Only Wep
+
 	/* Commit the changes to flags if needed */
 	if (local->config.authType != currentAuthType)
 		set_bit (FLAG_COMMIT, &local->flags);



  reply	other threads:[~2010-02-05  7:07 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 14:34 [PATCH] airo: fix setting zero length WEP key Stanislaw Gruszka
2010-02-02 18:32 ` Chris Siebenmann
2010-02-03 20:43 ` Dan Williams
2010-02-03 21:31   ` Chris Siebenmann
2010-02-04 21:44     ` Dan Williams
2010-02-04 22:10       ` Chris Siebenmann
2010-02-04 22:18         ` Dan Williams
2010-02-04 22:26           ` Chris Siebenmann
2010-02-04 22:39             ` Dan Williams
2010-02-04 22:42               ` Chris Siebenmann
2010-02-04 23:00                 ` Dan Williams
2010-02-04 23:03                   ` Chris Siebenmann
2010-02-04 23:26                     ` Dan Williams
2010-02-04 23:30                       ` Dan Williams
2010-02-04 23:36                       ` Chris Siebenmann
2010-02-05  6:57                         ` Dan Williams
2010-02-04 12:04   ` Stanislaw Gruszka
2010-02-04 12:07 ` [PATCH v2] " Stanislaw Gruszka
2010-02-04 16:41   ` Chris Siebenmann
2010-02-04 23:56   ` Dan Williams
2010-02-05  9:11     ` Stanislaw Gruszka
2010-02-05  6:59   ` Dan Williams
2010-02-05  7:06     ` Dan Williams [this message]
2010-02-05 16:26       ` [PATCH] airo: fix WEP key clearing after c0380693520b1a1e4f756799a0edc379378b462a Chris Siebenmann
2010-02-05 19:20         ` Dan Williams
2010-02-05 23:12           ` Chris Siebenmann
2010-02-08 23:47             ` Dan Williams
2010-02-09 16:25               ` Chris Siebenmann
2010-02-09 17:17               ` Chris Siebenmann
2010-02-08 20:55     ` [PATCH v2] airo: fix setting zero length WEP key John W. Linville
2010-02-08 23:44       ` Dan Williams
2010-02-08 20:53   ` John W. Linville
2010-02-09  8:27     ` [PATCH] airo: return from set_wep_key() when key length is zero Stanislaw Gruszka
2010-02-26 14:10     ` [PATCH resend] " Stanislaw Gruszka
2010-02-26 23:09       ` Dan Williams
2010-02-27  1:26         ` John W. Linville
2010-03-01  7:47           ` Stanislaw Gruszka
2010-02-26 23:09   ` [PATCH v2] airo: fix setting zero length WEP key Dan Williams

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=1265353614.11066.11.camel@localhost.localdomain \
    --to=dcbw@redhat.com \
    --cc=cks-rhbugzilla@cs.toronto.edu \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=sgruszka@redhat.com \
    --cc=stable@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).