From patchwork Mon Aug 18 18:04:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 381090 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 ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 916F0140114 for ; Tue, 19 Aug 2014 04:07:02 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2CF5B9D1F3; Mon, 18 Aug 2014 14:06:58 -0400 (EDT) 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 b5s+y7rFpcKV; Mon, 18 Aug 2014 14:06:57 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9E45617C059; Mon, 18 Aug 2014 14:06:37 -0400 (EDT) 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 C0DF717C056 for ; Mon, 18 Aug 2014 14:06:34 -0400 (EDT) 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 j0stPGLnN2sb for ; Mon, 18 Aug 2014 14:06:27 -0400 (EDT) Received: from mail-lb0-f202.google.com (mail-lb0-f202.google.com [209.85.217.202]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 641BC17C04C for ; Mon, 18 Aug 2014 14:06:27 -0400 (EDT) Received: by mail-lb0-f202.google.com with SMTP id v6so473197lbi.3 for ; Mon, 18 Aug 2014 11:06:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:subject:to:message-id; bh=8P875J/EYv4p8YH46aYXzwYS1nA39652Atx9L2OyY9Y=; b=KpvvLjhvMDrlS/zlxlHn4vsfotOexOE3FljHZQkkQ+Y+KPVbcCr4cu97tHZ11az2RN 8ClVv4UD6GZwB9lzBe8XOIkZRkZU4fB97eheGsebbTOWfvpXEDdRo9b/gnPaf2yrXjcH DfzGuh3PsMMQOjBu+sGWu753+gjC0a3NDGczw1c7SSCxcYs+e0QGDIbwWYYGeh4JdZ0v NG83H3/6mZ13d9Yo546/Fpzm8mj5EMp3c3Ku3d8webxZeWyLIahO7iJ2TF2Ei+K/CeCz LncuKwGhmtmtBtxDkWzC9ECw1KSQLNNn4o0T5VzlYCVjWQhWzmMsIr06suxxLC8brxrQ fMSg== X-Gm-Message-State: ALoCoQlaL0jGGDOZHhQubYYmRxZjtQtXx4GVk+fKFYQQy6+Xps1y3RPPexRdPewKt+gYtsRWYJ8MucrOwNEOQxHy9LCx3wPwRdp9ZT1AUioCq/SPWUdMZIwECfpSl5J+aPw8lsGQQuzT X-Received: by 10.112.170.166 with SMTP id an6mr102724lbc.17.1408385185516; Mon, 18 Aug 2014 11:06:25 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id d9si658023wie.3.2014.08.18.11.06.25 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Aug 2014 11:06:25 -0700 (PDT) Received: from ushik.mtv.corp.google.com (ushik.mtv.corp.google.com [172.22.122.113]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 6ED5331C5EF for ; Mon, 18 Aug 2014 11:06:24 -0700 (PDT) Received: by ushik.mtv.corp.google.com (Postfix, from userid 57417) id C02C0141778; Mon, 18 Aug 2014 11:06:23 -0700 (PDT) From: Jouni Malinen Date: Mon, 18 Aug 2014 11:04:56 -0700 Subject: [PATCH] STA: update scan results for ap_scan = 1 case also To: hostap@lists.shmoo.com Message-Id: <20140818180623.C02C0141778@ushik.mtv.corp.google.com> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Change-Id: Ic5a4db271b38f310f567bf9f536a9d95f2a599e6 Signed-off-by: Dmitry Shmidt --- wpa_supplicant/events.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 2d0b827..c6df420 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -83,14 +83,33 @@ static struct wpa_bss * wpa_supplicant_get_new_bss( } +static void wpa_supplicant_update_current_bss(struct wpa_supplicant *wpa_s) +{ + struct wpa_bss *bss; + + bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); + if (!bss) { + wpa_supplicant_update_scan_results(wpa_s); + + /* Get the BSS from the new scan results */ + bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); + } + + if (bss) + wpa_s->current_bss = bss; +} + + static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s) { struct wpa_ssid *ssid, *old_ssid; struct wpa_bss *bss; int res; - if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) + if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) { + wpa_supplicant_update_current_bss(wpa_s); return 0; + } wpa_dbg(wpa_s, MSG_DEBUG, "Select network based on association " "information"); @@ -136,16 +155,7 @@ static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s) old_ssid = wpa_s->current_ssid; wpa_s->current_ssid = ssid; - bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); - if (!bss) { - wpa_supplicant_update_scan_results(wpa_s); - - /* Get the BSS from the new scan results */ - bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); - } - - if (bss) - wpa_s->current_bss = bss; + wpa_supplicant_update_current_bss(wpa_s); wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid); wpa_supplicant_initiate_eapol(wpa_s);