Browse Source

hostapd: Add ctrl_iface events for ACS

These give status information to external observers from automatic
channel selection operations.

Signed-hostap: Jouni Malinen <j@w1.fi>
Jouni Malinen 11 years ago
parent
commit
ae134e1d2b
3 changed files with 15 additions and 0 deletions
  1. 3 0
      src/ap/acs.c
  2. 8 0
      src/ap/hw_features.c
  3. 4 0
      src/common/wpa_ctrl.h

+ 3 - 0
src/ap/acs.c

@@ -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;
 }

+ 8 - 0
src/ap/hw_features.c

@@ -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;
 	}

+ 4 - 0
src/common/wpa_ctrl.h

@@ -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 "