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>
This commit is contained in:
Jouni Malinen 2013-11-03 15:59:53 +02:00
parent ad08e1413b
commit ae134e1d2b
3 changed files with 15 additions and 0 deletions

View file

@ -13,6 +13,7 @@
#include "utils/common.h" #include "utils/common.h"
#include "utils/list.h" #include "utils/list.h"
#include "common/ieee802_11_defs.h" #include "common/ieee802_11_defs.h"
#include "common/wpa_ctrl.h"
#include "drivers/driver.h" #include "drivers/driver.h"
#include "hostapd.h" #include "hostapd.h"
#include "ap_drv_ops.h" #include "ap_drv_ops.h"
@ -794,5 +795,7 @@ enum hostapd_chan_status acs_init(struct hostapd_iface *iface)
if (err < 0) if (err < 0)
return HOSTAPD_CHAN_INVALID; return HOSTAPD_CHAN_INVALID;
wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, ACS_EVENT_STARTED);
return HOSTAPD_CHAN_ACS; return HOSTAPD_CHAN_ACS;
} }

View file

@ -20,6 +20,7 @@
#include "utils/eloop.h" #include "utils/eloop.h"
#include "common/ieee802_11_defs.h" #include "common/ieee802_11_defs.h"
#include "common/ieee802_11_common.h" #include "common/ieee802_11_common.h"
#include "common/wpa_ctrl.h"
#include "drivers/driver.h" #include "drivers/driver.h"
#include "hostapd.h" #include "hostapd.h"
#include "ap_config.h" #include "ap_config.h"
@ -857,14 +858,21 @@ int hostapd_acs_completed(struct hostapd_iface *iface, int err)
switch (hostapd_check_chans(iface)) { switch (hostapd_check_chans(iface)) {
case HOSTAPD_CHAN_VALID: 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; break;
case HOSTAPD_CHAN_ACS: case HOSTAPD_CHAN_ACS:
wpa_printf(MSG_ERROR, "ACS error - reported complete, but no result available"); 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); hostapd_notify_bad_chans(iface);
goto out; goto out;
case HOSTAPD_CHAN_INVALID: case HOSTAPD_CHAN_INVALID:
default: default:
wpa_printf(MSG_ERROR, "ACS picked unusable channels"); 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); hostapd_notify_bad_chans(iface);
goto out; goto out;
} }

View file

@ -162,6 +162,10 @@ extern "C" {
#define AP_REJECTED_MAX_STA "AP-REJECTED-MAX-STA " #define AP_REJECTED_MAX_STA "AP-REJECTED-MAX-STA "
#define AP_REJECTED_BLOCKED_STA "AP-REJECTED-BLOCKED-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_RADAR_DETECTED "DFS-RADAR-DETECTED "
#define DFS_EVENT_NEW_CHANNEL "DFS-NEW-CHANNEL " #define DFS_EVENT_NEW_CHANNEL "DFS-NEW-CHANNEL "
#define DFS_EVENT_CAC_START "DFS-CAC-START " #define DFS_EVENT_CAC_START "DFS-CAC-START "