[PATCH] driver_bsd: FreeBSD scan results lack the dBm flag, affecting BSS selection

Cy Schubert Cy.Schubert at cschubert.com
Thu Nov 26 11:25:24 PST 2026


One of our (FreeBSD) contributors submitted this patch to mark FreeBSD scan 
results in dBm.

>From 24d197d8e8c9e7710614a0266c034e1a3debe64c Mon Sep 17 00:00:00 2001
From: Sam Sheridan <sam at sheridan.co.uk>
Date: Thu, 26 Nov 2026 12:17:13 -0700
Subject: [PATCH] driver_bsd: FreeBSD scan results lack the dBm flag, 
affecting
 BSS selection

>From d6fd60e3f82a7ce7a02ac01b51370575677ab516 Mon Sep 17 00:00:00 2001
From: Sam Sheridan <sam at sheridan.co.uk>
Date: Thu, 26 Nov 2026 04:59:29 +0000
Subject: [PATCH] wpa_supplicant: Mark FreeBSD scan result levels as dBm

The FreeBSD driver wrapper converts net80211's half-dB RSSI relative
to the noise floor into an absolute signal level, but leaves
WPA_SCAN_LEVEL_DBM unset.

Without the flag, scan_snr() uses the raw level instead of subtracting
the noise floor. The scan comparator also uses uncapped raw levels
rather than its dB-based SNR calculation. This can favour a stronger
2.4 GHz BSS over a faster 5 GHz BSS.

Set the flag alongside the existing conversion in the __FreeBSD__
branch, as other driver wrappers do for levels reported in dBm.

Tested with base wpa_supplicant 2.11 on FreeBSD 15.1-RELEASE-p7,
using an Intel 8265 on a dual-band network. Three stock cold starts
selected 2.4 GHz; two starts with this change selected 5 GHz HT40.
---
 src/drivers/driver_bsd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index b4320e759..5e2b6fc4f 100644
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -1384,6 +1384,7 @@ wpa_driver_bsd_add_scan_entry(struct wpa_scan_results 
*res,
 	 * the reported noise floor. see ieee80211_node.h for details.
 	 */
 	result->level = sr->isr_rssi / 2 + sr->isr_noise;
+	result->flags |= WPA_SCAN_LEVEL_DBM;
 #else
 	result->level = sr->isr_rssi;
 #endif
-- 
2.56.1


-- 
Cheers,
Cy Schubert <Cy.Schubert at cschubert.com>
FreeBSD UNIX:  <cy at FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy at nwtime.org>    Web:  https://nwtime.org

			e**(i*pi)+1=0





More information about the Hostap mailing list