From: stsp Date: Sun, 20 Mar 2022 11:59:39 +0000 (+0000) Subject: Don't announce VHT caps on 2GHz channels during iwm(4) and iwx(4) scans. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=702dc30212c1ab0de748666aa0fe684270268674;p=openbsd Don't announce VHT caps on 2GHz channels during iwm(4) and iwx(4) scans. 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@ --- diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index 5cca30fccf2..582a4c76874 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -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 @@ -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; diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c index 6c1c1647fbc..a000c692eba 100644 --- a/sys/dev/pci/if_iwx.c +++ b/sys/dev/pci/if_iwx.c @@ -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 @@ -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;