]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Update supported channel width set (HT40) after channel switch
authorpeterhuang <peterhuang@realtek.com>
Wed, 18 Aug 2021 10:48:53 +0000 (18:48 +0800)
committerJouni Malinen <j@w1.fi>
Sun, 12 Dec 2021 20:53:22 +0000 (22:53 +0200)
hostapd should update Supported Channel Width Set of HT Capability
Information field after channel switching done. Otherwise, it would
continue to use the old setting.

Signed-off-by: peterhuang <peterhuang@realtek.com>
src/ap/drv_callbacks.c
src/ap/hostapd.c

index ec5abf166b234875694ac1eda6a9b7d14a1ea21c..a50e6f2afa773058d0b94d484c41c85813548b9b 100644 (file)
@@ -957,6 +957,12 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
        hapd->iconf->ch_switch_vht_config = 0;
        hapd->iconf->ch_switch_he_config = 0;
 
+       if (width == CHAN_WIDTH_40 || width == CHAN_WIDTH_80 ||
+           width == CHAN_WIDTH_80P80 || width == CHAN_WIDTH_160)
+               hapd->iconf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+       else if (width == CHAN_WIDTH_20 || width == CHAN_WIDTH_20_NOHT)
+               hapd->iconf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+
        hapd->iconf->secondary_channel = offset;
        hostapd_set_oper_chwidth(hapd->iconf, chwidth);
        hostapd_set_oper_centr_freq_seg0_idx(hapd->iconf, seg0_idx);
index 767314a479204feb800fd59e04f0bd9abfab8115..4b88641a2dde9241b709b85f7c4920687decae11 100644 (file)
@@ -3461,6 +3461,20 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
                                    NULL))
                return -1;
 
+       switch (params->bandwidth) {
+       case 0:
+       case 20:
+               conf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+               break;
+       case 40:
+       case 80:
+       case 160:
+               conf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+               break;
+       default:
+               return -1;
+       }
+
        switch (params->bandwidth) {
        case 0:
        case 20: