From: Jouni Malinen Date: Fri, 29 Apr 2022 08:18:34 +0000 (+0300) Subject: Set hostapd hw_mode automatically based on 6 GHz op_class X-Git-Tag: hostap_2_11~2003 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86310c22024c36cefb2c495058731b4a1042428c;p=thirdparty%2Fhostap.git Set hostapd hw_mode automatically based on 6 GHz op_class 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 --- diff --git a/hostapd/config_file.c b/hostapd/config_file.c index b1958e99a..ce29c62f4 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -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; diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c index 051b843e9..50fea3435 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c @@ -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 " diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 20fa863f3..7d66cd8af 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -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 {