Commit 03ceedea authored by Daniel Yingqiang Ma's avatar Daniel Yingqiang Ma Committed by John W. Linville

ath9k: Group Key fix for VAPs

When I set up multiple VAPs with ath9k, I encountered an issue that
the traffic may be lost after a while.

The detailed phenomenon is
1. After a while the clients connected to one of these VAPs will get
into a state that no broadcast/multicast packets can be transfered
successfully while the unicast packets can be transfered normally.
2. Minutes latter the unitcast packets transfer will fail as well,
because the ARP entry is expired and it can't be freshed due to the
broadcast trouble.

It's caused by the group key overwritten and someone discussed this
issue in ath9k-devel maillist before, but haven't work out a fix yet.

I referred the method in madwifi, and made a patch for ath9k.
The method is to set the high bit of the sender(AP)'s address, and
associated that mac and the group key. It requires the hardware
supports multicast frame key search. It seems true for AR9160.

Not sure whether it's the correct way to fix this issue. But it seems
to work in my test. The patch is attached, feel free to revise it.
Signed-off-by: default avatarDaniel Yingqiang ma <yma.cool@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e8958330
...@@ -751,6 +751,7 @@ static int ath_key_config(struct ath_common *common, ...@@ -751,6 +751,7 @@ static int ath_key_config(struct ath_common *common,
struct ath_hw *ah = common->ah; struct ath_hw *ah = common->ah;
struct ath9k_keyval hk; struct ath9k_keyval hk;
const u8 *mac = NULL; const u8 *mac = NULL;
u8 gmac[ETH_ALEN];
int ret = 0; int ret = 0;
int idx; int idx;
...@@ -774,9 +775,30 @@ static int ath_key_config(struct ath_common *common, ...@@ -774,9 +775,30 @@ static int ath_key_config(struct ath_common *common,
memcpy(hk.kv_val, key->key, key->keylen); memcpy(hk.kv_val, key->key, key->keylen);
if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) {
if (key->ap_addr) {
/*
* Group keys on hardware that supports multicast frame
* key search use a mac that is the sender's address with
* the high bit set instead of the app-specified address.
*/
memcpy(gmac, key->ap_addr, ETH_ALEN);
gmac[0] |= 0x80;
mac = gmac;
if (key->alg == ALG_TKIP)
idx = ath_reserve_key_cache_slot_tkip(common);
else
idx = ath_reserve_key_cache_slot(common);
if (idx < 0)
mac = NULL; /* no free key cache entries */
}
if (!mac) {
/* For now, use the default keys for broadcast keys. This may /* For now, use the default keys for broadcast keys. This may
* need to change with virtual interfaces. */ * need to change with virtual interfaces. */
idx = key->keyidx; idx = key->keyidx;
}
} else if (key->keyidx) { } else if (key->keyidx) {
if (WARN_ON(!sta)) if (WARN_ON(!sta))
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
...@@ -793,6 +793,7 @@ struct ieee80211_key_conf { ...@@ -793,6 +793,7 @@ struct ieee80211_key_conf {
u8 iv_len; u8 iv_len;
u8 hw_key_idx; u8 hw_key_idx;
u8 flags; u8 flags;
u8 *ap_addr;
s8 keyidx; s8 keyidx;
u8 keylen; u8 keylen;
u8 key[0]; u8 key[0];
......
...@@ -139,6 +139,7 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key) ...@@ -139,6 +139,7 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
struct ieee80211_sub_if_data, struct ieee80211_sub_if_data,
u.ap); u.ap);
key->conf.ap_addr = sdata->dev->dev_addr;
ret = drv_set_key(key->local, SET_KEY, sdata, sta, &key->conf); ret = drv_set_key(key->local, SET_KEY, sdata, sta, &key->conf);
if (!ret) { if (!ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment