aboutsummaryrefslogtreecommitdiffstats
path: root/src/ap/beacon.c
diff options
context:
space:
mode:
authorVictor Goldenshtein <victorg@ti.com>2011-11-21 15:19:52 +0200
committerArik Nemtsov <arik@wizery.com>2012-09-13 14:53:28 +0300
commitff0a677405533513777ed413abff97483f5fda6d (patch)
tree345897e5425f8e1aa37f39ce603163a3deec7998 /src/ap/beacon.c
parent7b65de18e8276ed3b5d2cbb64dc06c347f3b0e78 (diff)
downloadexternal_wpa_supplicant_8_ti-ff0a677405533513777ed413abff97483f5fda6d.zip
external_wpa_supplicant_8_ti-ff0a677405533513777ed413abff97483f5fda6d.tar.gz
external_wpa_supplicant_8_ti-ff0a677405533513777ed413abff97483f5fda6d.tar.bz2
hostap: add channel switch ability to AP & GO (INTERNAL)
Add channel switch command and handle channel switch request/complete events. New hostapd_eid_csa() which builds the channel switch announcement IE. Add this CSA to the beacon frame prior performing a channel switch and remove it once it's completed. New EVENT_REQ_CH_SW which indicates that the driver has requested to perform a channel switch. Signed-hostap: Victor Goldenshtein <victorg@ti.com>
Diffstat (limited to 'src/ap/beacon.c')
-rw-r--r--src/ap/beacon.c25
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);