git: 69ffe3a6e778 - main - bsnmp: wlan: use correct value for rssi

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Thu, 31 Jul 2025 17:39:03 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=69ffe3a6e778c3400a27a1098969802ac4cb5f56

commit 69ffe3a6e778c3400a27a1098969802ac4cb5f56
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-06-19 00:01:07 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-07-31 17:37:54 +0000

    bsnmp: wlan: use correct value for rssi
    
    net80211 keeps the rssi value in 0.5bm relative to the noise floor
    (see comment in ieee80211_node.h).  Do proper maths to get a plain
    rssi value back (once further fixes are in net80211).
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D50930
---
 usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c
index b129e42b9d85..e80b53dcf44e 100644
--- a/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c
+++ b/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_sys.c
@@ -2167,7 +2167,7 @@ wlan_add_new_scan_result(struct wlan_iface *wif,
 		return (-1);
 
 	sr->opchannel = wlan_channel_flags_to_snmp_phy(isr->isr_flags);
-	sr->rssi = isr->isr_rssi;
+	sr->rssi = (isr->isr_rssi / 2) - isr->isr_noise;
 	sr->frequency = isr->isr_freq;
 	sr->noise = isr->isr_noise;
 	sr->bintval = isr->isr_intval;