[PATCHv2 4/4] hostapd: terminate hostapd when no channel is available

Simon Wunderlich sw at simonwunderlich.de
Thu Feb 6 13:30:40 EST 2014

Until hostapd is able to restart service on a channel (e.g. by reacting
to an event that a DFS non-occupancy period is over), better shut down
hostapd when no channel is available anymore.

The current behaviour, disabling the interface, will just lead to
hostapd hanging without recovering frmo this state. If hostapd shuts
down, userspace can at least work around and restart hostapd when
channels are available again.

Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
 src/ap/dfs.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 78668dc..a46811a 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -10,6 +10,7 @@
 #include "utils/includes.h"
 #include "utils/common.h"
+#include "utils/eloop.h"
 #include "common/ieee802_11_defs.h"
 #include "common/wpa_ctrl.h"
 #include "hostapd.h"
@@ -734,7 +735,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 		if (!channel) {
 			/* FIXME: Wait for channel(s) to become available */
-			hostapd_disable_iface(iface);
+			eloop_terminate();
 			return err;
@@ -776,7 +777,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 	if (err) {
 		wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
-		hostapd_disable_iface(iface);
+		eloop_terminate();
 		return err;

More information about the HostAP mailing list