Patchwork Supply the connection scan results to bgscan after init

login
register
mail settings
Submitter Yoni Divinsky
Date July 10, 2012, 2:36 p.m.
Message ID <1341930983-6957-1-git-send-email-yoni.divinsky@ti.com>
Download mbox | patch
Permalink /patch/170199/
State Accepted
Commit 6409b7a715e9c5b91cac917992c9bb79599ecfff
Headers show

Comments

Yoni Divinsky - July 10, 2012, 2:36 p.m.
If bgscan is enabled, then bgscan is initiated after the
connection, with no bss scan result information.
Since a scan was performed prior to the connection, the
information exists and can be used to initialize the
bgscan's cache.

Signed-hostap: Yoni Divinsky <yoni.divinsky@ti.com>
---
 wpa_supplicant/wpa_supplicant.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
Jouni Malinen - Aug. 17, 2012, 5:55 p.m.
On Tue, Jul 10, 2012 at 05:36:23PM +0300, Yoni Divinsky wrote:
> If bgscan is enabled, then bgscan is initiated after the
> connection, with no bss scan result information.
> Since a scan was performed prior to the connection, the
> information exists and can be used to initialize the
> bgscan's cache.

Thanks, applied (though, with a pretty large memory leak fixed by
calling wpa_scan_results_free()).

Patch

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index c65dc3c..44090fe 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -554,8 +554,13 @@  static void wpa_supplicant_start_bgscan(struct wpa_supplicant *wpa_s)
 			 * optimization, so the initial connection is not
 			 * affected.
 			 */
-		} else
+		} else {
+			struct wpa_scan_results *scan_res =
+					wpa_supplicant_get_scan_results(wpa_s, NULL, 0);
 			wpa_s->bgscan_ssid = wpa_s->current_ssid;
+			if (scan_res)
+				bgscan_notify_scan(wpa_s, scan_res);
+		}
 	} else
 		wpa_s->bgscan_ssid = NULL;
 }