aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/hostapd/patches/700-wifi-reload.patch
blob: b21ae8545131e6c695b4af7a9783cc03cd7369bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2470,6 +2470,8 @@ static int hostapd_config_fill(struct ho
 		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);
 	} else if (os_strcmp(buf, "country_code") == 0) {
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -698,6 +698,7 @@ void hostapd_config_free_bss(struct host
 	os_free(conf->radius_req_attr_sqlite);
 	os_free(conf->rsn_preauth_interfaces);
 	os_free(conf->ctrl_interface);
+	os_free(conf->config_id);
 	os_free(conf->ca_cert);
 	os_free(conf->server_cert);
 	os_free(conf->server_cert2);
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -829,6 +829,7 @@ struct hostapd_bss_config {
 	 */
 	u8 mka_psk_set;
 #endif /* CONFIG_MACSEC */
+	char *config_id;
 };
 
 /**
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -242,13 +242,13 @@ int hostapd_reload_config(struct hostapd
 	if (newconf == NULL)
 		return -1;
 
-	hostapd_clear_old(iface);
-
 	oldconf = hapd->iconf;
 	if (hostapd_iface_conf_changed(newconf, oldconf)) {
 		char *fname;
 		int res;
 
+		hostapd_clear_old(iface);
+
 		wpa_printf(MSG_DEBUG,
 			   "Configuration changes include interface/BSS modification - force full disable+enable sequence");
 		fname = os_strdup(iface->config_fname);
@@ -273,6 +273,22 @@ int hostapd_reload_config(struct hostapd
 			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);
+				hostapd_broadcast_wep_clear(iface->bss[j]);
+
+#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 */
+				wpa_printf(MSG_INFO, "bss %d changed", j);
+			}
+		}
 	}
 	iface->conf = newconf;
 
@@ -289,6 +305,12 @@ int hostapd_reload_config(struct hostapd
 
 	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);
 		hapd->iconf = newconf;
 		hapd->conf = newconf->bss[j];
 		hostapd_reload_bss(hapd);
@@ -2257,6 +2279,10 @@ hostapd_alloc_bss_data(struct hostapd_if
 	hapd->iconf = conf;
 	hapd->conf = bss;
 	hapd->iface = hapd_iface;
+	if (bss && bss->config_id)
+		hapd->config_id = strdup(bss->config_id);
+	else
+		hapd->config_id = NULL;
 	if (conf)
 		hapd->driver = conf->driver;
 	hapd->ctrl_sock = -1;
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -149,6 +149,7 @@ struct hostapd_data {
 	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;
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4295,6 +4295,9 @@ static int wpa_driver_nl80211_set_ap(voi
 	if (ret) {
 		wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
 			   ret, strerror(-ret));
+		if (!bss->beacon_set)
+			ret = 0;
+		bss->beacon_set = 0;
 	} else {
 		bss->beacon_set = 1;
 		nl80211_set_bss(bss, params->cts_protect, params->preamble,