Pass CSA parameters by reference instead by value

There is no need to make a copy of the full struct csa_settings for
this.

Fixes: 5cb6747f97 ("Add support to switch channel when CAC is in progress")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2024-09-06 00:42:26 +03:00 committed by Jouni Malinen
parent 1527a95ba0
commit ffc9fa0132
3 changed files with 9 additions and 9 deletions

View file

@ -2772,7 +2772,7 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
if (iface->cac_started) { if (iface->cac_started) {
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"CAC is in progress - switching channel without CSA"); "CAC is in progress - switching channel without CSA");
return hostapd_force_channel_switch(iface, settings); return hostapd_force_channel_switch(iface, &settings);
} }
for (i = 0; i < iface->num_bss; i++) { for (i = 0; i < iface->num_bss; i++) {

View file

@ -4564,15 +4564,15 @@ int hostapd_switch_channel(struct hostapd_data *hapd,
int hostapd_force_channel_switch(struct hostapd_iface *iface, int hostapd_force_channel_switch(struct hostapd_iface *iface,
struct csa_settings settings) struct csa_settings *settings)
{ {
int ret = 0; int ret = 0;
if (!settings.freq_params.channel) { if (!settings->freq_params.channel) {
/* Check if the new channel is supported */ /* Check if the new channel is supported */
settings.freq_params.channel = hostapd_hw_get_channel( settings->freq_params.channel = hostapd_hw_get_channel(
iface->bss[0], settings.freq_params.freq); iface->bss[0], settings->freq_params.freq);
if (!settings.freq_params.channel) if (!settings->freq_params.channel)
return -1; return -1;
} }
@ -4582,9 +4582,9 @@ int hostapd_force_channel_switch(struct hostapd_iface *iface,
return ret; return ret;
} }
hostapd_chan_switch_config(iface->bss[0], &settings.freq_params); hostapd_chan_switch_config(iface->bss[0], &settings->freq_params);
ret = hostapd_change_config_freq(iface->bss[0], iface->conf, ret = hostapd_change_config_freq(iface->bss[0], iface->conf,
&settings.freq_params, NULL); &settings->freq_params, NULL);
if (ret) { if (ret) {
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
"Failed to set the new channel in config"); "Failed to set the new channel in config");

View file

@ -787,7 +787,7 @@ void hostapd_chan_switch_config(struct hostapd_data *hapd,
int hostapd_switch_channel(struct hostapd_data *hapd, int hostapd_switch_channel(struct hostapd_data *hapd,
struct csa_settings *settings); struct csa_settings *settings);
int hostapd_force_channel_switch(struct hostapd_iface *iface, int hostapd_force_channel_switch(struct hostapd_iface *iface,
struct csa_settings settings); struct csa_settings *settings);
void void
hostapd_switch_channel_fallback(struct hostapd_iface *iface, hostapd_switch_channel_fallback(struct hostapd_iface *iface,
const struct hostapd_freq_params *freq_params); const struct hostapd_freq_params *freq_params);