Search Linux Wireless

[PATCH 01/12] mac80211: address comments from Michael Wu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The key selection changes had some things Michael Wu wasn't entirely
happy with, address these points.

Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>

---
 net/mac80211/rx.c |   32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

--- wireless-dev.orig/net/mac80211/rx.c	2007-08-28 17:52:43.424622115 +0200
+++ wireless-dev/net/mac80211/rx.c	2007-08-28 17:53:19.014622115 +0200
@@ -321,7 +321,6 @@ ieee80211_rx_h_load_key(struct ieee80211
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
 	int keyidx;
 	int hdrlen;
-	int trying_wep = 0;
 
 	/*
 	 * Key selection 101
@@ -350,12 +349,13 @@ ieee80211_rx_h_load_key(struct ieee80211
 	 * addressed to us nor a multicast frame.
 	 */
 	if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
-		return TXRX_DROP;
+		return TXRX_CONTINUE;
 
-	if (is_multicast_ether_addr(hdr->addr1) || !rx->sta) {
- find_by_index:
+	if (!is_multicast_ether_addr(hdr->addr1) && rx->sta && rx->sta->key) {
+		rx->key = rx->sta->key;
+	} else {
 		/*
-		 * The device doesn't give us the IV so won't be
+		 * The device doesn't give us the IV so we won't be
 		 * able to look up the key. That's ok though, we
 		 * don't need to decrypt the frame, we just won't
 		 * be able to keep statistics accurate.
@@ -369,33 +369,27 @@ ieee80211_rx_h_load_key(struct ieee80211
 		hdrlen = ieee80211_get_hdrlen(rx->fc);
 
 		if (rx->skb->len < 8 + hdrlen)
-			/* COUNT THIS? */
-			return TXRX_DROP;
+			return TXRX_DROP; /* TODO: count this? */
+
 		/*
 		 * no need to call ieee80211_wep_get_keyidx,
 		 * it verifies a bunch of things we've done already
 		 */
 		keyidx = rx->skb->data[hdrlen + 3] >> 6;
 
-		/*
-		 * TODO: handle IBSS! We can have per-STA group keys there!
-		 */
 		rx->key = rx->sdata->keys[keyidx];
 
 		/*
-		 * If we got here for WEP, make sure we got WEP
+		 * RSNA-protected unicast frames should always be sent with
+		 * pairwise or station-to-station keys, but for WEP we allow
+		 * using a key index as well.
 		 */
-		if (trying_wep && rx->key && rx->key->conf.alg != ALG_WEP)
+		if (rx->key && rx->key->conf.alg != ALG_WEP &&
+		    !is_multicast_ether_addr(hdr->addr1))
 			rx->key = NULL;
-	} else {
-		rx->key = rx->sta->key;
-		if (!rx->key) {
-			trying_wep = 1;
-			goto find_by_index;
-		}
 	}
 
-	if (rx->key && (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
+	if (rx->key) {
 		rx->key->tx_rx_count++;
 		if (unlikely(rx->local->key_tx_rx_threshold &&
 			     rx->key->tx_rx_count >

-- 

-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux