Determine current hw mode before channel switch

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>
This commit is contained in:
Xinyue Ling 2023-06-07 16:13:34 +08:00 committed by Jouni Malinen
parent a786c9b4a0
commit 3a995cb5a9
3 changed files with 8 additions and 1 deletions

View 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 */

View 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;

View 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 */