hostapd: fix bringing up AP+STA when the new channel is on a DFS channel
[openwrt/staging/neocturne.git] / package / network / services / hostapd / src / src / ap / ucode.c
index 053171b1429ffb12e609734abd5deb0f35d2df50..080fe48b11ac7db03d182d43a3596ee9e5558dc3 100644 (file)
@@ -7,6 +7,7 @@
 #include "beacon.h"
 #include "hw_features.h"
 #include "ap_drv_ops.h"
+#include "dfs.h"
 #include <libubox/uloop.h>
 
 static uc_resource_type_t *global_type, *bss_type, *iface_type;
@@ -367,6 +368,13 @@ out:
        if (conf->channel)
                iface->freq = hostapd_hw_get_freq(iface->bss[0], conf->channel);
 
+       if (hostapd_is_dfs_required(iface) && !hostapd_is_dfs_chan_available(iface)) {
+               wpa_printf(MSG_INFO, "DFS CAC required on new channel, restart interface");
+               hostapd_disable_iface(iface);
+               hostapd_enable_iface(iface);
+               return ucv_boolean_new(true);
+       }
+
        for (i = 0; i < iface->num_bss; i++) {
                struct hostapd_data *hapd = iface->bss[i];
                int ret;