Date: Tue, 27 May 2008 02:36:09 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 142341 for review Message-ID: <200805270236.m4R2a9xH026609@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=142341 Change 142341 by sam@sam_ebb on 2008/05/27 02:35:52 add ieee80211_crypto_reload_keys to push all keys known to net80211 back into the device; intended for use on resume by devices that lose the contents of their h/w key table Affected files ... .. //depot/projects/vap/sys/net80211/ieee80211_crypto.c#16 edit .. //depot/projects/vap/sys/net80211/ieee80211_crypto.h#15 edit Differences ... ==== //depot/projects/vap/sys/net80211/ieee80211_crypto.c#16 (text+ko) ==== @@ -609,3 +609,46 @@ #undef IEEE80211_WEP_MINLEN #undef IEEE80211_WEP_HDRLEN } + +static void +load_ucastkey(void *arg, struct ieee80211_node *ni) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211_key *k; + + if (vap->iv_state != IEEE80211_S_RUN) + return; + k = &ni->ni_ucastkey; + if (k->wk_keyix != IEEE80211_KEYIX_NONE) + dev_key_set(vap, k); +} + +/* + * Re-load all keys known to the 802.11 layer that may + * have hardware state backing them. This is used by + * drivers on resume to push keys down into the device. + */ +void +ieee80211_crypto_reload_keys(struct ieee80211com *ic) +{ + struct ieee80211vap *vap; + int i; + + /* + * Keys in the global key table of each vap. + */ + /* NB: used only during resume so don't lock for now */ + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { + if (vap->iv_state != IEEE80211_S_RUN) + continue; + for (i = 0; i < IEEE80211_WEP_NKID; i++) { + const struct ieee80211_key *k = &vap->iv_nw_keys[i]; + if (k->wk_keyix != IEEE80211_KEYIX_NONE) + dev_key_set(vap, k); + } + } + /* + * Unicast keys. + */ + ieee80211_iterate_nodes(&ic->ic_sta, load_ucastkey, NULL); +} ==== //depot/projects/vap/sys/net80211/ieee80211_crypto.h#15 (text+ko) ==== @@ -141,6 +141,7 @@ struct ieee80211_key *); int ieee80211_crypto_setkey(struct ieee80211vap *, struct ieee80211_key *); void ieee80211_crypto_delglobalkeys(struct ieee80211vap *); +void ieee80211_crypto_reload_keys(struct ieee80211com *); /* * Template for a supported cipher. Ciphers register with the
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805270236.m4R2a9xH026609>