From 7dd7ae965a1d5c55dd0d6e642643c3ea74b5c04f Mon Sep 17 00:00:00 2001 From: Dmitrijs Martinovs Date: Thu, 7 Dec 2023 11:59:10 +0200 Subject: [PATCH] DFS: Change vht_capab according to user requested bandwidth There are different CHAN_SWITCH flows for DFS and non-DFS channels. Non-DFS one saves previous BW value in iface->conf, but DFS flow replaces it with a new user requested value. Setting a non-DFS channel after a DFS one with BW = 160 would have resulted in a mismatch between the saved BW and vht_capab (if VHT160 was not included by default). This would have led to a check fail in the hostapd_set_freq_params() function. Signed-off-by: Dmitrijs Martinovs --- src/ap/hostapd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index fea3d8b3c..145463d04 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -4103,13 +4103,17 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface, bw = CONF_OPER_CHWIDTH_USE_HT; break; case 80: - if (freq_params->center_freq2) + if (freq_params->center_freq2) { bw = CONF_OPER_CHWIDTH_80P80MHZ; - else + iface->conf->vht_capab |= + VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; + } else { bw = CONF_OPER_CHWIDTH_80MHZ; + } break; case 160: bw = CONF_OPER_CHWIDTH_160MHZ; + iface->conf->vht_capab |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; break; case 320: bw = CONF_OPER_CHWIDTH_320MHZ;