Patchwork supplicant: set state to DISCONNECTED on AP creation errors

login
register
mail settings
Submitter Dan Williams
Date Sept. 21, 2012, 4:53 p.m.
Message ID <1348246391.1338.3.camel@dcbw.foobar.com>
Download mbox | patch
Permalink /patch/185835/
State Accepted
Commit 8c981d179b71b1d91ea06af35e456ff53dfcdeff
Headers show

Comments

Dan Williams - Sept. 21, 2012, 4:53 p.m.
If the AP creation failed (missing freq= or driver error) the supplicant
would previously stay in SCANNING state forever.  Instead, it should
handle the error a bit better and drop back to DISCONNECTED so clients
know something went wrong.

Signed-hostap: Dan Williams <dcbw@redhat.com>
intended-for: hostap-2
intended-for: hostap-1
---
 wpa_supplicant/wpa_supplicant.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Jouni Malinen - Sept. 23, 2012, 10:57 a.m.
On Fri, Sep 21, 2012 at 11:53:11AM -0500, Dan Williams wrote:
> If the AP creation failed (missing freq= or driver error) the supplicant
> would previously stay in SCANNING state forever.  Instead, it should
> handle the error a bit better and drop back to DISCONNECTED so clients
> know something went wrong.

Thanks, applied.

Patch

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index c212ed2..a036f3e 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1246,7 +1246,10 @@  void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
 				"mode");
 			return;
 		}
-		wpa_supplicant_create_ap(wpa_s, ssid);
+		if (wpa_supplicant_create_ap(wpa_s, ssid) < 0) {
+			wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+			return;
+		}
 		wpa_s->current_bss = bss;
 #else /* CONFIG_AP */
 		wpa_msg(wpa_s, MSG_ERROR, "AP mode support not included in "