always provide a subset of STA info in the MAC context command
authorstsp <stsp@openbsd.org>
Mon, 6 Mar 2023 11:28:01 +0000 (11:28 +0000)
committerstsp <stsp@openbsd.org>
Mon, 6 Mar 2023 11:28:01 +0000 (11:28 +0000)
We used to provide beacon-related information only once our station was
associated. New firmware wants to see this information earlier, when are
about to send an AUTH frame. Otherwise SYSASSERT 0x2000011A is raised.

Problem diagnosed with help from Johannes Berg, thanks!

sys/dev/pci/if_iwx.c

index 47a93cf..43d9bd7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_iwx.c,v 1.164 2023/03/06 11:21:24 stsp Exp $       */
+/*     $OpenBSD: if_iwx.c,v 1.165 2023/03/06 11:28:01 stsp Exp $       */
 
 /*
  * Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -7436,14 +7436,16 @@ iwx_mac_ctxt_cmd_fill_sta(struct iwx_softc *sc, struct iwx_node *in,
        tsf = letoh64(tsf);
 
        sta->is_assoc = htole32(assoc);
-       sta->dtim_time = htole32(ni->ni_rstamp + dtim_off);
-       sta->dtim_tsf = htole64(tsf + dtim_off);
+       if (assoc) {
+               sta->dtim_time = htole32(ni->ni_rstamp + dtim_off);
+               sta->dtim_tsf = htole64(tsf + dtim_off);
+               sta->assoc_beacon_arrive_time = htole32(ni->ni_rstamp);
+       }
        sta->bi = htole32(ni->ni_intval);
        sta->dtim_interval = htole32(ni->ni_intval * ni->ni_dtimperiod);
        sta->data_policy = htole32(0);
        sta->listen_interval = htole32(10);
        sta->assoc_id = htole32(ni->ni_associd);
-       sta->assoc_beacon_arrive_time = htole32(ni->ni_rstamp);
 }
 
 int
@@ -7476,15 +7478,14 @@ iwx_mac_ctxt_cmd(struct iwx_softc *sc, struct iwx_node *in, uint32_t action,
                    IWX_MAC_FILTER_IN_BEACON |
                    IWX_MAC_FILTER_IN_PROBE_REQUEST |
                    IWX_MAC_FILTER_IN_CRC32);
-       } else if (!assoc || !ni->ni_associd || !ni->ni_dtimperiod)
+       } else if (!assoc || !ni->ni_associd || !ni->ni_dtimperiod) {
                /* 
                 * Allow beacons to pass through as long as we are not
                 * associated or we do not have dtim period information.
                 */
                cmd.filter_flags |= htole32(IWX_MAC_FILTER_IN_BEACON);
-       else
-               iwx_mac_ctxt_cmd_fill_sta(sc, in, &cmd.sta, assoc);
-
+       }
+       iwx_mac_ctxt_cmd_fill_sta(sc, in, &cmd.sta, assoc);
        return iwx_send_cmd_pdu(sc, IWX_MAC_CONTEXT_CMD, 0, sizeof(cmd), &cmd);
 }