Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2012 12:49:04 +0200 (CEST)
From:      Daan Vreeken <Daan@vitsch.nl>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        Daan Vreeken <Daan@vitsch.nl>
Subject:   bin/170631: [PATCH] Add roaming support to wpa_supplicant
Message-ID:  <201208141049.q7EAn4aH000910@Prakkezator.VEHosting.nl>
Resent-Message-ID: <201208141100.q7EB0Lt2017758@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         170631
>Category:       bin
>Synopsis:       [PATCH] Add roaming support to wpa_supplicant
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 14 11:00:21 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Daan Vreeken
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
Vitsch Electronics - http://VitschVPN.nl/
>Environment:
System:
 FreeBSD Devel13.Vitsch.LAN 10.0-CURRENT FreeBSD 10.0-CURRENT #0: Sat Jan 28 21:31:14 CET 2012 root@Compile2:/usr/src/sys/amd64/compile/Multimedia amd64

	
>Description:
 The wpa_supplicant application has the ability to do roaming based on the
 received signal strength indication (RSSI), but currently this is broken in
 FreeBSD.
 At this moment wpa_supplicant will always report a level of 0dBm for all
 detected wireless networks.

	
>How-To-Repeat:
	
 Run wpa_supplicant with the '-d' option set and with a configuration file
 that allows it to connect to at least two Access Points that are in the
 vicinity of the receiver.
 Note that wpa_supplicant will always report a level of '0' for all networks.

>Fix:
 The wpa_supplicant's FreeBSD driver interface only sets 'result->qual' and
 'result->noise', but not 'result->level' in wpa_driver_bsd_add_scan_entry(),
 while the latter is used when sorting AP's based on their signal strength.

 The attached patch fixes this by calculating 'result->level' according to
 it's definition in net80211/ieee80211_node.h .
 The patch also fixes a spelling error in ieee80211_var.h .
 If the patch somehow gets mangled in the email, it can also be downloaded
 from:
	http://www.Vitsch.nl/pub_diffs/

 After applying the patch, wpa_supplicant will now successfully attempt to
 roam when background scanning is enabled and there is an AP with a higher
 signal strength.

 Sponsored by: Vitsch Electronics


--- patch_wpa_supplicant_rssi_fix_2012_08_14.diff begins here ---
Index: usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
===================================================================
--- usr.sbin/wpa/wpa_supplicant/driver_freebsd.c	(revision 238968)
+++ usr.sbin/wpa/wpa_supplicant/driver_freebsd.c	(working copy)
@@ -693,6 +693,11 @@
         result->caps = sr->isr_capinfo;
         result->qual = sr->isr_rssi;
         result->noise = sr->isr_noise;
+        /*
+         * the rssi value reported by the kernel is in 0.5dB steps relative to
+         * the reported noise floor. see ieee80211_node.h for details.
+         */
+        result->level = sr->isr_rssi / 2 + sr->isr_noise;
 
         pos = (u8 *)(result + 1);
 
Index: sys/net80211/ieee80211_var.h
===================================================================
--- sys/net80211/ieee80211_var.h	(revision 238968)
+++ sys/net80211/ieee80211_var.h	(working copy)
@@ -55,7 +55,7 @@
 #include <net80211/ieee80211_radiotap.h>
 #include <net80211/ieee80211_scan.h>
 
-#define	IEEE80211_TXPOWER_MAX	100	/* .5 dbM (XXX units?) */
+#define	IEEE80211_TXPOWER_MAX	100	/* .5 dBm (XXX units?) */
 #define	IEEE80211_TXPOWER_MIN	0	/* kill radio */
 
 #define	IEEE80211_DTIM_DEFAULT	1	/* default DTIM period */
--- patch_wpa_supplicant_rssi_fix_2012_08_14.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208141049.q7EAn4aH000910>