diff options
Diffstat (limited to 'src/ap/beacon.c')
-rw-r--r-- | src/ap/beacon.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ap/beacon.c b/src/ap/beacon.c index a1bb067..72c3ead 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -33,6 +33,7 @@ #include "p2p_hostapd.h" #include "ap_drv_ops.h" #include "beacon.h" +#include "hw_features.h" #ifdef NEED_AP_MLME @@ -171,6 +172,27 @@ static u8 * hostapd_eid_country(struct hostapd_data *hapd, u8 *eid, return pos; } +static u8 *hostapd_eid_csa(struct hostapd_data *hapd, u8 *eid) +{ + int current_ch_flag = 0; + + if (!hapd->next_channel) + return eid; + + current_ch_flag = hostapd_hw_get_channel_flag(hapd, + hapd->iconf->channel); + + *eid++ = WLAN_EID_CHANNEL_SWITCH; + *eid++ = 3; /* IE length */ + /* STAs should cease transmit if the switch is due to radar */ + *eid++ = (current_ch_flag & HOSTAPD_CHAN_RADAR) ? 1 : 0; + *eid++ = (u8)hapd->next_channel->chan; + *eid++ = (hapd->iconf->channel_switch_count > hapd->conf->dtim_period) ? + (u8)hapd->iconf->channel_switch_count : + hapd->conf->dtim_period * 2; + return eid; +} + static u8 * hostapd_eid_wpa(struct hostapd_data *hapd, u8 *eid, size_t len) { @@ -573,6 +595,9 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd) tailpos = hostapd_eid_country(hapd, tailpos, tail + BEACON_TAIL_BUF_SIZE - tailpos); + /* Channel Switch Announcement */ + tailpos = hostapd_eid_csa(hapd, tailpos); + /* ERP Information element */ tailpos = hostapd_eid_erp_info(hapd, tailpos); |