]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Fix own wide bandwidth subelement generation (neighbor report)
authorBeni Lev <beni.lev@intel.com>
Thu, 27 Oct 2016 12:18:31 +0000 (15:18 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 29 Oct 2016 19:03:43 +0000 (22:03 +0300)
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>
src/ap/hostapd.c

index f03db292ec4b19a106599326479e318dd31c5a15..cfd023169ec8b2e6f8e7e1459a62c974ddec6214 100644 (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);