From owner-p4-projects@FreeBSD.ORG Mon May 26 22:33:55 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5FC0C1065672; Mon, 26 May 2008 22:33:55 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 099C4106566B for ; Mon, 26 May 2008 22:33:55 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E90E58FC1A for ; Mon, 26 May 2008 22:33:54 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m4QMXsgX003816 for ; Mon, 26 May 2008 22:33:54 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m4QMXsLK003814 for perforce@freebsd.org; Mon, 26 May 2008 22:33:54 GMT (envelope-from sam@freebsd.org) Date: Mon, 26 May 2008 22:33:54 GMT Message-Id: <200805262233.m4QMXsLK003814@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 142323 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 May 2008 22:33:55 -0000 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;