b83e9583cb7d5548f7bd8e46514baa8ff28db772
[openwrt.git] / package / mac80211 / patches / 521-ath9k_common-use_mcast_search.patch
1 --- a/drivers/net/wireless/ath/ath9k/common.c
2 +++ b/drivers/net/wireless/ath/ath9k/common.c
3 @@ -211,10 +211,14 @@ static int ath_reserve_key_cache_slot_tk
4 return -1;
5 }
6
7 -static int ath_reserve_key_cache_slot(struct ath_common *common)
8 +static int ath_reserve_key_cache_slot(struct ath_common *common,
9 + enum ieee80211_key_alg alg)
10 {
11 int i;
12
13 + if (alg == ALG_TKIP)
14 + return ath_reserve_key_cache_slot_tkip(common);
15 +
16 /* First, try to find slots that would not be available for TKIP. */
17 if (common->splitmic) {
18 for (i = IEEE80211_WEP_NKID; i < common->keymax / 4; i++) {
19 @@ -283,6 +287,7 @@ int ath9k_cmn_key_config(struct ath_comm
20 struct ath_hw *ah = common->ah;
21 struct ath9k_keyval hk;
22 const u8 *mac = NULL;
23 + u8 gmac[ETH_ALEN];
24 int ret = 0;
25 int idx;
26
27 @@ -306,9 +311,23 @@ int ath9k_cmn_key_config(struct ath_comm
28 memcpy(hk.kv_val, key->key, key->keylen);
29
30 if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) {
31 - /* For now, use the default keys for broadcast keys. This may
32 - * need to change with virtual interfaces. */
33 - idx = key->keyidx;
34 + switch (vif->type) {
35 + case NL80211_IFTYPE_AP:
36 + memcpy(gmac, vif->addr, ETH_ALEN);
37 + gmac[0] |= 0x01;
38 + mac = gmac;
39 + idx = ath_reserve_key_cache_slot(common, key->alg);
40 + break;
41 + case NL80211_IFTYPE_ADHOC:
42 + memcpy(gmac, sta->addr, ETH_ALEN);
43 + gmac[0] |= 0x01;
44 + mac = gmac;
45 + idx = ath_reserve_key_cache_slot(common, key->alg);
46 + break;
47 + default:
48 + idx = key->keyidx;
49 + break;
50 + }
51 } else if (key->keyidx) {
52 if (WARN_ON(!sta))
53 return -EOPNOTSUPP;
54 @@ -325,14 +344,12 @@ int ath9k_cmn_key_config(struct ath_comm
55 return -EOPNOTSUPP;
56 mac = sta->addr;
57
58 - if (key->alg == ALG_TKIP)
59 - idx = ath_reserve_key_cache_slot_tkip(common);
60 - else
61 - idx = ath_reserve_key_cache_slot(common);
62 - if (idx < 0)
63 - return -ENOSPC; /* no free key cache entries */
64 + idx = ath_reserve_key_cache_slot(common, key->alg);
65 }
66
67 + if (idx < 0)
68 + return -ENOSPC; /* no free key cache entries */
69 +
70 if (key->alg == ALG_TKIP)
71 ret = ath_setkey_tkip(common, idx, key->key, &hk, mac,
72 vif->type == NL80211_IFTYPE_AP);
This page took 0.039986 seconds and 3 git commands to generate.