hostapd: Fix own wide bandwidth subelement generation (neighbor report)

The Channel Center Frequency Segment subfields use the channel index
instead of frequency in MHz.

Signed-off-by: Beni Lev <beni.lev@intel.com>
Signed-off-by: David Spinadel <david.spinadel@intel.com>
This commit is contained in:
Beni Lev 2016-10-27 15:18:31 +03:00 committed by Jouni Malinen
parent 0a63635ed0
commit f0259c3f68

View file

@ -1561,7 +1561,7 @@ static void hostapd_set_own_neighbor_report(struct hostapd_data *hapd)
int vht = hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac;
struct wpa_ssid_value ssid;
u8 channel, op_class;
int center_freq1 = 0, center_freq2 = 0;
u8 center_freq1_idx = 0, center_freq2_idx = 0;
enum nr_chan_width width;
u32 bssid_info;
struct wpabuf *nr;
@ -1604,16 +1604,14 @@ static void hostapd_set_own_neighbor_report(struct hostapd_data *hapd)
&op_class, &channel);
width = hostapd_get_nr_chan_width(hapd, ht, vht);
if (vht) {
center_freq1 = ieee80211_chan_to_freq(
NULL, op_class,
hapd->iconf->vht_oper_centr_freq_seg0_idx);
center_freq1_idx = hapd->iconf->vht_oper_centr_freq_seg0_idx;
if (width == NR_CHAN_WIDTH_80P80)
center_freq2 = ieee80211_chan_to_freq(
NULL, op_class,
hapd->iconf->vht_oper_centr_freq_seg1_idx);
center_freq2_idx =
hapd->iconf->vht_oper_centr_freq_seg1_idx;
} else if (ht) {
center_freq1 = hapd->iface->freq +
10 * hapd->iconf->secondary_channel;
ieee80211_freq_to_chan(hapd->iface->freq +
10 * hapd->iconf->secondary_channel,
&center_freq1_idx);
}
ssid.ssid_len = hapd->conf->ssid.ssid_len;
@ -1641,8 +1639,8 @@ static void hostapd_set_own_neighbor_report(struct hostapd_data *hapd)
wpabuf_put_u8(nr, WNM_NEIGHBOR_WIDE_BW_CHAN);
wpabuf_put_u8(nr, 3);
wpabuf_put_u8(nr, width);
wpabuf_put_u8(nr, center_freq1);
wpabuf_put_u8(nr, center_freq2);
wpabuf_put_u8(nr, center_freq1_idx);
wpabuf_put_u8(nr, center_freq2_idx);
hostapd_neighbor_set(hapd, hapd->own_addr, &ssid, nr, hapd->iconf->lci,
hapd->iconf->civic, hapd->iconf->stationary_ap);