From patchwork Mon Nov 19 04:17:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Shade X-Patchwork-Id: 199921 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id E1CE62C008C for ; Mon, 19 Nov 2012 15:18:12 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 6380C9C0F0; Sun, 18 Nov 2012 23:18:08 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JtWJMMQT1boG; Sun, 18 Nov 2012 23:18:08 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 51E6A9C1B0; Sun, 18 Nov 2012 23:18:04 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id C5FAE9C1B0 for ; Sun, 18 Nov 2012 23:18:02 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uBqtyPGiQTWd for ; Sun, 18 Nov 2012 23:17:59 -0500 (EST) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 2A7979C1AE for ; Sun, 18 Nov 2012 23:17:59 -0500 (EST) Received: by mail-vc0-f172.google.com with SMTP id fw7so3024345vcb.17 for ; Sun, 18 Nov 2012 20:17:57 -0800 (PST) Received: by 10.52.100.230 with SMTP id fb6mr15467864vdb.91.1353298677839; Sun, 18 Nov 2012 20:17:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.58.241.198 with HTTP; Sun, 18 Nov 2012 20:17:37 -0800 (PST) From: Robert Shade Date: Sun, 18 Nov 2012 23:17:37 -0500 Message-ID: Subject: [PATCH] Verify that the selected BSS has a better signal level before roaming To: hostap@lists.shmoo.com X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com This prevents situations like the following where we roam to a lesser quality BSS just because the signal level delta is over our threshold. wlan0: Considering within-ESS reassociation wlan0: Current BSS: 00:24:6c:74:0a:40 level=-51 wlan0: Selected BSS: 00:24:6c:74:0a:e0 level=-64 wlan0: Request association: reassociate: 0 selected: 00:24:6c:74:0a:e0 bssid: 00:24:6c:74:0a:40 pending: 00:00:00:00:00:00 wpa_state: COMPLETED Signed-hostap: Robert Shade --- wpa_supplicant/events.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) if (current_bss->level < -85) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 42c4dea..a878735 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1025,6 +1025,11 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s, return 1; } + if ((current_bss->level < 0) && (current_bss->level > selected->level)) { + wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - Current BSS has better signal level"); + return 0; + } + min_diff = 2; if (current_bss->level < 0) {