diff mbox

[1/4] hostapd: Don't get stuck after failed ACS

Message ID 1381839010-30681-1-git-send-email-helmut.schaa@googlemail.com
State Accepted
Commit 0e1d0b370f6d1728386fec64ea02ce01bf715e18
Headers show

Commit Message

Helmut Schaa Oct. 15, 2013, 12:10 p.m. UTC
If ACS fails we still need to call hostapd_setup_interface_complete.
Otherwise hostapd will just hang doing nothing anymore. However, pass
an error to hostapd_setup_interface_complete to allow a graceful fail.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---
 src/ap/hw_features.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Helmut Schaa Oct. 15, 2013, 12:13 p.m. UTC | #1
On Tue, Oct 15, 2013 at 2:10 PM, Helmut Schaa
<helmut.schaa@googlemail.com> wrote:
> If ACS fails we still need to call hostapd_setup_interface_complete.
> Otherwise hostapd will just hang doing nothing anymore. However, pass
> an error to hostapd_setup_interface_complete to allow a graceful fail.
>
> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>

Jouni, mind to replace my Signed-off-by with:
Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>

Thanks!
Jouni Malinen Oct. 22, 2013, 9:49 p.m. UTC | #2
On Tue, Oct 15, 2013 at 02:13:22PM +0200, Helmut Schaa wrote:
> On Tue, Oct 15, 2013 at 2:10 PM, Helmut Schaa
> <helmut.schaa@googlemail.com> wrote:
> > If ACS fails we still need to call hostapd_setup_interface_complete.
> > Otherwise hostapd will just hang doing nothing anymore. However, pass
> > an error to hostapd_setup_interface_complete to allow a graceful fail.
> >
> > Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
> 
> Jouni, mind to replace my Signed-off-by with:
> Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>

Thanks, all four patches applied with that update.
diff mbox

Patch

diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 8a239f4..b74032e 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -720,7 +720,7 @@  static void hostapd_notify_bad_chans(struct hostapd_iface *iface)
 
 int hostapd_acs_completed(struct hostapd_iface *iface)
 {
-	int ret;
+	int ret = -1;
 
 	switch (hostapd_check_chans(iface)) {
 	case HOSTAPD_CHAN_VALID:
@@ -728,23 +728,25 @@  int hostapd_acs_completed(struct hostapd_iface *iface)
 	case HOSTAPD_CHAN_ACS:
 		wpa_printf(MSG_ERROR, "ACS error - reported complete, but no result available");
 		hostapd_notify_bad_chans(iface);
-		return -1;
+		goto out;
 	case HOSTAPD_CHAN_INVALID:
 	default:
 		wpa_printf(MSG_ERROR, "ACS picked unusable channels");
 		hostapd_notify_bad_chans(iface);
-		return -1;
+		goto out;
 	}
 
 	ret = hostapd_check_ht_capab(iface);
 	if (ret < 0)
-		return -1;
+		goto out;
 	if (ret == 1) {
 		wpa_printf(MSG_DEBUG, "Interface initialization will be completed in a callback");
 		return 0;
 	}
 
-	return hostapd_setup_interface_complete(iface, 0);
+	ret = 0;
+out:
+	return hostapd_setup_interface_complete(iface, ret);
 }