Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 139c3a04 authored by Volker Braun's avatar Volker Braun Committed by David S. Miller
Browse files

[MAC80211]: ignore key index on pairwise key (WEP only)



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: default avatarVolker Braun <volker.braun@physik.hu-berlin.de>
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Acked-by: default avatarMichael Wu <flamingice@sourmilk.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c39e3a0d
Loading
Loading
Loading
Loading
+12 −6
Original line number Original line Diff line number Diff line
@@ -73,17 +73,23 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,


	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
	sdata = IEEE80211_DEV_TO_SUB_IF(dev);


	if (is_broadcast_ether_addr(sta_addr)) {
	if (idx < 0 || idx >= NUM_DEFAULT_KEYS) {
		sta = NULL;
		if (idx >= NUM_DEFAULT_KEYS) {
		printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n",
		printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n",
		       dev->name, idx);
		       dev->name, idx);
		return -EINVAL;
		return -EINVAL;
	}
	}

	if (is_broadcast_ether_addr(sta_addr)) {
		sta = NULL;
		key = sdata->keys[idx];
		key = sdata->keys[idx];
	} else {
	} else {
		set_tx_key = 0;
		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 "
			printk(KERN_DEBUG "%s: set_encrypt - non-zero idx for "
			       "individual key\n", dev->name);
			       "individual key\n", dev->name);
			return -EINVAL;
			return -EINVAL;