diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2021-10-11 09:02:02 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2021-10-11 09:02:02 +0000 |
commit | 5925e4e337b298ae022f5baa30be29a43b5a383a (patch) | |
tree | b93e3f32fc6f40b1f5ef10a143c1bcee9adf0b5c /sys/net80211 | |
parent | 5d9b43e594f851b429d1cff6ffe365a263817470 (diff) |
Monitor 20/40 MHz channel width changes in beacons sent by our access point
and notify drivers when the channel width has changed.
Diffstat (limited to 'sys/net80211')
-rw-r--r-- | sys/net80211/ieee80211_input.c | 23 | ||||
-rw-r--r-- | sys/net80211/ieee80211_var.h | 3 |
2 files changed, 24 insertions, 2 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 99699b933a0..888a39c43dd 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_input.c,v 1.238 2021/09/03 12:39:43 stsp Exp $ */ +/* $OpenBSD: ieee80211_input.c,v 1.239 2021/10/11 09:02:01 stsp Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe @@ -1858,6 +1858,27 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m, ic->ic_updateprot(ic); /* + * Check if 40MHz channel mode has changed since last beacon. + */ + if (htop && (ic->ic_bss->ni_flags & IEEE80211_NODE_HT) && + (ic->ic_htcaps & IEEE80211_HTCAP_CBW20_40)) { + uint8_t chw_last, chw, sco_last, sco; + chw_last = (ic->ic_bss->ni_htop0 & IEEE80211_HTOP0_CHW); + chw = (ni->ni_htop0 & IEEE80211_HTOP0_CHW); + sco_last = + ((ic->ic_bss->ni_htop0 & IEEE80211_HTOP0_SCO_MASK) + >> IEEE80211_HTOP0_SCO_SHIFT); + sco = ((ni->ni_htop0 & IEEE80211_HTOP0_SCO_MASK) >> + IEEE80211_HTOP0_SCO_SHIFT); + ic->ic_bss->ni_htop0 = ni->ni_htop0; + if (chw_last != chw || sco_last != sco) { + if (ic->ic_updatechan != NULL) + ic->ic_updatechan(ic); + } + } else if (htop) + ic->ic_bss->ni_htop0 = ni->ni_htop0; + + /* * Check if AP short slot time setting has changed * since last beacon and give the driver a chance to * update the hardware. diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index a1b9660670f..174da137a22 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.106 2021/10/11 09:01:06 stsp Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.107 2021/10/11 09:02:01 stsp Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -246,6 +246,7 @@ struct ieee80211com { void (*ic_ampdu_rx_stop)(struct ieee80211com *, struct ieee80211_node *, u_int8_t); void (*ic_updateprot)(struct ieee80211com *); + void (*ic_updatechan)(struct ieee80211com *); int (*ic_bgscan_start)(struct ieee80211com *); struct timeout ic_bgscan_timeout; uint32_t ic_bgscan_fail; |