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 <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-11-02 21:01:47 +02:00
parent ddf551747c
commit 186c905912
2 changed files with 25 additions and 0 deletions

View file

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

View file

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