1 --- a/hostapd/config_file.c
2 +++ b/hostapd/config_file.c
3 @@ -2420,6 +2420,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, "config_id") == 0) {
12 @@ -3130,6 +3132,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 @@ -998,6 +998,7 @@ void hostapd_config_free(struct hostapd_
25 for (i = 0; i < conf->num_bss; i++)
26 hostapd_config_free_bss(conf->bss[i]);
27 + os_free(conf->config_id);
29 os_free(conf->supported_rates);
30 os_free(conf->basic_rates);
31 --- a/src/ap/ap_config.h
32 +++ b/src/ap/ap_config.h
33 @@ -998,6 +998,7 @@ struct eht_phy_capabilities_info {
34 struct hostapd_config {
35 struct hostapd_bss_config **bss, *last_bss;
41 --- a/src/ap/hostapd.c
42 +++ b/src/ap/hostapd.c
43 @@ -127,7 +127,7 @@ void hostapd_reconfig_encryption(struct
47 -static void hostapd_reload_bss(struct hostapd_data *hapd)
48 +void hostapd_reload_bss(struct hostapd_data *hapd)
50 struct hostapd_ssid *ssid;
52 @@ -255,6 +255,10 @@ static int hostapd_iface_conf_changed(st
56 + if (newconf->config_id != oldconf->config_id)
57 + if (strcmp(newconf->config_id, oldconf->config_id))
60 if (newconf->num_bss != oldconf->num_bss)
63 @@ -268,7 +272,7 @@ static int hostapd_iface_conf_changed(st
67 -int hostapd_reload_config(struct hostapd_iface *iface)
68 +int hostapd_reload_config(struct hostapd_iface *iface, int reconf)
70 struct hapd_interfaces *interfaces = iface->interfaces;
71 struct hostapd_data *hapd = iface->bss[0];
72 @@ -298,6 +302,9 @@ int hostapd_reload_config(struct hostapd
79 hostapd_clear_old(iface);
82 @@ -324,6 +331,24 @@ int hostapd_reload_config(struct hostapd
84 "Failed to enable interface on config reload");
87 + for (j = 0; j < iface->num_bss; j++) {
88 + hapd = iface->bss[j];
89 + if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) {
90 + hostapd_flush_old_stations(iface->bss[j],
91 + WLAN_REASON_PREV_AUTH_NOT_VALID);
93 + hostapd_broadcast_wep_clear(iface->bss[j]);
96 +#ifndef CONFIG_NO_RADIUS
97 + /* TODO: update dynamic data based on changed configuration
98 + * items (e.g., open/close sockets, etc.) */
99 + radius_client_flush(iface->bss[j]->radius, 0);
100 +#endif /* CONFIG_NO_RADIUS */
101 + wpa_printf(MSG_INFO, "bss %zu changed", j);
105 iface->conf = newconf;
107 @@ -340,6 +365,12 @@ int hostapd_reload_config(struct hostapd
109 for (j = 0; j < iface->num_bss; j++) {
110 hapd = iface->bss[j];
111 + if (hapd->config_id) {
112 + os_free(hapd->config_id);
113 + hapd->config_id = NULL;
115 + if (newconf->bss[j]->config_id)
116 + hapd->config_id = strdup(newconf->bss[j]->config_id);
117 if (!hapd->conf->config_id || !newconf->bss[j]->config_id ||
118 os_strcmp(hapd->conf->config_id,
119 newconf->bss[j]->config_id) != 0)
120 @@ -1236,8 +1267,7 @@ static int hostapd_start_beacon(struct h
121 * initialized. Most of the modules that are initialized here will be
122 * deinitialized in hostapd_cleanup().
124 -static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
126 +int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
128 struct hostapd_bss_config *conf = hapd->conf;
129 u8 ssid[SSID_MAX_LEN + 1];
130 @@ -2705,6 +2735,10 @@ hostapd_alloc_bss_data(struct hostapd_if
133 hapd->iface = hapd_iface;
134 + if (bss && bss->config_id)
135 + hapd->config_id = strdup(bss->config_id);
137 + hapd->config_id = NULL;
139 hapd->driver = conf->driver;
140 hapd->ctrl_sock = -1;
141 @@ -2723,7 +2757,7 @@ hostapd_alloc_bss_data(struct hostapd_if
145 -static void hostapd_bss_deinit(struct hostapd_data *hapd)
146 +void hostapd_bss_deinit(struct hostapd_data *hapd)
150 --- a/src/ap/hostapd.h
151 +++ b/src/ap/hostapd.h
152 @@ -48,7 +48,7 @@ struct mesh_conf;
153 struct hostapd_iface;
155 struct hapd_interfaces {
156 - int (*reload_config)(struct hostapd_iface *iface);
157 + int (*reload_config)(struct hostapd_iface *iface, int reconf);
158 struct hostapd_config * (*config_read_cb)(const char *config_fname);
159 int (*ctrl_iface_init)(struct hostapd_data *hapd);
160 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
161 @@ -192,6 +192,7 @@ struct hostapd_data {
162 struct hostapd_bss_config *conf;
163 struct hostapd_ubus_bss ubus;
164 struct hostapd_ucode_bss ucode;
166 int interface_added; /* virtual interface added for this BSS */
167 unsigned int started:1;
168 unsigned int disabled:1;
169 @@ -696,7 +697,9 @@ struct hostapd_iface {
170 int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
171 int (*cb)(struct hostapd_iface *iface,
172 void *ctx), void *ctx);
173 -int hostapd_reload_config(struct hostapd_iface *iface);
174 +int hostapd_reload_config(struct hostapd_iface *iface, int reconf);
175 +void hostapd_reload_bss(struct hostapd_data *hapd);
176 +void hostapd_bss_deinit(struct hostapd_data *hapd);
177 void hostapd_reconfig_encryption(struct hostapd_data *hapd);
178 struct hostapd_data *
179 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
180 @@ -713,6 +716,7 @@ struct hostapd_iface * hostapd_init(stru
181 struct hostapd_iface *
182 hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
183 const char *config_fname, int debug);
184 +int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon);
185 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
187 void hostapd_interface_deinit_free(struct hostapd_iface *iface);
188 --- a/src/drivers/driver_nl80211.c
189 +++ b/src/drivers/driver_nl80211.c
190 @@ -5322,6 +5322,9 @@ static int wpa_driver_nl80211_set_ap(voi
192 wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
193 ret, strerror(-ret));
194 + if (!bss->flink->beacon_set)
196 + bss->flink->beacon_set = 0;
198 link->beacon_set = 1;
199 nl80211_set_bss(bss, params->cts_protect, params->preamble,
200 --- a/hostapd/ctrl_iface.c
201 +++ b/hostapd/ctrl_iface.c
202 @@ -187,7 +187,7 @@ static int hostapd_ctrl_iface_update(str
203 iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
206 - hostapd_reload_config(iface);
207 + hostapd_reload_config(iface, 0);
209 iface->interfaces->config_read_cb = config_read_cb;
213 @@ -410,7 +410,7 @@ static void handle_term(int sig, void *s
215 static int handle_reload_iface(struct hostapd_iface *iface, void *ctx)
217 - if (hostapd_reload_config(iface) < 0) {
218 + if (hostapd_reload_config(iface, 0) < 0) {
219 wpa_printf(MSG_WARNING, "Failed to read new configuration "
220 "file - continuing with old.");
222 --- a/src/ap/wps_hostapd.c
223 +++ b/src/ap/wps_hostapd.c
224 @@ -315,7 +315,7 @@ static void wps_reload_config(void *eloo
226 wpa_printf(MSG_DEBUG, "WPS: Reload configuration data");
227 if (iface->interfaces == NULL ||
228 - iface->interfaces->reload_config(iface) < 0) {
229 + iface->interfaces->reload_config(iface, 1) < 0) {
230 wpa_printf(MSG_WARNING, "WPS: Failed to reload the updated "