]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Update conf->op_class in hostapd_change_config_freq()
authorHariharan Basuthkar <hbasuthk@qti.qualcomm.com>
Tue, 7 Oct 2025 21:33:34 +0000 (03:03 +0530)
committerJouni Malinen <j@w1.fi>
Wed, 8 Oct 2025 09:39:02 +0000 (12:39 +0300)
Some cases of channel switching, e.g., when changing from a 320 MHz
channel to a 80 MHz channel in the 6 GHz band, has been observed to
cause disconnections due to non-AP MLDs getting confused with inaccurate
information.

On the AP side, the new target channel's ccfs0 and ccfs1 have incorrect
values in the EHT Operating Information element. This is because,
in hostapd_eid_eht_operation(), the ch_width is calculated based on
conf->op_class and during the channel switch, hostapd_change_config_freq()
does not assign the target channel's op_class to conf->op_class during
the construction of the Beacon frame template.

Fix this issue by assigning conf->op_class in
hostapd_change_config_freq().

Also, change the datatype of channel in hostapd_change_config_freq()
from int to u8, as IEEE 802.11 channel numbers are represented with 8
bits, and can only be between 1 to 255.

Signed-off-by: Hariharan Basuthkar <hbasuthk@qti.qualcomm.com>
src/ap/hostapd.c

index fe815119f434aa347cec6b66000a9fa483dfb872..ed644a06f28ff6dc4cd6341926c416783f2ebb75 100644 (file)
@@ -4471,8 +4471,7 @@ int hostapd_change_config_freq(struct hostapd_data *hapd,
                               struct hostapd_freq_params *params,
                               struct hostapd_freq_params *old_params)
 {
-       int channel;
-       u8 seg0 = 0, seg1 = 0;
+       u8 channel, op_class, seg0 = 0, seg1 = 0;
        struct hostapd_hw_modes *mode;
 
        if (!params->channel) {
@@ -4557,6 +4556,14 @@ int hostapd_change_config_freq(struct hostapd_data *hapd,
            ieee80211_freq_to_chan(params->center_freq2,
                                   &seg1) == NUM_HOSTAPD_MODES)
                return -1;
+       if (ieee80211_freq_to_channel_ext(params->freq,
+                                         conf->secondary_channel,
+                                         hostapd_get_oper_chwidth(hapd->iconf),
+                                         &op_class, &channel) ==
+           NUM_HOSTAPD_MODES)
+               return -1;
+
+       conf->op_class = op_class;
        hostapd_set_oper_centr_freq_seg0_idx(conf, seg0);
        hostapd_set_oper_centr_freq_seg1_idx(conf, seg1);