wpa_supplicant signal quality vs level

David Horn dhorn2000 at gmail.com
Thu Sep 24 19:10:23 UTC 2009


I have noticed that 'wpa_cli scan_results' always reported a signal
level of 0 for every bssid found during a scan.  I found this a bit
odd (especially since ifconfig wlan0 list scan reported good signal
level data)

FreeBSD 8.0-RC1 r197417 amd64

Looking at the /usr/src/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
source, I found:

in wpa_driver_bsd_get_scan_results()

wsr->qual = sr->isr_rssi;
wsr->level = 0;       /* XXX? */

This hardcodes the signal level to 0, and sets the signal quality to
the rssi value.

Looking around at the source, it seems that wpa_supplicant does not
ever use the quality variable, but instead looks at the level variable
in wpa_scan_result_compar ().

In an attempt to try to figure out what signal level vs signal quality
in wpa_supplicant context means, I found this:
http://lists.shmoo.com/pipermail/hostap/2006-December/014831.html, and
a feb-2009 change to scan_helpers.c (which drivers_freebsd.c seems to
be partially based upon)
http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=e1b525c3560614cc56c85b7d060f540900c4da34

So, it seems that some wpa_supplicant drivers use quality, and some
use level.  Since quality(wsr->qual) does not seem to be used in
current wpa_supplicant in freebsd, should it instead look like ?:
(attached as an SVN diff with some debug as well)

                wsr->ssid_len = sr->isr_ssid_len;
                wsr->freq = sr->isr_freq;
                wsr->noise = sr->isr_noise;
-               wsr->qual = sr->isr_rssi;
-               wsr->level = 0;         /* XXX? */
+               wsr->qual = 0;  /* XXX? */
+               wsr->level = sr->isr_rssi;
                wsr->caps = sr->isr_capinfo;
                wsr->maxrate = getmaxrate(sr->isr_rates, sr->isr_nrates);
                vp = ((u_int8_t *)sr) + sr->isr_ie_off;


Should we just set qual to 0,  or should we set qual to
rssi/rssi_max*100 (if we can determine rssi_max for a particular wlan
interface)

In any case, do you want me to file a PR on this ?

--Thanks!

---Dave H
-------------- next part --------------
Index: driver_freebsd.c
===================================================================
--- driver_freebsd.c	(revision 197439)
+++ driver_freebsd.c	(working copy)
@@ -641,6 +641,8 @@
 	/* use freq for channel preference */
 
 	/* all things being equal, use signal level */
+	wpa_printf(MSG_DEBUG, "%s: signal levels; %d:#1(wa)  %d:#2(wb)",
+	           __func__, wa->level, wb->level);
 	return wb->level - wa->level;
 }
 
@@ -697,8 +699,8 @@
 		wsr->ssid_len = sr->isr_ssid_len;
 		wsr->freq = sr->isr_freq;
 		wsr->noise = sr->isr_noise;
-		wsr->qual = sr->isr_rssi;
-		wsr->level = 0;		/* XXX? */
+		wsr->qual = 0;  /* XXX? */
+		wsr->level = sr->isr_rssi;	
 		wsr->caps = sr->isr_capinfo;
 		wsr->maxrate = getmaxrate(sr->isr_rates, sr->isr_nrates);
 		vp = ((u_int8_t *)sr) + sr->isr_ie_off;


More information about the freebsd-net mailing list