1 --- a/hostapd/config_file.c
2 +++ b/hostapd/config_file.c
3 @@ -2501,6 +2501,8 @@ static int hostapd_config_fill(struct ho
4 bss->isolate = atoi(pos);
5 } else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
6 bss->ap_max_inactivity = atoi(pos);
7 + } else if (os_strcmp(buf, "config_id") == 0) {
8 + bss->config_id = os_strdup(pos);
9 } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
10 bss->skip_inactivity_poll = atoi(pos);
11 } else if (os_strcmp(buf, "country_code") == 0) {
12 @@ -3197,6 +3199,8 @@ static int hostapd_config_fill(struct ho
14 } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) {
15 conf->acs_exclude_dfs = atoi(pos);
16 + } else if (os_strcmp(buf, "radio_config_id") == 0) {
17 + conf->config_id = os_strdup(pos);
18 } else if (os_strcmp(buf, "op_class") == 0) {
19 conf->op_class = atoi(pos);
20 } else if (os_strcmp(buf, "channel") == 0) {
21 --- a/src/ap/ap_config.c
22 +++ b/src/ap/ap_config.c
23 @@ -780,6 +780,7 @@ void hostapd_config_free_bss(struct host
24 os_free(conf->radius_req_attr_sqlite);
25 os_free(conf->rsn_preauth_interfaces);
26 os_free(conf->ctrl_interface);
27 + os_free(conf->config_id);
28 os_free(conf->ca_cert);
29 os_free(conf->server_cert);
30 os_free(conf->server_cert2);
31 @@ -972,6 +973,7 @@ void hostapd_config_free(struct hostapd_
33 for (i = 0; i < conf->num_bss; i++)
34 hostapd_config_free_bss(conf->bss[i]);
35 + os_free(conf->config_id);
37 os_free(conf->supported_rates);
38 os_free(conf->basic_rates);
39 --- a/src/ap/ap_config.h
40 +++ b/src/ap/ap_config.h
41 @@ -871,6 +871,7 @@ struct hostapd_bss_config {
44 #endif /* CONFIG_MACSEC */
49 @@ -1062,6 +1063,7 @@ struct hostapd_config {
50 unsigned int airtime_update_interval;
51 #define AIRTIME_MODE_MAX (__AIRTIME_MODE_MAX - 1)
52 #endif /* CONFIG_AIRTIME_POLICY */
57 --- a/src/ap/hostapd.c
58 +++ b/src/ap/hostapd.c
59 @@ -218,6 +218,10 @@ static int hostapd_iface_conf_changed(st
63 + if (newconf->config_id != oldconf->config_id)
64 + if (strcmp(newconf->config_id, oldconf->config_id))
67 if (newconf->num_bss != oldconf->num_bss)
70 @@ -231,7 +235,7 @@ static int hostapd_iface_conf_changed(st
74 -int hostapd_reload_config(struct hostapd_iface *iface)
75 +int hostapd_reload_config(struct hostapd_iface *iface, int reconf)
77 struct hapd_interfaces *interfaces = iface->interfaces;
78 struct hostapd_data *hapd = iface->bss[0];
79 @@ -254,13 +258,16 @@ int hostapd_reload_config(struct hostapd
83 - hostapd_clear_old(iface);
85 oldconf = hapd->iconf;
86 if (hostapd_iface_conf_changed(newconf, oldconf)) {
93 + hostapd_clear_old(iface);
96 "Configuration changes include interface/BSS modification - force full disable+enable sequence");
97 fname = os_strdup(iface->config_fname);
98 @@ -285,6 +292,24 @@ int hostapd_reload_config(struct hostapd
100 "Failed to enable interface on config reload");
103 + for (j = 0; j < iface->num_bss; j++) {
104 + hapd = iface->bss[j];
105 + if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) {
106 + hostapd_flush_old_stations(iface->bss[j],
107 + WLAN_REASON_PREV_AUTH_NOT_VALID);
109 + hostapd_broadcast_wep_clear(iface->bss[j]);
112 +#ifndef CONFIG_NO_RADIUS
113 + /* TODO: update dynamic data based on changed configuration
114 + * items (e.g., open/close sockets, etc.) */
115 + radius_client_flush(iface->bss[j]->radius, 0);
116 +#endif /* CONFIG_NO_RADIUS */
117 + wpa_printf(MSG_INFO, "bss %zu changed", j);
121 iface->conf = newconf;
123 @@ -301,6 +326,12 @@ int hostapd_reload_config(struct hostapd
125 for (j = 0; j < iface->num_bss; j++) {
126 hapd = iface->bss[j];
127 + if (hapd->config_id) {
128 + os_free(hapd->config_id);
129 + hapd->config_id = NULL;
131 + if (newconf->bss[j]->config_id)
132 + hapd->config_id = strdup(newconf->bss[j]->config_id);
133 hapd->iconf = newconf;
134 hapd->conf = newconf->bss[j];
135 hostapd_reload_bss(hapd);
136 @@ -2366,6 +2397,10 @@ hostapd_alloc_bss_data(struct hostapd_if
139 hapd->iface = hapd_iface;
140 + if (bss && bss->config_id)
141 + hapd->config_id = strdup(bss->config_id);
143 + hapd->config_id = NULL;
145 hapd->driver = conf->driver;
146 hapd->ctrl_sock = -1;
147 --- a/src/ap/hostapd.h
148 +++ b/src/ap/hostapd.h
149 @@ -46,7 +46,7 @@ struct mesh_conf;
150 struct hostapd_iface;
152 struct hapd_interfaces {
153 - int (*reload_config)(struct hostapd_iface *iface);
154 + int (*reload_config)(struct hostapd_iface *iface, int reconf);
155 struct hostapd_config * (*config_read_cb)(const char *config_fname);
156 int (*ctrl_iface_init)(struct hostapd_data *hapd);
157 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
158 @@ -156,6 +156,7 @@ struct hostapd_data {
159 struct hostapd_config *iconf;
160 struct hostapd_bss_config *conf;
161 struct hostapd_ubus_bss ubus;
163 int interface_added; /* virtual interface added for this BSS */
164 unsigned int started:1;
165 unsigned int disabled:1;
166 @@ -597,7 +598,7 @@ struct hostapd_iface {
167 int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
168 int (*cb)(struct hostapd_iface *iface,
169 void *ctx), void *ctx);
170 -int hostapd_reload_config(struct hostapd_iface *iface);
171 +int hostapd_reload_config(struct hostapd_iface *iface, int reconf);
172 void hostapd_reconfig_encryption(struct hostapd_data *hapd);
173 struct hostapd_data *
174 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
175 --- a/src/drivers/driver_nl80211.c
176 +++ b/src/drivers/driver_nl80211.c
177 @@ -4493,6 +4493,9 @@ static int wpa_driver_nl80211_set_ap(voi
179 wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
180 ret, strerror(-ret));
181 + if (!bss->beacon_set)
183 + bss->beacon_set = 0;
186 nl80211_set_bss(bss, params->cts_protect, params->preamble,
187 --- a/hostapd/ctrl_iface.c
188 +++ b/hostapd/ctrl_iface.c
189 @@ -184,7 +184,7 @@ static int hostapd_ctrl_iface_update(str
190 iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
193 - hostapd_reload_config(iface);
194 + hostapd_reload_config(iface, 0);
196 iface->interfaces->config_read_cb = config_read_cb;
200 @@ -317,7 +317,7 @@ static void handle_term(int sig, void *s
202 static int handle_reload_iface(struct hostapd_iface *iface, void *ctx)
204 - if (hostapd_reload_config(iface) < 0) {
205 + if (hostapd_reload_config(iface, 0) < 0) {
206 wpa_printf(MSG_WARNING, "Failed to read new configuration "
207 "file - continuing with old.");
209 --- a/src/ap/wps_hostapd.c
210 +++ b/src/ap/wps_hostapd.c
211 @@ -315,7 +315,7 @@ static void wps_reload_config(void *eloo
213 wpa_printf(MSG_DEBUG, "WPS: Reload configuration data");
214 if (iface->interfaces == NULL ||
215 - iface->interfaces->reload_config(iface) < 0) {
216 + iface->interfaces->reload_config(iface, 1) < 0) {
217 wpa_printf(MSG_WARNING, "WPS: Failed to reload the updated "