]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Determine current hw mode before channel switch
authorXinyue Ling <quic_xinyling@quicinc.com>
Wed, 7 Jun 2023 08:13:34 +0000 (16:13 +0800)
committerJouni Malinen <j@w1.fi>
Thu, 22 Jun 2023 14:20:44 +0000 (17:20 +0300)
There are two hw modes (5 GHz and 6 GHz) with HOSTAPD_MODE_IEEE80211A
and the current hw mode may be wrong after one channel switch to 6 GHz.
This will cause hostapd_set_freq_params() to return -1 when saving
previous state and the second channel switch to fail. Fix this by adding
hostapd_determine_mode() before every channel switch.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/ap/hostapd.c
src/ap/hw_features.c
src/ap/hw_features.h

index a8ba207de9362ddef9b5c7a113ae597b42633e31..99d10bea979b08b8b47e477d0b45f462484afa27 100644 (file)
@@ -55,6 +55,7 @@
 #include "hs20.h"
 #include "airtime_policy.h"
 #include "wpa_auth_kay.h"
+#include "hw_features.h"
 
 
 static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason);
@@ -3775,6 +3776,7 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
        if (!channel)
                return -1;
 
+       hostapd_determine_mode(hapd->iface);
        mode = hapd->iface->current_mode;
 
        /* if a pointer to old_params is provided we save previous state */
index 26f8974ba873310f128d7bc2929f684e3317ce4d..7d899f50d2ea11a18f2b72f1b8b3abc68d89cf7d 100644 (file)
@@ -1040,7 +1040,7 @@ static bool skip_mode(struct hostapd_iface *iface,
 }
 
 
-static void hostapd_determine_mode(struct hostapd_iface *iface)
+void hostapd_determine_mode(struct hostapd_iface *iface)
 {
        int i;
        enum hostapd_hw_mode target_mode;
index ad0ddf7ff3864a0214452c4ffcd4b25a4ee9b02b..092941f77a2e0fd1933eb5ee34ddcdc40a08c1c7 100644 (file)
@@ -28,6 +28,7 @@ int hostapd_prepare_rates(struct hostapd_iface *iface,
 void hostapd_stop_setup_timers(struct hostapd_iface *iface);
 int hostapd_hw_skip_mode(struct hostapd_iface *iface,
                         struct hostapd_hw_modes *mode);
+void hostapd_determine_mode(struct hostapd_iface *iface);
 #else /* NEED_AP_MLME */
 static inline void
 hostapd_free_hw_features(struct hostapd_hw_modes *hw_features,
@@ -91,6 +92,10 @@ static inline int hostapd_check_he_6ghz_capab(struct hostapd_iface *iface)
        return 0;
 }
 
+static inline void hostapd_determine_mode(struct hostapd_iface *iface)
+{
+}
+
 #endif /* NEED_AP_MLME */
 
 #endif /* HW_FEATURES_H */