Don't announce VHT caps on 2GHz channels during iwm(4) and iwx(4) scans.
authorstsp <stsp@openbsd.org>
Sun, 20 Mar 2022 11:59:39 +0000 (11:59 +0000)
committerstsp <stsp@openbsd.org>
Sun, 20 Mar 2022 11:59:39 +0000 (11:59 +0000)
VHT capabilities were written into the "common" secion of the firmware
probe request frame template. This section is used on 2GHz and 5GHz bands.
Announcing VHT capabilities on 2GHz makes no sense.
Move them into the 5GHz-only section.

ok sthen@

sys/dev/pci/if_iwm.c
sys/dev/pci/if_iwx.c

index 5cca30f..582a4c7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_iwm.c,v 1.397 2022/03/19 15:19:51 stsp Exp $       */
+/*     $OpenBSD: if_iwm.c,v 1.398 2022/03/20 11:59:39 stsp Exp $       */
 
 /*
  * Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -7661,6 +7661,12 @@ iwm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq)
                        frm = ieee80211_add_xrates(frm, rs);
                preq->band_data[1].len = htole16(frm - pos);
                remain -= frm - pos;
+               if (ic->ic_flags & IEEE80211_F_VHTON) {
+                       if (remain < 14)
+                               return ENOBUFS;
+                       frm = ieee80211_add_vhtcaps(frm, ic);
+                       remain -= frm - pos;
+               }
        }
 
        /* Send 11n IEs on both 2GHz and 5GHz bands. */
@@ -7674,12 +7680,6 @@ iwm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq)
                remain -= frm - pos;
        }
 
-       if (ic->ic_flags & IEEE80211_F_VHTON) {
-               if (remain < 14)
-                       return ENOBUFS;
-               frm = ieee80211_add_vhtcaps(frm, ic);
-       }
-
        preq->common_data.len = htole16(frm - pos);
 
        return 0;
index 6c1c164..a000c69 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_iwx.c,v 1.138 2022/03/19 14:50:01 stsp Exp $       */
+/*     $OpenBSD: if_iwx.c,v 1.139 2022/03/20 11:59:39 stsp Exp $       */
 
 /*
  * Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -6200,6 +6200,12 @@ iwx_fill_probe_req(struct iwx_softc *sc, struct iwx_scan_probe_req *preq)
                        frm = ieee80211_add_xrates(frm, rs);
                preq->band_data[1].len = htole16(frm - pos);
                remain -= frm - pos;
+               if (ic->ic_flags & IEEE80211_F_VHTON) {
+                       if (remain < 14)
+                               return ENOBUFS;
+                       frm = ieee80211_add_vhtcaps(frm, ic);
+                       remain -= frm - pos;
+               }
        }
 
        /* Send 11n IEs on both 2GHz and 5GHz bands. */
@@ -6213,12 +6219,6 @@ iwx_fill_probe_req(struct iwx_softc *sc, struct iwx_scan_probe_req *preq)
                remain -= frm - pos;
        }
 
-       if (ic->ic_flags & IEEE80211_F_VHTON) {
-               if (remain < 14)
-                       return ENOBUFS;
-               frm = ieee80211_add_vhtcaps(frm, ic);
-       }
-
        preq->common_data.len = htole16(frm - pos);
 
        return 0;