From 48f8e036221db5355889ddf407b4552e5d89d2f7 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Tue, 16 Aug 2011 11:52:06 -0700 Subject: [PATCH] Prevent ap_scan change during association Signed-off-by: Dmitry Shmidt --- wpa_supplicant/wpa_supplicant.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index a778f3aa0..91aeb2d79 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1712,6 +1712,16 @@ int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s, int ap_scan) if (ap_scan < 0 || ap_scan > 2) return -1; +#ifdef ANDROID + if (ap_scan == 2 && ap_scan != wpa_s->conf->ap_scan && + wpa_s->wpa_state >= WPA_ASSOCIATING && + wpa_s->wpa_state < WPA_COMPLETED) { + wpa_printf(MSG_ERROR, "ap_scan = %d (%d) rejected while " + "associating", wpa_s->conf->ap_scan, ap_scan); + return 0; + } +#endif /* ANDROID */ + old_ap_scan = wpa_s->conf->ap_scan; wpa_s->conf->ap_scan = ap_scan;