]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Set hostapd hw_mode automatically based on 6 GHz op_class
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 29 Apr 2022 08:18:34 +0000 (11:18 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 29 Apr 2022 08:19:43 +0000 (11:19 +0300)
Allow hostapd configuration to specify use of the 6 GHz band with the
specific op_class values without having to set the hw_mode=a parameter
explicitly.

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

index b1958e99a79bd93407af49adabf11644900c56e3..ce29c62f4cff79c95b70ed89cdf216641d0e6c2a 100644 (file)
@@ -3094,6 +3094,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                   line, pos);
                        return 1;
                }
+               conf->hw_mode_set = true;
        } else if (os_strcmp(buf, "wps_rf_bands") == 0) {
                if (os_strcmp(pos, "ad") == 0)
                        bss->wps_rf_bands = WPS_RF_60GHZ;
index 051b843e9375304600fa1e62b1315c4cb675b59a..50fea3435b25805f2af37271d423e3f542a451d0 100644 (file)
@@ -1466,6 +1466,13 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config)
 {
        size_t i;
 
+       if (full_config && is_6ghz_op_class(conf->op_class) &&
+           !conf->hw_mode_set) {
+               /* Use the appropriate hw_mode value automatically when the
+                * op_class parameter has been set, but hw_mode was not. */
+               conf->hw_mode = HOSTAPD_MODE_IEEE80211A;
+       }
+
        if (full_config && conf->ieee80211d &&
            (!conf->country[0] || !conf->country[1])) {
                wpa_printf(MSG_ERROR, "Cannot enable IEEE 802.11d without "
index 20fa863f30d0bd4ef4165ca406423d09e2f534bd..7d66cd8afd0de9060f83cb8925bae4ff4f9f6017 100644 (file)
@@ -968,6 +968,7 @@ struct hostapd_config {
        int acs_exclude_dfs;
        u8 min_tx_power;
        enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
+       bool hw_mode_set;
        int acs_exclude_6ghz_non_psc;
        int enable_background_radar;
        enum {