Date: Mon, 26 May 2008 22:33:54 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 142323 for review Message-ID: <200805262233.m4QMXsLK003814@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=142323 Change 142323 by sam@sam_ebb on 2008/05/26 22:33:17 Add a mac address to the key definition as otherwise we lose the address specified in the ioctl and for drivers that need the address to locate a key (e.g. for delete). Note this change net80211-private api's but not the driver callback; may want to change that also. Affected files ... .. //depot/projects/vap/sys/net80211/ieee80211_crypto.c#15 edit .. //depot/projects/vap/sys/net80211/ieee80211_crypto.h#14 edit .. //depot/projects/vap/sys/net80211/ieee80211_ioctl.c#59 edit Differences ... ==== //depot/projects/vap/sys/net80211/ieee80211_crypto.c#15 (text+ko) ==== @@ -130,10 +130,9 @@ } static __inline int -dev_key_set(struct ieee80211vap *vap, const struct ieee80211_key *key, - const uint8_t mac[IEEE80211_ADDR_LEN]) +dev_key_set(struct ieee80211vap *vap, const struct ieee80211_key *key) { - return vap->iv_key_set(vap, key, mac); + return vap->iv_key_set(vap, key, key->wk_macaddr); } /* @@ -480,8 +479,7 @@ * ieee80211_key_update_end(vap); */ int -ieee80211_crypto_setkey(struct ieee80211vap *vap, struct ieee80211_key *key, - const uint8_t macaddr[IEEE80211_ADDR_LEN]) +ieee80211_crypto_setkey(struct ieee80211vap *vap, struct ieee80211_key *key) { const struct ieee80211_cipher *cip = key->wk_cipher; @@ -490,7 +488,7 @@ IEEE80211_DPRINTF(vap, IEEE80211_MSG_CRYPTO, "%s: %s keyix %u flags 0x%x mac %s rsc %ju tsc %ju len %u\n", __func__, cip->ic_name, key->wk_keyix, - key->wk_flags, ether_sprintf(macaddr), + key->wk_flags, ether_sprintf(key->wk_macaddr), key->wk_keyrsc[IEEE80211_NONQOS_TID], key->wk_keytsc, key->wk_keylen); @@ -513,7 +511,7 @@ vap->iv_stats.is_crypto_setkey_nokey++; return 0; } - return dev_key_set(vap, key, macaddr); + return dev_key_set(vap, key); } /* ==== //depot/projects/vap/sys/net80211/ieee80211_crypto.h#14 (text+ko) ==== @@ -90,6 +90,7 @@ uint64_t wk_keytsc; /* key transmit sequence counter */ const struct ieee80211_cipher *wk_cipher; void *wk_private; /* private cipher state */ + uint8_t wk_macaddr[IEEE80211_ADDR_LEN]; }; #define IEEE80211_KEY_COMMON /* common flags passed in by apps */\ (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV | IEEE80211_KEY_GROUP) @@ -138,9 +139,7 @@ int cipher, int flags, struct ieee80211_key *); int ieee80211_crypto_delkey(struct ieee80211vap *, struct ieee80211_key *); -int ieee80211_crypto_setkey(struct ieee80211vap *, - struct ieee80211_key *, - const uint8_t macaddr[IEEE80211_ADDR_LEN]); +int ieee80211_crypto_setkey(struct ieee80211vap *, struct ieee80211_key *); void ieee80211_crypto_delglobalkeys(struct ieee80211vap *); /* ==== //depot/projects/vap/sys/net80211/ieee80211_ioctl.c#59 (text+ko) ==== @@ -1135,8 +1135,9 @@ wk->wk_keytsc = 0; /* new key, reset */ memset(wk->wk_key, 0, sizeof(wk->wk_key)); memcpy(wk->wk_key, ik.ik_keydata, ik.ik_keylen); - if (!ieee80211_crypto_setkey(vap, wk, - ni != NULL ? ni->ni_macaddr : ik.ik_macaddr)) + IEEE80211_ADDR_COPY(wk->wk_macaddr, + ni != NULL ? ni->ni_macaddr : ik.ik_macaddr); + if (!ieee80211_crypto_setkey(vap, wk)) error = EIO; else if ((ik.ik_flags & IEEE80211_KEY_DEFAULT)) vap->iv_def_txkey = kid; @@ -2502,7 +2503,8 @@ IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV, k)) { k->wk_keylen = ireq->i_len; memcpy(k->wk_key, tmpkey, sizeof(tmpkey)); - if (!ieee80211_crypto_setkey(vap, k, vap->iv_myaddr)) + IEEE80211_ADDR_COPY(k->wk_macaddr, vap->iv_myaddr); + if (!ieee80211_crypto_setkey(vap, k)) error = EINVAL; } else error = EINVAL;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805262233.m4QMXsLK003814>