From owner-svn-src-stable-8@FreeBSD.ORG Fri Feb 26 18:46:17 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ADF3106566C; Fri, 26 Feb 2010 18:46:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 193CB8FC1C; Fri, 26 Feb 2010 18:46:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1QIkGgc022402; Fri, 26 Feb 2010 18:46:16 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1QIkGDl022399; Fri, 26 Feb 2010 18:46:16 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201002261846.o1QIkGDl022399@svn.freebsd.org> From: Rui Paulo Date: Fri, 26 Feb 2010 18:46:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204364 - stable/8/sys/dev/ath X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2010 18:46:17 -0000 Author: rpaulo Date: Fri Feb 26 18:46:16 2010 New Revision: 204364 URL: http://svn.freebsd.org/changeset/base/204364 Log: MFC r203683: Add multicast key search support. This fixes corrupted mcast packets when we have more than one hostap vap. Modified: stable/8/sys/dev/ath/if_ath.c stable/8/sys/dev/ath/if_athvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/dev/ath/if_ath.c ============================================================================== --- stable/8/sys/dev/ath/if_ath.c Fri Feb 26 18:18:02 2010 (r204363) +++ stable/8/sys/dev/ath/if_ath.c Fri Feb 26 18:46:16 2010 (r204364) @@ -621,6 +621,13 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_wmetkipmic = 1; } sc->sc_hasclrkey = ath_hal_ciphersupported(ah, HAL_CIPHER_CLR); + /* + * Check for multicast key sarch support. + */ + if (ath_hal_hasmcastkeysearch(sc->sc_ah) && + !ath_hal_getmcastkeysearch(sc->sc_ah)) { + ath_hal_setmcastkeysearch(sc->sc_ah, 1); + } sc->sc_mcastkey = ath_hal_getmcastkeysearch(ah); /* * Mark key cache slots associated with global keys @@ -2039,7 +2046,7 @@ ath_keyset(struct ath_softc *sc, const s if ((k->wk_flags & IEEE80211_KEY_GROUP) && sc->sc_mcastkey) { /* * Group keys on hardware that supports multicast frame - * key search use a mac that is the sender's address with + * key search use a MAC that is the sender's address with * the high bit set instead of the app-specified address. */ IEEE80211_ADDR_COPY(gmac, bss->ni_macaddr); @@ -2219,8 +2226,10 @@ ath_key_alloc(struct ieee80211vap *vap, * it permits us to support multiple users for adhoc and/or * multi-station operation. */ - if (k->wk_keyix != IEEE80211_KEYIX_NONE || /* global key */ - ((k->wk_flags & IEEE80211_KEY_GROUP) && !sc->sc_mcastkey)) { + if (k->wk_keyix != IEEE80211_KEYIX_NONE) { + /* + * Only global keys should have key index assigned. + */ if (!(&vap->iv_nw_keys[0] <= k && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) { /* should not happen */ @@ -2228,12 +2237,22 @@ ath_key_alloc(struct ieee80211vap *vap, "%s: bogus group key\n", __func__); return 0; } + */ + if (vap->iv_opmode != IEEE80211_M_HOSTAP || + !(k->wk_flags & IEEE80211_KEY_GROUP) || + !sc->sc_mcastkey) { + /* + * XXX we pre-allocate the global keys so + * have no way to check if they've already + * been allocated. + */ + *keyix = *rxkeyix = k - vap->iv_nw_keys; + return 1; + } /* - * XXX we pre-allocate the global keys so - * have no way to check if they've already been allocated. + * Group key and device supports multicast key search. */ - *keyix = *rxkeyix = k - vap->iv_nw_keys; - return 1; + k->wk_keyix = IEEE80211_KEYIX_NONE; } /* @@ -6945,6 +6964,8 @@ ath_announce(struct ath_softc *sc) if_printf(ifp, "using %u rx buffers\n", ath_rxbuf); if (ath_txbuf != ATH_TXBUF) if_printf(ifp, "using %u tx buffers\n", ath_txbuf); + if (sc->sc_mcastkey && bootverbose) + if_printf(ifp, "using multicast key search\n"); } #ifdef IEEE80211_SUPPORT_TDMA Modified: stable/8/sys/dev/ath/if_athvar.h ============================================================================== --- stable/8/sys/dev/ath/if_athvar.h Fri Feb 26 18:18:02 2010 (r204363) +++ stable/8/sys/dev/ath/if_athvar.h Fri Feb 26 18:46:16 2010 (r204364) @@ -580,14 +580,12 @@ void ath_intr(void *); ath_hal_setcapability(_ah, HAL_CAP_TPC, 1, _v, NULL) #define ath_hal_hasbursting(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_BURST, 0, NULL) == HAL_OK) -#ifdef notyet +#define ath_hal_setmcastkeysearch(_ah, _v) \ + ath_hal_setcapability(_ah, HAL_CAP_MCAST_KEYSRCH, 0, _v, NULL) #define ath_hal_hasmcastkeysearch(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_MCAST_KEYSRCH, 0, NULL) == HAL_OK) #define ath_hal_getmcastkeysearch(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_MCAST_KEYSRCH, 1, NULL) == HAL_OK) -#else -#define ath_hal_getmcastkeysearch(_ah) 0 -#endif #define ath_hal_hasfastframes(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK) #define ath_hal_hasbssidmask(_ah) \