From fc96522eb9479c96f01b967715542bc5d7497151 Mon Sep 17 00:00:00 2001 From: Simon Wunderlich Date: Thu, 9 May 2013 20:02:57 +0300 Subject: [PATCH] nl80211: Add channel flags for DFS state information This patch is based on the original work by Boris Presman and Victor Goldenshtein. Channel Switch Announcement support has been removed and event handling as well as channel set handling was changed, among various other changes. Cc: Boris Presman Cc: Victor Goldenshtein Signed-hostap: Simon Wunderlich --- src/drivers/driver.h | 6 ++++++ src/drivers/driver_nl80211.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 30a90c0b9..9b39e7e3d 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -29,6 +29,12 @@ #define HOSTAPD_CHAN_HT40MINUS 0x00000020 #define HOSTAPD_CHAN_HT40 0x00000040 +#define HOSTAPD_CHAN_DFS_UNKNOWN 0x00000000 +#define HOSTAPD_CHAN_DFS_USABLE 0x00000100 +#define HOSTAPD_CHAN_DFS_UNAVAILABLE 0x00000200 +#define HOSTAPD_CHAN_DFS_AVAILABLE 0x00000300 +#define HOSTAPD_CHAN_DFS_MASK 0x00000300 + /** * struct hostapd_channel_data - Channel information */ diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index a28086c99..11140f9cd 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -5162,6 +5162,22 @@ static void phy_info_freq(struct hostapd_hw_modes *mode, !tb_freq[NL80211_FREQUENCY_ATTR_DISABLED]) chan->max_tx_power = nla_get_u32( tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER]) / 100; + if (tb_freq[NL80211_FREQUENCY_ATTR_DFS_STATE]) { + enum nl80211_dfs_state state = + nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_DFS_STATE]); + + switch (state) { + case NL80211_DFS_USABLE: + chan->flag |= HOSTAPD_CHAN_DFS_USABLE; + break; + case NL80211_DFS_AVAILABLE: + chan->flag |= HOSTAPD_CHAN_DFS_AVAILABLE; + break; + case NL80211_DFS_UNAVAILABLE: + chan->flag |= HOSTAPD_CHAN_DFS_UNAVAILABLE; + break; + } + } } @@ -5175,6 +5191,7 @@ static int phy_info_freqs(struct phy_info_arg *phy_info, [NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG }, [NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG }, [NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 }, + [NL80211_FREQUENCY_ATTR_DFS_STATE] = { .type = NLA_U32 }, }; int new_channels = 0; struct hostapd_channel_data *channel;