Author: adrian
Date: Tue Nov  8 19:25:52 2011
New Revision: 227357
URL: http://svn.freebsd.org/changeset/base/227357

Log:
  Add a 'vap' to ath_keyset().
  
  Add some code (which is currently disabled) which modifies the group
  multicast key cache behaviour. I haven't yet figured out what the
  exact/correct behaviour is so I'm leaving it disabled. It's worth
  investigating and "correcting", especially for future work with
  mesh/ibss and encryption.
  
  Sponsored by: Hobnob, Inc.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_keycache.c
  head/sys/dev/ath/if_ath_keycache.h

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c   Tue Nov  8 19:18:34 2011        (r227356)
+++ head/sys/dev/ath/if_ath.c   Tue Nov  8 19:25:52 2011        (r227357)
@@ -5165,7 +5165,7 @@ ath_setup_stationkey(struct ieee80211_no
                ni->ni_ucastkey.wk_flags |= IEEE80211_KEY_DEVKEY;
                IEEE80211_ADDR_COPY(ni->ni_ucastkey.wk_macaddr, ni->ni_macaddr);
                /* NB: this will create a pass-thru key entry */
-               ath_keyset(sc, &ni->ni_ucastkey, vap->iv_bss);
+               ath_keyset(sc, vap, &ni->ni_ucastkey, vap->iv_bss);
        }
 }
 

Modified: head/sys/dev/ath/if_ath_keycache.c
==============================================================================
--- head/sys/dev/ath/if_ath_keycache.c  Tue Nov  8 19:18:34 2011        
(r227356)
+++ head/sys/dev/ath/if_ath_keycache.c  Tue Nov  8 19:25:52 2011        
(r227357)
@@ -178,7 +178,8 @@ ath_keyset_tkip(struct ath_softc *sc, co
  * cache slots for TKIP with hardware MIC support.
  */
 int
-ath_keyset(struct ath_softc *sc, const struct ieee80211_key *k,
+ath_keyset(struct ath_softc *sc, struct ieee80211vap *vap,
+       const struct ieee80211_key *k,
        struct ieee80211_node *bss)
 {
 #define        N(a)    (sizeof(a)/sizeof(a[0]))
@@ -212,7 +213,23 @@ ath_keyset(struct ath_softc *sc, const s
        } else
                hk.kv_type = HAL_CIPHER_CLR;
 
-       if ((k->wk_flags & IEEE80211_KEY_GROUP) && sc->sc_mcastkey) {
+       /*
+        * XXX TODO: check this:
+        * 
+        * Group keys on hardware that supports multicast frame
+        * key search should only be done in adhoc/hostap mode,
+        * not STA mode.
+        *
+        * XXX TODO: what about mesh, tdma?
+        */
+#if 0
+       if ((vap->iv_opmode == IEEE80211_M_HOSTAP ||
+            vap->iv_opmode == IEEE80211_M_IBSS) &&
+#else
+       if (
+#endif
+           (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
@@ -493,5 +510,5 @@ ath_key_set(struct ieee80211vap *vap, co
 {
        struct ath_softc *sc = vap->iv_ic->ic_ifp->if_softc;
 
-       return ath_keyset(sc, k, vap->iv_bss);
+       return ath_keyset(sc, vap, k, vap->iv_bss);
 }

Modified: head/sys/dev/ath/if_ath_keycache.h
==============================================================================
--- head/sys/dev/ath/if_ath_keycache.h  Tue Nov  8 19:18:34 2011        
(r227356)
+++ head/sys/dev/ath/if_ath_keycache.h  Tue Nov  8 19:25:52 2011        
(r227357)
@@ -37,7 +37,7 @@ extern int ath_key_alloc(struct ieee8021
 extern int ath_key_delete(struct ieee80211vap *, const struct ieee80211_key *);
 extern int ath_key_set(struct ieee80211vap *, const struct ieee80211_key *,
     const u_int8_t mac[IEEE80211_ADDR_LEN]);
-extern int ath_keyset(struct ath_softc *sc, const struct ieee80211_key *k,
-    struct ieee80211_node *bss);
+extern int ath_keyset(struct ath_softc *sc, struct ieee80211vap *vap,
+    const struct ieee80211_key *k, struct ieee80211_node *bss);
 
 #endif
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to