From: stsp Date: Mon, 11 Oct 2021 09:02:01 +0000 (+0000) Subject: Monitor 20/40 MHz channel width changes in beacons sent by our access point X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=88290e74196d2755c0e925f35e38f670ccb172b7;p=openbsd Monitor 20/40 MHz channel width changes in beacons sent by our access point and notify drivers when the channel width has changed. --- 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 @@ -1857,6 +1857,27 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m, if (updateprot && ic->ic_updateprot != NULL) 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 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;