From 04982c3ba601ba54792dac7e237a9a48125b1171 Mon Sep 17 00:00:00 2001 From: stsp Date: Mon, 27 Jun 2022 09:16:56 +0000 Subject: [PATCH] Fix bwfm(4) ifconfig media display on devices with sta_info command version 3. ok jsg@ --- sys/dev/ic/bwfm.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index 0c9c948115a..508885a845a 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.103 2022/04/21 21:03:02 stsp Exp $ */ +/* $OpenBSD: bwfm.c,v 1.104 2022/06/27 09:16:56 stsp Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt @@ -703,22 +703,24 @@ bwfm_update_node(void *arg, struct ieee80211_node *ni) if (!IEEE80211_ADDR_EQ(ni->ni_macaddr, sta.ea)) return; - if (le16toh(sta.ver) < 4) + if (le16toh(sta.ver) < 3) return; flags = le32toh(sta.flags); if ((flags & BWFM_STA_SCBSTATS) == 0) return; - rssi = 0; - for (i = 0; i < BWFM_ANT_MAX; i++) { - if (sta.rssi[i] >= 0) - continue; - if (rssi == 0 || sta.rssi[i] > rssi) - rssi = sta.rssi[i]; + if (le16toh(sta.ver) >= 4) { + rssi = 0; + for (i = 0; i < BWFM_ANT_MAX; i++) { + if (sta.rssi[i] >= 0) + continue; + if (rssi == 0 || sta.rssi[i] > rssi) + rssi = sta.rssi[i]; + } + if (rssi) + ni->ni_rssi = rssi; } - if (rssi) - ni->ni_rssi = rssi; txrate = le32toh(sta.tx_rate); /* in kbit/s */ if (txrate == 0xffffffff) /* Seen this happening during association. */ -- 2.20.1