From 3ea5c0df504538f2d12c9f46ad74dfc888d4d99c Mon Sep 17 00:00:00 2001 From: Haribabu Krishnasamy Date: Fri, 19 Dec 2025 17:18:40 +0530 Subject: [PATCH] Move beacon transmit rate configuration from radio level to BSS level This enables control of the beacon transmission rate on a per-BSS basis. Refactor beacon rate handling by moving the beacon_rate and rate_type fields from struct hostapd_config to the per-BSS struct hostapd_bss_config structure. This change ensures that beacon rate settings are applied at BSS level, allowing multiple BSS instances to have independent configurations. This updates the configuration parsing logic to set these values in BSS context and adjusts beacon parameter building to reference the BSS-level fields. Signed-off-by: Haribabu Krishnasamy --- hostapd/config_file.c | 16 ++++++++-------- src/ap/ap_config.h | 6 +++--- src/ap/beacon.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index fec51bd4a..8d5c1433a 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -3338,6 +3338,7 @@ static int hostapd_config_fill(struct hostapd_config *conf, return 1; } } else if (os_strcmp(buf, "beacon_rate") == 0) { + enum beacon_rate_type rate_type; int val; if (os_strncmp(pos, "ht:", 3) == 0) { @@ -3348,8 +3349,7 @@ static int hostapd_config_fill(struct hostapd_config *conf, line, val); return 1; } - conf->rate_type = BEACON_RATE_HT; - conf->beacon_rate = val; + rate_type = BEACON_RATE_HT; } else if (os_strncmp(pos, "vht:", 4) == 0) { val = atoi(pos + 4); if (val < 0 || val > 9) { @@ -3358,8 +3358,7 @@ static int hostapd_config_fill(struct hostapd_config *conf, line, val); return 1; } - conf->rate_type = BEACON_RATE_VHT; - conf->beacon_rate = val; + rate_type = BEACON_RATE_VHT; } else if (os_strncmp(pos, "he:", 3) == 0) { val = atoi(pos + 3); if (val < 0 || val > 11) { @@ -3368,8 +3367,7 @@ static int hostapd_config_fill(struct hostapd_config *conf, line, val); return 1; } - conf->rate_type = BEACON_RATE_HE; - conf->beacon_rate = val; + rate_type = BEACON_RATE_HE; } else { val = atoi(pos); if (val < 10 || val > 10000) { @@ -3378,9 +3376,11 @@ static int hostapd_config_fill(struct hostapd_config *conf, line, val); return 1; } - conf->rate_type = BEACON_RATE_LEGACY; - conf->beacon_rate = val; + rate_type = BEACON_RATE_LEGACY; } + + bss->rate_type = rate_type; + bss->beacon_rate = val; } else if (os_strcmp(buf, "preamble") == 0) { if (atoi(pos)) conf->preamble = SHORT_PREAMBLE; diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index ae6972f48..b427a972e 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -295,6 +295,9 @@ struct hostapd_bss_config { int max_num_sta; /* maximum number of STAs in station table */ + enum beacon_rate_type rate_type; + unsigned int beacon_rate; + int dtim_period; unsigned int bss_load_update_period; unsigned int chan_util_avg_period; @@ -1063,9 +1066,6 @@ struct hostapd_config { SHORT_PREAMBLE = 1 } preamble; - unsigned int beacon_rate; - enum beacon_rate_type rate_type; - const struct wpa_driver_ops *driver; char *driver_params; diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 6eb4ff20b..90224211b 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -2583,8 +2583,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, params->dtim_period = hapd->conf->dtim_period; params->beacon_int = hapd->iconf->beacon_int; params->basic_rates = hapd->basic_rates; - params->beacon_rate = hapd->iconf->beacon_rate; - params->rate_type = hapd->iconf->rate_type; + params->beacon_rate = hapd->conf->beacon_rate; + params->rate_type = hapd->conf->rate_type; params->ssid = hapd->conf->ssid.ssid; params->ssid_len = hapd->conf->ssid.ssid_len; if ((hapd->conf->wpa & (WPA_PROTO_WPA | WPA_PROTO_RSN)) == -- 2.47.3