Make net80211 drop beacons received on secondary HT/VHT channels.
authorstsp <stsp@openbsd.org>
Sat, 7 Jan 2023 11:09:16 +0000 (11:09 +0000)
committerstsp <stsp@openbsd.org>
Sat, 7 Jan 2023 11:09:16 +0000 (11:09 +0000)
Prevents iwm firmware panics and makes association work with 11ac APs
which transmit beacons on channels other than their primary channel.
We would use the wrong channel in such cases, and iwm would request
a bogus channel configuration, which made the firmware unhappy.

Tested by myself on iwm 8265 and florian on iwm 9260.
This issue did likely affect iwx devices, too.

ok mpi@

sys/net80211/ieee80211_input.c

index 220fe94..523bcfb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ieee80211_input.c,v 1.248 2022/12/27 20:13:03 patrick Exp $   */
+/*     $OpenBSD: ieee80211_input.c,v 1.249 2023/01/07 11:09:16 stsp Exp $      */
 
 /*-
  * Copyright (c) 2001 Atsushi Onoe
@@ -1693,7 +1693,12 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m,
                        htcaps = frm;
                        break;
                case IEEE80211_ELEMID_HTOP:
+                       if (frm[1] < 22) {
+                               ic->ic_stats.is_rx_elem_toosmall++;
+                               break;
+                       }
                        htop = frm;
+                       chan = frm[2];
                        break;
                case IEEE80211_ELEMID_VHTCAPS:
                        vhtcaps = frm;