In hostapd_cli chan_switch command (hostapd_ctrl_iface_chan_switch) there are 2 flows - for non-DFS channels and for DFS channels. Non-DFS: Sets new BW (from chan_switch command input) into iface->conf struct Create after-switch-beacon template Resets iface->conf BW back to original value. During saving of original BW there is a check if that BW corresponds to vht_capab. DFS: Sets new BW (from chan_switch command input) into iface->conf struct Read vht_capab from driver Create all necessary beacon templates and do chan switch using new BW and driver's vht_capab After this flow new BW remains in iface->conf The issue is: By default we don't have VHT160 support in vht_capab. If we set BW = 160 for a DFS channel, it will be saved in iface->conf. If we try to set a non-DFS channel afterwards the function that saves previous values will fail the check for old BW == vht_capab as old BW comes from first (DFS) chan_switch command and vht_capab comes from original values. Example: Set ch=60 bw=160 -> saves BW as 160 Set ch=40 bw=160 -> compares that BW with original vht_capab that doesn't include VHT160 Fix: Change iface->conf->vht_capab according to BW that is requested by user, i.e. add VHT160 if input BW=160 >From c6104b3ecc281d01e7cf617fe984f9a2818ed0d8 Mon Sep 17 00:00:00 2001 From: Dmitrijs Martinovs <dmartinovs@xxxxxxxxxxxxx> Date: Thu, 7 Dec 2023 11:59:10 +0200 Subject: [PATCH] Change vht_capab according to user requested BW To: hostap@xxxxxxxxxxxxxxxxxxx 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 <dmartinovs@xxxxxxxxxxxxx> --- src/ap/hostapd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index fea3d8b3c..0c693a8a9 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -4103,13 +4103,15 @@ 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; -- 2.17.1
Attachment:
0001-Change-vht_capab-according-to-user-requested-BW.patch
Description: 0001-Change-vht_capab-according-to-user-requested-BW.patch
_______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap