]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Pass CSA parameters by reference instead by value
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 5 Sep 2024 21:42:26 +0000 (00:42 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 5 Sep 2024 22:06:32 +0000 (01:06 +0300)
There is no need to make a copy of the full struct csa_settings for
this.

Fixes: 5cb6747f9721 ("Add support to switch channel when CAC is in progress")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
hostapd/ctrl_iface.c
src/ap/hostapd.c
src/ap/hostapd.h

index bae827caf1475a016751f696cab6b03b6015bb6e..2f581be0bae07c2e34a3e8e934173e7c458058ba 100644 (file)
@@ -2772,7 +2772,7 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
        if (iface->cac_started) {
                wpa_printf(MSG_DEBUG,
                           "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++) {
index f97311587df7a32f8fb5dee0d404673e9cd25fba..7d924893f17b39211848fa91af9f9cff342dac6b 100644 (file)
@@ -4564,15 +4564,15 @@ int hostapd_switch_channel(struct hostapd_data *hapd,
 
 
 int hostapd_force_channel_switch(struct hostapd_iface *iface,
-                                struct csa_settings settings)
+                                struct csa_settings *settings)
 {
        int ret = 0;
 
-       if (!settings.freq_params.channel) {
+       if (!settings->freq_params.channel) {
                /* Check if the new channel is supported */
-               settings.freq_params.channel = hostapd_hw_get_channel(
-                       iface->bss[0], settings.freq_params.freq);
-               if (!settings.freq_params.channel)
+               settings->freq_params.channel = hostapd_hw_get_channel(
+                       iface->bss[0], settings->freq_params.freq);
+               if (!settings->freq_params.channel)
                        return -1;
        }
 
@@ -4582,9 +4582,9 @@ int hostapd_force_channel_switch(struct hostapd_iface *iface,
                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,
-                                        &settings.freq_params, NULL);
+                                        &settings->freq_params, NULL);
        if (ret) {
                wpa_printf(MSG_DEBUG,
                           "Failed to set the new channel in config");
index dddefb593c1af7ee0f2abc432aab3e588de451c0..7e72863af75ed97efbbc5f3f4ce943139d473174 100644 (file)
@@ -787,7 +787,7 @@ void hostapd_chan_switch_config(struct hostapd_data *hapd,
 int hostapd_switch_channel(struct hostapd_data *hapd,
                           struct csa_settings *settings);
 int hostapd_force_channel_switch(struct hostapd_iface *iface,
-                                struct csa_settings settings);
+                                struct csa_settings *settings);
 void
 hostapd_switch_channel_fallback(struct hostapd_iface *iface,
                                const struct hostapd_freq_params *freq_params);