On Mon, Jun 29, 2020 at 12:09:12PM +0000, Kapfhammer, Stefan wrote:
> Hi,
> 
> I am using exactly the same WLE-200NX wifi card in an APU2B4. I have a 
> BlackBerry KeyONE
> running at Android 8.1 / Version ABT975 which I use as hotspot for the APU2.
> 
> After setting athn0 down, it is impossible to establish the connection - 
> without further intervention -
> a second time.
> 
> What helps is:
> 
> First:
> #/bin/sh
> /sbin/ifconfig athn0
> /sbin/ifconfig athn0 down -inet -inet6 -join bbk1 -wpakey -chan -bssid
> /sbin/ifconfig athn0
> 
> Second:
> Disabling the hotspot on bbk1 and re-enabling it
> 
> Third:
> sh -x /etc/netstart athn0
> 
> This prevents to do a coldboot on the APU2 - reducing downtime.
> AND: It works reliably everytime since month!
> 

In case you missed it, a fix was proposed on the bugs@ list on Friday:
https://marc.info/?l=openbsd-bugs&m=159380123409160&w=2
The same patch is copied below.

If anyone else could confirm that this makes athn(4) work again as
a client against a WPA2 AP then I will commit this.

diff refs/heads/master refs/heads/athn-ccmpfix
blob - 3a28d87bc88a0e7b9ed6c873bd7a07682cc91a0b
blob + 1d739529d7d214bea314e50e847594dc01021a41
--- sys/dev/ic/ar5008.c
+++ sys/dev/ic/ar5008.c
@@ -811,12 +811,20 @@ ar5008_ccmp_decap(struct athn_softc *sc, struct mbuf *
        /* Sanity checks to ensure this is really a key we installed. */
        entry = (uintptr_t)k->k_priv;
        if (k->k_flags & IEEE80211_KEY_GROUP) {
-               if (k->k_id > IEEE80211_WEP_NKID ||
+               if (k->k_id >= IEEE80211_WEP_NKID ||
                    entry != k->k_id)
                        return 1;
-       } else if (entry != IEEE80211_WEP_NKID +
-           IEEE80211_AID(ni->ni_associd))
-               return 1;
+       } else {
+#ifndef IEEE80211_STA_ONLY
+               if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
+                       if (entry != IEEE80211_WEP_NKID +
+                           IEEE80211_AID(ni->ni_associd))
+                               return 1;
+               } else
+#endif
+                       if (entry != IEEE80211_WEP_NKID)
+                               return 1;
+       }
 
        /* Check that ExtIV bit is set. */
        if (!(ivp[3] & IEEE80211_WEP_EXTIV))
blob - 40725b02c43b54e10a87de333acdfd3b8270534d
blob + f7aa77ba15cae787a42fdbffb8a9d9cd2d0226d2
--- sys/dev/ic/athn.c
+++ sys/dev/ic/athn.c
@@ -1037,12 +1037,17 @@ athn_set_key(struct ieee80211com *ic, struct ieee80211
        }
 
        if (!(k->k_flags & IEEE80211_KEY_GROUP)) {
-               entry = IEEE80211_WEP_NKID + IEEE80211_AID(ni->ni_associd);
+#ifndef IEEE80211_STA_ONLY
+               if (ic->ic_opmode == IEEE80211_M_HOSTAP)
+                       entry = IEEE80211_WEP_NKID + 
IEEE80211_AID(ni->ni_associd);
+               else
+#endif
+                       entry = IEEE80211_WEP_NKID;
                if (entry >= sc->kc_entries - IEEE80211_WEP_NKID)
                        return ENOSPC;
        } else {
                entry = k->k_id;
-               if (entry > IEEE80211_WEP_NKID)
+               if (entry >= IEEE80211_WEP_NKID)
                        return ENOSPC;
        }
        k->k_priv = (void *)entry;
@@ -3056,10 +3061,6 @@ athn_init(struct ifnet *ifp)
        else
                athn_config_pcie(sc);
 
-       /* Reset HW key cache entries. */
-       for (i = 0; i < sc->kc_entries; i++)
-               athn_reset_key(sc, i);
-
        ops->enable_antenna_diversity(sc);
 
 #ifdef ATHN_BT_COEXISTENCE
@@ -3086,6 +3087,10 @@ athn_init(struct ifnet *ifp)
        /* Enable Rx. */
        athn_rx_start(sc);
 
+       /* Reset HW key cache entries. */
+       for (i = 0; i < sc->kc_entries; i++)
+               athn_reset_key(sc, i);
+
        /* Enable interrupts. */
        athn_enable_interrupts(sc);
 
@@ -3121,7 +3126,7 @@ athn_stop(struct ifnet *ifp, int disable)
 {
        struct athn_softc *sc = ifp->if_softc;
        struct ieee80211com *ic = &sc->sc_ic;
-       int qid;
+       int qid, i;
 
        ifp->if_timer = sc->sc_tx_timer = 0;
        ifp->if_flags &= ~IFF_RUNNING;
@@ -3158,6 +3163,10 @@ athn_stop(struct ifnet *ifp, int disable)
        AR_WRITE_BARRIER(sc);
        athn_set_rxfilter(sc, 0);
        athn_stop_rx_dma(sc);
+
+       /* Reset HW key cache entries. */
+       for (i = 0; i < sc->kc_entries; i++)
+               athn_reset_key(sc, i);
 
        athn_reset(sc, 0);
        athn_init_pll(sc, NULL);

Reply via email to