hostapd: Add ctrl_iface events for ACS
authorJouni Malinen <j@w1.fi>
Sun, 3 Nov 2013 13:59:53 +0000 (15:59 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 3 Nov 2013 17:51:06 +0000 (19:51 +0200)
These give status information to external observers from automatic
channel selection operations.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/ap/acs.c
src/ap/hw_features.c
src/common/wpa_ctrl.h

index d7c921d..12b955c 100644 (file)
@@ -13,6 +13,7 @@
 #include "utils/common.h"
 #include "utils/list.h"
 #include "common/ieee802_11_defs.h"
+#include "common/wpa_ctrl.h"
 #include "drivers/driver.h"
 #include "hostapd.h"
 #include "ap_drv_ops.h"
@@ -794,5 +795,7 @@ enum hostapd_chan_status acs_init(struct hostapd_iface *iface)
        if (err < 0)
                return HOSTAPD_CHAN_INVALID;
 
+       wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_STARTED);
+
        return HOSTAPD_CHAN_ACS;
 }
index d2831d4..908d91e 100644 (file)
@@ -20,6 +20,7 @@
 #include "utils/eloop.h"
 #include "common/ieee802_11_defs.h"
 #include "common/ieee802_11_common.h"
+#include "common/wpa_ctrl.h"
 #include "drivers/driver.h"
 #include "hostapd.h"
 #include "ap_config.h"
@@ -857,14 +858,21 @@ int hostapd_acs_completed(struct hostapd_iface *iface, int err)
 
        switch (hostapd_check_chans(iface)) {
        case HOSTAPD_CHAN_VALID:
+               wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO,
+                       ACS_EVENT_COMPLETED "freq=%d channel=%d",
+                       hostapd_hw_get_freq(iface->bss[0],
+                                           iface->conf->channel),
+                       iface->conf->channel);
                break;
        case HOSTAPD_CHAN_ACS:
                wpa_printf(MSG_ERROR, "ACS error - reported complete, but no result available");
+               wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED);
                hostapd_notify_bad_chans(iface);
                goto out;
        case HOSTAPD_CHAN_INVALID:
        default:
                wpa_printf(MSG_ERROR, "ACS picked unusable channels");
+               wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_FAILED);
                hostapd_notify_bad_chans(iface);
                goto out;
        }
index 127358d..67b7226 100644 (file)
@@ -162,6 +162,10 @@ extern "C" {
 #define AP_REJECTED_MAX_STA "AP-REJECTED-MAX-STA "
 #define AP_REJECTED_BLOCKED_STA "AP-REJECTED-BLOCKED-STA "
 
+#define ACS_EVENT_STARTED "ACS-STARTED "
+#define ACS_EVENT_COMPLETED "ACS-COMPLETED "
+#define ACS_EVENT_FAILED "ACS-FAILED "
+
 #define DFS_EVENT_RADAR_DETECTED "DFS-RADAR-DETECTED "
 #define DFS_EVENT_NEW_CHANNEL "DFS-NEW-CHANNEL "
 #define DFS_EVENT_CAC_START "DFS-CAC-START "