summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2020-04-08 09:34:30 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2020-04-08 09:34:30 +0000
commit374082b2a678af124e756328078968c2a8f20f8e (patch)
treeaebe7f3c663cc266ce173527e3d363eb20973fe2
parentaa2f29d03f17b672a326e6ea9d3c9dac9c32dc7a (diff)
Fix ifconfig "media:" line for 11n wifi interfaces during and after bgscan.
Media was displayed as e.g. "autoselect (OFDM6)" even though 11n was active because the current media mode is changed to AUTO for background scanning and was never switched back to 11N. ok mpi@ pirofti@
-rw-r--r--sys/net80211/ieee80211.c8
-rw-r--r--sys/net80211/ieee80211_node.c17
2 files changed, 23 insertions, 2 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index 410c33358e7..1d9e875530e 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211.c,v 1.82 2019/12/27 09:46:13 stsp Exp $ */
+/* $OpenBSD: ieee80211.c,v 1.83 2020/04/08 09:34:29 stsp Exp $ */
/* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */
/*-
@@ -728,6 +728,12 @@ ieee80211_media_status(struct ifnet *ifp, struct ifmediareq *imr)
ic->ic_curmode == IEEE80211_MODE_11AC)
imr->ifm_active |= ieee80211_mcs2media(ic,
ni->ni_txmcs, ic->ic_curmode);
+ else if (ni->ni_flags & IEEE80211_NODE_VHT) /* in MODE_AUTO */
+ imr->ifm_active |= ieee80211_mcs2media(ic,
+ ni->ni_txmcs, IEEE80211_MODE_11AC);
+ else if (ni->ni_flags & IEEE80211_NODE_HT) /* in MODE_AUTO */
+ imr->ifm_active |= ieee80211_mcs2media(ic,
+ ni->ni_txmcs, IEEE80211_MODE_11N);
else
/* calculate rate subtype */
imr->ifm_active |= ieee80211_rate2media(ic,
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index 6656d29d160..f6349c70279 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_node.c,v 1.179 2020/01/15 09:34:27 phessler Exp $ */
+/* $OpenBSD: ieee80211_node.c,v 1.180 2020/04/08 09:34:29 stsp Exp $ */
/* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */
/*-
@@ -1441,6 +1441,21 @@ ieee80211_end_scan(struct ifnet *ifp)
ic->ic_bgscan_fail *= 2;
}
ic->ic_flags &= ~IEEE80211_F_BGSCAN;
+
+ /*
+ * HT is negotiated during association so we must use
+ * ic_bss to check HT. The nodes tree was re-populated
+ * during background scan and therefore selbs and curbs
+ * may not carry HT information.
+ */
+ ni = ic->ic_bss;
+ if (ni->ni_flags & IEEE80211_NODE_VHT)
+ ieee80211_setmode(ic, IEEE80211_MODE_11AC);
+ else if (ni->ni_flags & IEEE80211_NODE_HT)
+ ieee80211_setmode(ic, IEEE80211_MODE_11N);
+ else
+ ieee80211_setmode(ic,
+ ieee80211_chan2mode(ic, ni->ni_chan));
return;
}