From f06e4e2ba1cacafaf39a5edc287236455813625e Mon Sep 17 00:00:00 2001 From: kn Date: Sun, 18 Dec 2022 18:56:38 +0000 Subject: [PATCH] Unify RSSI check Two spots in ifconfig print the signal strength, one for the "ieee80211: " line and one for each SSID in scan output. Only the former checks nr_rssi, which is not needed as nr_max_rssi alone indicates whether the driver reports signal strength in percentage or dBm. Zap the nr_rssi check to simplify; "worst case" we display 0% or 0dBm instead of nothing. Feedback OK stsp --- sbin/ifconfig/ifconfig.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 1f699324839..06753159e76 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.459 2022/11/26 07:26:43 jmc Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.460 2022/12/18 18:56:38 kn Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -2522,13 +2522,10 @@ ieee80211_status(void) bcopy(bssid.i_bssid, &nr.nr_macaddr, sizeof(nr.nr_macaddr)); strlcpy(nr.nr_ifname, ifname, sizeof(nr.nr_ifname)); if (ioctl(sock, SIOCG80211NODE, &nr) == 0) { - if (nr.nr_rssi) { - if (nr.nr_max_rssi) - printf(" %u%%", - IEEE80211_NODEREQ_RSSI(&nr)); - else - printf(" %ddBm", nr.nr_rssi); - } + if (nr.nr_max_rssi) + printf(" %u%%", IEEE80211_NODEREQ_RSSI(&nr)); + else + printf(" %ddBm", nr.nr_rssi); assocfail = nr.nr_assoc_fail; } } -- 2.20.1