2020-04-06 22:58:40 +00:00
|
|
|
--- a/hostapd/config_file.c
|
|
|
|
+++ b/hostapd/config_file.c
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -2418,6 +2418,8 @@ static int hostapd_config_fill(struct ho
|
2019-10-30 15:57:22 +00:00
|
|
|
bss->isolate = atoi(pos);
|
|
|
|
} else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
|
|
|
|
bss->ap_max_inactivity = atoi(pos);
|
|
|
|
+ } else if (os_strcmp(buf, "config_id") == 0) {
|
|
|
|
+ bss->config_id = os_strdup(pos);
|
|
|
|
} else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
|
|
|
|
bss->skip_inactivity_poll = atoi(pos);
|
2023-03-13 18:35:49 +00:00
|
|
|
} else if (os_strcmp(buf, "config_id") == 0) {
|
|
|
|
@@ -3128,6 +3130,8 @@ static int hostapd_config_fill(struct ho
|
2020-02-25 16:01:55 +00:00
|
|
|
}
|
|
|
|
} else if (os_strcmp(buf, "acs_exclude_dfs") == 0) {
|
|
|
|
conf->acs_exclude_dfs = atoi(pos);
|
|
|
|
+ } else if (os_strcmp(buf, "radio_config_id") == 0) {
|
|
|
|
+ conf->config_id = os_strdup(pos);
|
2020-05-03 13:20:52 +00:00
|
|
|
} else if (os_strcmp(buf, "op_class") == 0) {
|
|
|
|
conf->op_class = atoi(pos);
|
2020-02-25 16:01:55 +00:00
|
|
|
} else if (os_strcmp(buf, "channel") == 0) {
|
2020-04-06 22:58:40 +00:00
|
|
|
--- a/src/ap/ap_config.c
|
|
|
|
+++ b/src/ap/ap_config.c
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -997,6 +997,7 @@ void hostapd_config_free(struct hostapd_
|
2020-02-25 16:01:55 +00:00
|
|
|
|
|
|
|
for (i = 0; i < conf->num_bss; i++)
|
|
|
|
hostapd_config_free_bss(conf->bss[i]);
|
|
|
|
+ os_free(conf->config_id);
|
|
|
|
os_free(conf->bss);
|
|
|
|
os_free(conf->supported_rates);
|
|
|
|
os_free(conf->basic_rates);
|
2020-04-06 22:58:40 +00:00
|
|
|
--- a/src/ap/ap_config.h
|
|
|
|
+++ b/src/ap/ap_config.h
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -987,6 +987,7 @@ struct eht_phy_capabilities_info {
|
2021-05-25 08:50:16 +00:00
|
|
|
struct hostapd_config {
|
|
|
|
struct hostapd_bss_config **bss, *last_bss;
|
|
|
|
size_t num_bss;
|
2020-02-25 16:01:55 +00:00
|
|
|
+ char *config_id;
|
|
|
|
|
2021-05-25 08:50:16 +00:00
|
|
|
u16 beacon_int;
|
|
|
|
int rts_threshold;
|
2020-04-06 22:58:40 +00:00
|
|
|
--- a/src/ap/hostapd.c
|
|
|
|
+++ b/src/ap/hostapd.c
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -254,6 +254,10 @@ static int hostapd_iface_conf_changed(st
|
2020-02-25 16:01:55 +00:00
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
+ if (newconf->config_id != oldconf->config_id)
|
|
|
|
+ if (strcmp(newconf->config_id, oldconf->config_id))
|
|
|
|
+ return 1;
|
|
|
|
+
|
|
|
|
if (newconf->num_bss != oldconf->num_bss)
|
|
|
|
return 1;
|
|
|
|
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -267,7 +271,7 @@ static int hostapd_iface_conf_changed(st
|
2020-02-25 16:01:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-int hostapd_reload_config(struct hostapd_iface *iface)
|
|
|
|
+int hostapd_reload_config(struct hostapd_iface *iface, int reconf)
|
|
|
|
{
|
|
|
|
struct hapd_interfaces *interfaces = iface->interfaces;
|
|
|
|
struct hostapd_data *hapd = iface->bss[0];
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -295,6 +299,9 @@ int hostapd_reload_config(struct hostapd
|
2019-10-30 15:57:22 +00:00
|
|
|
char *fname;
|
|
|
|
int res;
|
|
|
|
|
2020-02-25 16:01:55 +00:00
|
|
|
+ if (reconf)
|
|
|
|
+ return -1;
|
|
|
|
+
|
2023-03-13 18:35:49 +00:00
|
|
|
hostapd_clear_old(iface);
|
|
|
|
|
2019-10-30 15:57:22 +00:00
|
|
|
wpa_printf(MSG_DEBUG,
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -321,6 +328,24 @@ int hostapd_reload_config(struct hostapd
|
2019-10-30 15:57:22 +00:00
|
|
|
wpa_printf(MSG_ERROR,
|
|
|
|
"Failed to enable interface on config reload");
|
|
|
|
return res;
|
|
|
|
+ } else {
|
|
|
|
+ for (j = 0; j < iface->num_bss; j++) {
|
|
|
|
+ hapd = iface->bss[j];
|
|
|
|
+ if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) {
|
|
|
|
+ hostapd_flush_old_stations(iface->bss[j],
|
|
|
|
+ WLAN_REASON_PREV_AUTH_NOT_VALID);
|
2020-05-03 13:20:52 +00:00
|
|
|
+#ifdef CONFIG_WEP
|
2019-10-30 15:57:22 +00:00
|
|
|
+ hostapd_broadcast_wep_clear(iface->bss[j]);
|
2020-05-03 13:20:52 +00:00
|
|
|
+#endif
|
2019-10-30 15:57:22 +00:00
|
|
|
+
|
|
|
|
+#ifndef CONFIG_NO_RADIUS
|
|
|
|
+ /* TODO: update dynamic data based on changed configuration
|
|
|
|
+ * items (e.g., open/close sockets, etc.) */
|
|
|
|
+ radius_client_flush(iface->bss[j]->radius, 0);
|
|
|
|
+#endif /* CONFIG_NO_RADIUS */
|
2020-05-21 09:15:46 +00:00
|
|
|
+ wpa_printf(MSG_INFO, "bss %zu changed", j);
|
2019-10-30 15:57:22 +00:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
iface->conf = newconf;
|
|
|
|
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -337,6 +362,12 @@ int hostapd_reload_config(struct hostapd
|
2019-10-30 15:57:22 +00:00
|
|
|
|
|
|
|
for (j = 0; j < iface->num_bss; j++) {
|
|
|
|
hapd = iface->bss[j];
|
|
|
|
+ if (hapd->config_id) {
|
|
|
|
+ os_free(hapd->config_id);
|
|
|
|
+ hapd->config_id = NULL;
|
|
|
|
+ }
|
|
|
|
+ if (newconf->bss[j]->config_id)
|
|
|
|
+ hapd->config_id = strdup(newconf->bss[j]->config_id);
|
2023-03-13 18:35:49 +00:00
|
|
|
if (!hapd->conf->config_id || !newconf->bss[j]->config_id ||
|
|
|
|
os_strcmp(hapd->conf->config_id,
|
|
|
|
newconf->bss[j]->config_id) != 0)
|
|
|
|
@@ -2514,6 +2545,10 @@ hostapd_alloc_bss_data(struct hostapd_if
|
2019-10-30 15:57:22 +00:00
|
|
|
hapd->iconf = conf;
|
|
|
|
hapd->conf = bss;
|
|
|
|
hapd->iface = hapd_iface;
|
2019-12-04 23:01:28 +00:00
|
|
|
+ if (bss && bss->config_id)
|
2019-10-30 15:57:22 +00:00
|
|
|
+ hapd->config_id = strdup(bss->config_id);
|
|
|
|
+ else
|
|
|
|
+ hapd->config_id = NULL;
|
|
|
|
if (conf)
|
|
|
|
hapd->driver = conf->driver;
|
|
|
|
hapd->ctrl_sock = -1;
|
2020-04-06 22:58:40 +00:00
|
|
|
--- a/src/ap/hostapd.h
|
|
|
|
+++ b/src/ap/hostapd.h
|
2022-08-19 00:17:22 +00:00
|
|
|
@@ -47,7 +47,7 @@ struct mesh_conf;
|
2020-02-25 16:01:55 +00:00
|
|
|
struct hostapd_iface;
|
|
|
|
|
|
|
|
struct hapd_interfaces {
|
|
|
|
- int (*reload_config)(struct hostapd_iface *iface);
|
|
|
|
+ int (*reload_config)(struct hostapd_iface *iface, int reconf);
|
|
|
|
struct hostapd_config * (*config_read_cb)(const char *config_fname);
|
|
|
|
int (*ctrl_iface_init)(struct hostapd_data *hapd);
|
|
|
|
void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
|
2022-08-19 00:17:22 +00:00
|
|
|
@@ -185,6 +185,7 @@ struct hostapd_data {
|
2019-10-30 15:57:22 +00:00
|
|
|
struct hostapd_config *iconf;
|
|
|
|
struct hostapd_bss_config *conf;
|
|
|
|
struct hostapd_ubus_bss ubus;
|
|
|
|
+ char *config_id;
|
|
|
|
int interface_added; /* virtual interface added for this BSS */
|
|
|
|
unsigned int started:1;
|
|
|
|
unsigned int disabled:1;
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -676,7 +677,7 @@ struct hostapd_iface {
|
2020-02-25 16:01:55 +00:00
|
|
|
int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
|
|
|
|
int (*cb)(struct hostapd_iface *iface,
|
|
|
|
void *ctx), void *ctx);
|
|
|
|
-int hostapd_reload_config(struct hostapd_iface *iface);
|
|
|
|
+int hostapd_reload_config(struct hostapd_iface *iface, int reconf);
|
|
|
|
void hostapd_reconfig_encryption(struct hostapd_data *hapd);
|
|
|
|
struct hostapd_data *
|
|
|
|
hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
|
2020-04-06 22:58:40 +00:00
|
|
|
--- a/src/drivers/driver_nl80211.c
|
|
|
|
+++ b/src/drivers/driver_nl80211.c
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -5054,6 +5054,9 @@ static int wpa_driver_nl80211_set_ap(voi
|
2019-10-30 15:57:22 +00:00
|
|
|
if (ret) {
|
|
|
|
wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
|
|
|
|
ret, strerror(-ret));
|
2023-03-13 18:35:49 +00:00
|
|
|
+ if (!bss->flink->beacon_set)
|
2019-10-30 15:57:22 +00:00
|
|
|
+ ret = 0;
|
2023-03-13 18:35:49 +00:00
|
|
|
+ bss->flink->beacon_set = 0;
|
2019-10-30 15:57:22 +00:00
|
|
|
} else {
|
2023-03-13 18:35:49 +00:00
|
|
|
bss->flink->beacon_set = 1;
|
2019-10-30 15:57:22 +00:00
|
|
|
nl80211_set_bss(bss, params->cts_protect, params->preamble,
|
2020-04-06 22:58:40 +00:00
|
|
|
--- a/hostapd/ctrl_iface.c
|
|
|
|
+++ b/hostapd/ctrl_iface.c
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -187,7 +187,7 @@ static int hostapd_ctrl_iface_update(str
|
2020-02-25 16:01:55 +00:00
|
|
|
iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
|
|
|
|
reload_opts = txt;
|
|
|
|
|
|
|
|
- hostapd_reload_config(iface);
|
|
|
|
+ hostapd_reload_config(iface, 0);
|
|
|
|
|
|
|
|
iface->interfaces->config_read_cb = config_read_cb;
|
|
|
|
}
|
2020-04-06 22:58:40 +00:00
|
|
|
--- a/hostapd/main.c
|
|
|
|
+++ b/hostapd/main.c
|
2023-03-13 18:35:49 +00:00
|
|
|
@@ -320,7 +320,7 @@ static void handle_term(int sig, void *s
|
2020-02-25 16:01:55 +00:00
|
|
|
|
|
|
|
static int handle_reload_iface(struct hostapd_iface *iface, void *ctx)
|
|
|
|
{
|
|
|
|
- if (hostapd_reload_config(iface) < 0) {
|
|
|
|
+ if (hostapd_reload_config(iface, 0) < 0) {
|
|
|
|
wpa_printf(MSG_WARNING, "Failed to read new configuration "
|
|
|
|
"file - continuing with old.");
|
|
|
|
}
|
2020-04-06 22:58:40 +00:00
|
|
|
--- a/src/ap/wps_hostapd.c
|
|
|
|
+++ b/src/ap/wps_hostapd.c
|
2020-05-03 13:20:52 +00:00
|
|
|
@@ -315,7 +315,7 @@ static void wps_reload_config(void *eloo
|
2020-02-25 16:01:55 +00:00
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "WPS: Reload configuration data");
|
|
|
|
if (iface->interfaces == NULL ||
|
|
|
|
- iface->interfaces->reload_config(iface) < 0) {
|
|
|
|
+ iface->interfaces->reload_config(iface, 1) < 0) {
|
|
|
|
wpa_printf(MSG_WARNING, "WPS: Failed to reload the updated "
|
|
|
|
"configuration");
|
|
|
|
}
|