From 967791fe6002d3e6d27d70d9c92ea85ac8cd643d Mon Sep 17 00:00:00 2001 From: Andrei Otcheretianski Date: Tue, 8 Sep 2015 12:46:21 +0300 Subject: [PATCH] Move HT CSA related IE function Move Secondary Channel element function to ieee802_11_ht.c. Signed-off-by: Andrei Otcheretianski --- src/ap/beacon.c | 24 ++---------------------- src/ap/ieee802_11.h | 1 + src/ap/ieee802_11_ht.c | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index f9bbf1a89..71d348e98 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -326,28 +326,6 @@ static u8 * hostapd_eid_ecsa(struct hostapd_data *hapd, u8 *eid) } -static u8 * hostapd_eid_secondary_channel(struct hostapd_data *hapd, u8 *eid) -{ - u8 sec_ch; - - if (!hapd->cs_freq_params.sec_channel_offset) - return eid; - - if (hapd->cs_freq_params.sec_channel_offset == -1) - sec_ch = HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW; - else if (hapd->cs_freq_params.sec_channel_offset == 1) - sec_ch = HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE; - else - return eid; - - *eid++ = WLAN_EID_SECONDARY_CHANNEL_OFFSET; - *eid++ = 1; - *eid++ = sec_ch; - - return eid; -} - - static u8 * hostapd_add_csa_elems(struct hostapd_data *hapd, u8 *pos, u8 *start, unsigned int *csa_counter_off, unsigned int *ecsa_counter_off) @@ -376,7 +354,9 @@ static u8 * hostapd_add_csa_elems(struct hostapd_data *hapd, u8 *pos, /* at least one of ies is added */ if (pos != curr_pos) { +#ifdef CONFIG_IEEE80211N curr_pos = hostapd_eid_secondary_channel(hapd, curr_pos); +#endif /* CONFIG_IEEE80211N */ #ifdef CONFIG_IEEE80211AC curr_pos = hostapd_eid_wb_chsw_wrapper(hapd, curr_pos); #endif /* CONFIG_IEEE80211AC */ diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index 2c18f2bef..93f9dc333 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -49,6 +49,7 @@ u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid); +u8 * hostapd_eid_secondary_channel(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_vht_capabilities(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid); u8 * hostapd_eid_vendor_vht(struct hostapd_data *hapd, u8 *eid); diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c index 11fde2a26..33c1f6c34 100644 --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c @@ -108,6 +108,28 @@ u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid) } +u8 * hostapd_eid_secondary_channel(struct hostapd_data *hapd, u8 *eid) +{ + u8 sec_ch; + + if (!hapd->cs_freq_params.sec_channel_offset) + return eid; + + if (hapd->cs_freq_params.sec_channel_offset == -1) + sec_ch = HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW; + else if (hapd->cs_freq_params.sec_channel_offset == 1) + sec_ch = HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE; + else + return eid; + + *eid++ = WLAN_EID_SECONDARY_CHANNEL_OFFSET; + *eid++ = 1; + *eid++ = sec_ch; + + return eid; +} + + /* op_mode Set to 0 (HT pure) under the followign conditions