3 @@ -168,9 +168,21 @@ OBJS += ../src/eapol_auth/eapol_auth_sm.
6 CFLAGS += -DUBUS_SUPPORT
7 -OBJS += ../src/utils/uloop.o
8 OBJS += ../src/ap/ubus.o
15 +CFLAGS += -DUCODE_SUPPORT
16 +OBJS += ../src/utils/ucode.o
17 +OBJS += ../src/ap/ucode.o
22 +OBJS += ../src/utils/uloop.o
26 ifdef CONFIG_CODE_COVERAGE
29 @@ -991,6 +991,7 @@ int main(int argc, char *argv[])
32 hostapd_global_ctrl_iface_init(&interfaces);
33 + hostapd_ucode_init(&interfaces);
35 if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
36 wpa_printf(MSG_ERROR, "Failed to start eloop");
37 @@ -1000,6 +1001,7 @@ int main(int argc, char *argv[])
41 + hostapd_ucode_free();
42 hostapd_global_ctrl_iface_deinit(&interfaces);
43 /* Deinitialize all interfaces */
44 for (i = 0; i < interfaces.count; i++) {
45 --- a/src/ap/hostapd.h
46 +++ b/src/ap/hostapd.h
48 #include "ap_config.h"
49 #include "drivers/driver.h"
53 #define OCE_STA_CFON_ENABLED(hapd) \
54 ((hapd->conf->oce & OCE_STA_CFON) && \
55 @@ -51,6 +52,10 @@ struct hapd_interfaces {
56 struct hostapd_config * (*config_read_cb)(const char *config_fname);
57 int (*ctrl_iface_init)(struct hostapd_data *hapd);
58 void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
59 + int (*ctrl_iface_recv)(struct hostapd_data *hapd,
60 + char *buf, char *reply, int reply_size,
61 + struct sockaddr_storage *from,
63 int (*for_each_interface)(struct hapd_interfaces *interfaces,
64 int (*cb)(struct hostapd_iface *iface,
65 void *ctx), void *ctx);
66 @@ -186,6 +191,7 @@ struct hostapd_data {
67 struct hostapd_config *iconf;
68 struct hostapd_bss_config *conf;
69 struct hostapd_ubus_bss ubus;
70 + struct hostapd_ucode_bss ucode;
71 int interface_added; /* virtual interface added for this BSS */
72 unsigned int started:1;
73 unsigned int disabled:1;
74 @@ -506,6 +512,7 @@ struct hostapd_sta_info {
76 struct hostapd_iface {
77 struct hapd_interfaces *interfaces;
78 + struct hostapd_ucode_iface ucode;
81 struct hostapd_config *conf;
82 --- a/src/ap/hostapd.c
83 +++ b/src/ap/hostapd.c
84 @@ -276,6 +276,8 @@ int hostapd_reload_config(struct hostapd
88 + hostapd_ucode_reload_bss(hapd, reconf);
90 if (iface->config_fname == NULL) {
91 /* Only in-memory config in use - assume it has been updated */
92 hostapd_clear_old(iface);
93 @@ -455,6 +457,7 @@ void hostapd_free_hapd_data(struct hosta
94 hapd->beacon_set_done = 0;
96 wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
97 + hostapd_ucode_free_bss(hapd);
98 hostapd_ubus_free_bss(hapd);
99 accounting_deinit(hapd);
100 hostapd_deinit_wpa(hapd);
101 @@ -619,6 +622,7 @@ void hostapd_cleanup_iface_partial(struc
102 static void hostapd_cleanup_iface(struct hostapd_iface *iface)
104 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
105 + hostapd_ucode_free_iface(iface);
106 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
107 eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
109 @@ -1209,6 +1213,7 @@ static int hostapd_start_beacon(struct h
110 hapd->driver->set_operstate(hapd->drv_priv, 1);
112 hostapd_ubus_add_bss(hapd);
113 + hostapd_ucode_add_bss(hapd);
117 --- a/wpa_supplicant/Makefile
118 +++ b/wpa_supplicant/Makefile
119 @@ -197,8 +197,20 @@ endif
121 CFLAGS += -DUBUS_SUPPORT
128 +CFLAGS += -DUCODE_SUPPORT
129 +OBJS += ../src/utils/ucode.o
135 OBJS += ../src/utils/uloop.o
136 -LIBS += -lubox -lubus
140 ifdef CONFIG_CODE_COVERAGE
141 @@ -999,6 +1011,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o
143 OBJS += ../src/ap/ubus.o
146 +OBJS += ../src/ap/ucode.o
150 CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
151 --- a/wpa_supplicant/wpa_supplicant.c
152 +++ b/wpa_supplicant/wpa_supplicant.c
153 @@ -7636,6 +7636,7 @@ struct wpa_supplicant * wpa_supplicant_a
154 #endif /* CONFIG_P2P */
156 wpas_ubus_add_bss(wpa_s);
157 + wpas_ucode_add_bss(wpa_s);
161 @@ -7663,6 +7664,7 @@ int wpa_supplicant_remove_iface(struct w
162 struct wpa_supplicant *parent = wpa_s->parent;
163 #endif /* CONFIG_MESH */
165 + wpas_ucode_free_bss(wpa_s);
166 wpas_ubus_free_bss(wpa_s);
168 /* Remove interface from the global list of interfaces */
169 @@ -7973,6 +7975,7 @@ struct wpa_global * wpa_supplicant_init(
171 eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0,
172 wpas_periodic, global, NULL);
173 + wpas_ucode_init(global);
177 @@ -8011,12 +8014,8 @@ int wpa_supplicant_run(struct wpa_global
178 eloop_register_signal_terminate(wpa_supplicant_terminate, global);
179 eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
181 - wpas_ubus_add(global);
185 - wpas_ubus_free(global);
190 @@ -8049,6 +8048,8 @@ void wpa_supplicant_deinit(struct wpa_gl
192 wpas_notify_supplicant_deinitialized(global);
196 eap_peer_unregister_methods();
198 eap_server_unregister_methods();
199 --- a/wpa_supplicant/wpa_supplicant_i.h
200 +++ b/wpa_supplicant/wpa_supplicant_i.h
203 #include "pasn/pasn_common.h"
207 extern const char *const wpa_supplicant_version;
208 extern const char *const wpa_supplicant_license;
209 @@ -659,6 +660,7 @@ struct wpa_supplicant {
210 unsigned char perm_addr[ETH_ALEN];
212 struct wpas_ubus_bss ubus;
213 + struct wpas_ucode_bss ucode;
214 #ifdef CONFIG_MATCH_IFACE
216 #endif /* CONFIG_MATCH_IFACE */
217 --- a/hostapd/ctrl_iface.c
218 +++ b/hostapd/ctrl_iface.c
219 @@ -4921,6 +4921,7 @@ try_again:
223 + interface->ctrl_iface_recv = hostapd_ctrl_iface_receive_process;
224 wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
227 @@ -5022,6 +5023,7 @@ fail:
230 interface->global_ctrl_sock = s;
231 + interface->ctrl_iface_recv = hostapd_ctrl_iface_receive_process;
232 eloop_register_read_sock(s, hostapd_global_ctrl_iface_receive,