From owner-freebsd-bugs@FreeBSD.ORG Tue Aug 14 11:00:22 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31F15106566C for ; Tue, 14 Aug 2012 11:00:22 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E5AA28FC18 for ; Tue, 14 Aug 2012 11:00:21 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q7EB0LI5017759 for ; Tue, 14 Aug 2012 11:00:21 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q7EB0Lt2017758; Tue, 14 Aug 2012 11:00:21 GMT (envelope-from gnats) Resent-Date: Tue, 14 Aug 2012 11:00:21 GMT Resent-Message-Id: <201208141100.q7EB0Lt2017758@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Daan Vreeken Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D9C5106566C for ; Tue, 14 Aug 2012 10:51:01 +0000 (UTC) (envelope-from administrator@Prakkezator.VEHosting.nl) Received: from Bliksem.VEHosting.nl (Bliksem6.VEHosting.nl [IPv6:2001:1af8:2100:b020::141]) by mx1.freebsd.org (Postfix) with ESMTP id A017E8FC0A for ; Tue, 14 Aug 2012 10:51:00 +0000 (UTC) Received: from vitsch.nl (localhost [127.0.0.1]) by Bliksem.VEHosting.nl (8.13.8/8.13.8) with SMTP id q7EAowaR075132; Tue, 14 Aug 2012 12:50:58 +0200 (CEST) (envelope-from administrator@Prakkezator.VEHosting.nl) Received: from Prakkezator.VEHosting.nl (localhost [127.0.0.1]) by Prakkezator.VEHosting.nl (8.14.2/8.14.2) with ESMTP id q7EAn4Xt000911; Tue, 14 Aug 2012 12:49:04 +0200 (CEST) (envelope-from administrator@Prakkezator.VEHosting.nl) Received: (from root@localhost) by Prakkezator.VEHosting.nl (8.14.2/8.14.2/Submit) id q7EAn4aH000910; Tue, 14 Aug 2012 12:49:04 +0200 (CEST) (envelope-from administrator) Message-Id: <201208141049.q7EAn4aH000910@Prakkezator.VEHosting.nl> Date: Tue, 14 Aug 2012 12:49:04 +0200 (CEST) From: Daan Vreeken To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Daan Vreeken Subject: bin/170631: [PATCH] Add roaming support to wpa_supplicant X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daan Vreeken List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Aug 2012 11:00:22 -0000 >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 #include -#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: