summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_crypto.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-07-09 23:15:30 +0000
committersam <sam@FreeBSD.org>2005-07-09 23:15:30 +0000
commitaa33c1cc86a8bd32c93cc88f706b51a697c63a7c (patch)
tree06002285d2fd3472e44ace9d966623a91b50721d /sys/net80211/ieee80211_crypto.c
parentfb9f2e36f10f7314d7111d3ab5a81fdef069cd9f (diff)
downloadFreeBSD-src-aa33c1cc86a8bd32c93cc88f706b51a697c63a7c.zip
FreeBSD-src-aa33c1cc86a8bd32c93cc88f706b51a697c63a7c.tar.gz
Change default key allocation method to do the right thing for
legacy parts (i.e. those that have 4 global key slots). We blindly assign unicast keys to key slot 0. Devices that need alternate allocation logic must override this method. Reviewed by: avatar Approved by: re (scottl)
Diffstat (limited to 'sys/net80211/ieee80211_crypto.c')
-rw-r--r--sys/net80211/ieee80211_crypto.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/net80211/ieee80211_crypto.c b/sys/net80211/ieee80211_crypto.c
index d68ca47..c20a81f 100644
--- a/sys/net80211/ieee80211_crypto.c
+++ b/sys/net80211/ieee80211_crypto.c
@@ -61,7 +61,24 @@ static int _ieee80211_crypto_delkey(struct ieee80211com *,
static int
null_key_alloc(struct ieee80211com *ic, const struct ieee80211_key *k)
{
- return IEEE80211_KEYIX_NONE;
+ if (!(&ic->ic_nw_keys[0] <= k &&
+ k < &ic->ic_nw_keys[IEEE80211_WEP_NKID])) {
+ /*
+ * Not in the global key table, the driver should handle this
+ * by allocating a slot in the h/w key table/cache. In
+ * lieu of that return key slot 0 for any unicast key
+ * request. We disallow the request if this is a group key.
+ * This default policy does the right thing for legacy hardware
+ * with a 4 key table. It also handles devices that pass
+ * packets through untouched when marked with the WEP bit
+ * and key index 0.
+ */
+ if ((k->wk_flags & IEEE80211_KEY_GROUP) == 0)
+ return 0; /* NB: use key index 0 for ucast key */
+ else
+ return IEEE80211_KEYIX_NONE;
+ }
+ return k - ic->ic_nw_keys;
}
static int
null_key_delete(struct ieee80211com *ic, const struct ieee80211_key *k)
OpenPOWER on IntegriCloud