From 5321b1b70bb84bb6d0f30cb263fd1a8164383d24 Mon Sep 17 00:00:00 2001 From: Abhinav Kulkarni Date: Wed, 18 Jun 2025 12:58:18 +0530 Subject: [PATCH] modules: hostap: Updated reg domain details Added kconfig for regulatory domain in hostapd. Default is set to 00 as World Wide mode. Also added 3rd octet kconfig to set regulatory environment and set it to 32 for all supported environments. Signed-off-by: Abhinav Kulkarni --- modules/hostap/Kconfig | 21 +++++++++++++++++++++ modules/hostap/src/hapd_main.c | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/hostap/Kconfig b/modules/hostap/Kconfig index 95dd2531503..f488bb50dfe 100644 --- a/modules/hostap/Kconfig +++ b/modules/hostap/Kconfig @@ -596,4 +596,25 @@ config WIFI_NM_WPA_CTRL_RESP_TIMEOUT_S Timeout for the control interface commands to get a response from the supplicant. +config WIFI_NM_HOSTAPD_REGULATORY_REGION + string "Select Wi-Fi Regulatory Domain" + default "00" + depends on WIFI_NM_HOSTAPD_AP + help + Region/Country code (ISO/IEC 3166-1).Used to set regulatory domain. + Set as needed to indicate country in which device is operating. + This can limit available channels and transmit power. + These two octets are used as the first two octets of the Country String + (dot11CountryString). "00" stands for World Wide mode. + +config WIFI_NM_HOSTAPD_REGULATORY_ENV + int "Select Wi-Fi Regulatory Environment" + default 32 + depends on WIFI_NM_HOSTAPD_AP + help + The third octet of the Country String (dot11CountryString) + This parameter is used to set the third octet of the country string. + All supported environments of current region can be used with + default value of 0x20 or 32. + endif # WIFI_NM_WPA_SUPPLICANT diff --git a/modules/hostap/src/hapd_main.c b/modules/hostap/src/hapd_main.c index 6c5e9c6d998..994b5d9270d 100644 --- a/modules/hostap/src/hapd_main.c +++ b/modules/hostap/src/hapd_main.c @@ -351,7 +351,10 @@ struct hostapd_config *hostapd_config_read2(const char *fname) bss->logger_stdout_level = HOSTAPD_LEVEL_INFO; bss->logger_stdout = 0xffff; bss->nas_identifier = os_strdup("ap.example.com"); - os_memcpy(conf->country, "US ", 3); + /* Set regulatory domain */ + os_memcpy(conf->country, CONFIG_WIFI_NM_HOSTAPD_REGULATORY_REGION, 2); + /* Set regulatory environment */ + conf->country[2] = CONFIG_WIFI_NM_HOSTAPD_REGULATORY_ENV; conf->hw_mode = HOSTAPD_MODE_IEEE80211G; bss->wps_state = WPS_STATE_CONFIGURED; bss->eap_server = 1;