From 186c9059120f967233b9d8a6697e0dc046d6cc02 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 2 Nov 2013 21:01:47 +0200 Subject: [PATCH] DFS: Add control interface events for various DFS events These can be useful for external programs that track the current state of the AP. Signed-hostap: Jouni Malinen --- src/ap/dfs.c | 19 +++++++++++++++++++ src/common/wpa_ctrl.h | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index d6c09a000..202076a18 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -11,6 +11,7 @@ #include "utils/common.h" #include "common/ieee802_11_defs.h" +#include "common/wpa_ctrl.h" #include "hostapd.h" #include "ap_drv_ops.h" #include "drivers/driver.h" @@ -568,6 +569,10 @@ int hostapd_handle_dfs(struct hostapd_data *hapd) /* Finally start CAC */ wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", hapd->iface->freq); + wpa_msg(hapd->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START + "freq=%d chan=%d sec_chan=%d", + hapd->iface->freq, + hapd->iconf->channel, hapd->iconf->secondary_channel); if (hostapd_start_dfs_cac(hapd, hapd->iconf->hw_mode, hapd->iface->freq, hapd->iconf->channel, @@ -589,6 +594,10 @@ int hostapd_dfs_complete_cac(struct hostapd_data *hapd, int success, int freq, int ht_enabled, int chan_offset, int chan_width, int cf1, int cf2) { + wpa_msg(hapd->msg_ctx, MSG_INFO, DFS_EVENT_CAC_COMPLETED + "success=%d freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", + success, freq, ht_enabled, chan_offset, chan_width, cf1, cf2); + if (success) { /* Complete iface/ap configuration */ set_dfs_state(hapd, freq, ht_enabled, chan_offset, @@ -617,6 +626,9 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_data *hapd) if (channel) { wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d", channel->chan); + wpa_msg(hapd->msg_ctx, MSG_INFO, DFS_EVENT_NEW_CHANNEL + "freq=%d chan=%d sec_chan=%d", channel->freq, + channel->chan, secondary_channel); hapd->iface->freq = channel->freq; hapd->iconf->channel = channel->chan; @@ -661,6 +673,10 @@ int hostapd_dfs_radar_detected(struct hostapd_data *hapd, int freq, if (!hapd->iconf->ieee80211h) return 0; + wpa_msg(hapd->msg_ctx, MSG_INFO, DFS_EVENT_RADAR_DETECTED + "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", + freq, ht_enabled, chan_offset, chan_width, cf1, cf2); + /* mark radar frequency as invalid */ res = set_dfs_state(hapd, freq, ht_enabled, chan_offset, chan_width, cf1, cf2, @@ -682,6 +698,9 @@ int hostapd_dfs_nop_finished(struct hostapd_data *hapd, int freq, int ht_enabled, int chan_offset, int chan_width, int cf1, int cf2) { + wpa_msg(hapd->msg_ctx, MSG_INFO, DFS_EVENT_NOP_FINISHED + "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d", + freq, ht_enabled, chan_offset, chan_width, cf1, cf2); /* TODO add correct implementation here */ set_dfs_state(hapd, freq, ht_enabled, chan_offset, chan_width, cf1, cf2, HOSTAPD_CHAN_DFS_USABLE); diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index 81c4c2709..127358d22 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -162,6 +162,12 @@ extern "C" { #define AP_REJECTED_MAX_STA "AP-REJECTED-MAX-STA " #define AP_REJECTED_BLOCKED_STA "AP-REJECTED-BLOCKED-STA " +#define DFS_EVENT_RADAR_DETECTED "DFS-RADAR-DETECTED " +#define DFS_EVENT_NEW_CHANNEL "DFS-NEW-CHANNEL " +#define DFS_EVENT_CAC_START "DFS-CAC-START " +#define DFS_EVENT_CAC_COMPLETED "DFS-CAC-COMPLETED " +#define DFS_EVENT_NOP_FINISHED "DFS-NOP-FINISHED " + /* BSS command information masks */ #define WPA_BSS_MASK_ALL 0xFFFDFFFF