hostapd: fix mesh supplicant build error
[openwrt/staging/hauke.git] / package / network / services / hostapd / patches / 601-ucode_support.patch
1 --- a/hostapd/Makefile
2 +++ b/hostapd/Makefile
3 @@ -168,9 +168,21 @@ OBJS += ../src/eapol_auth/eapol_auth_sm.
4
5 ifdef CONFIG_UBUS
6 CFLAGS += -DUBUS_SUPPORT
7 -OBJS += ../src/utils/uloop.o
8 OBJS += ../src/ap/ubus.o
9 -LIBS += -lubox -lubus
10 +LIBS += -lubus
11 +NEED_ULOOP:=y
12 +endif
13 +
14 +ifdef CONFIG_UCODE
15 +CFLAGS += -DUCODE_SUPPORT
16 +OBJS += ../src/utils/ucode.o
17 +OBJS += ../src/ap/ucode.o
18 +NEED_ULOOP:=y
19 +endif
20 +
21 +ifdef NEED_ULOOP
22 +OBJS += ../src/utils/uloop.o
23 +LIBS += -lubox
24 endif
25
26 ifdef CONFIG_CODE_COVERAGE
27 --- a/hostapd/main.c
28 +++ b/hostapd/main.c
29 @@ -991,6 +991,7 @@ int main(int argc, char *argv[])
30 }
31
32 hostapd_global_ctrl_iface_init(&interfaces);
33 + hostapd_ucode_init(&interfaces);
34
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[])
38 ret = 0;
39
40 out:
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
47 @@ -19,6 +19,7 @@
48 #include "ap_config.h"
49 #include "drivers/driver.h"
50 #include "ubus.h"
51 +#include "ucode.h"
52
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,
62 + socklen_t fromlen);
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 {
75 */
76 struct hostapd_iface {
77 struct hapd_interfaces *interfaces;
78 + struct hostapd_ucode_iface ucode;
79 void *owner;
80 char *config_fname;
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
85 size_t j;
86 int i;
87
88 + hostapd_ucode_reload_bss(hapd, reconf);
89 +
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;
95
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)
103 {
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,
108 NULL);
109 @@ -1209,6 +1213,7 @@ static int hostapd_start_beacon(struct h
110 hapd->driver->set_operstate(hapd->drv_priv, 1);
111
112 hostapd_ubus_add_bss(hapd);
113 + hostapd_ucode_add_bss(hapd);
114
115 return 0;
116 }
117 --- a/wpa_supplicant/Makefile
118 +++ b/wpa_supplicant/Makefile
119 @@ -197,8 +197,20 @@ endif
120 ifdef CONFIG_UBUS
121 CFLAGS += -DUBUS_SUPPORT
122 OBJS += ubus.o
123 +LIBS += -lubus
124 +NEED_ULOOP:=y
125 +endif
126 +
127 +ifdef CONFIG_UCODE
128 +CFLAGS += -DUCODE_SUPPORT
129 +OBJS += ../src/utils/ucode.o
130 +OBJS += ucode.o
131 +NEED_ULOOP:=y
132 +endif
133 +
134 +ifdef NEED_ULOOP
135 OBJS += ../src/utils/uloop.o
136 -LIBS += -lubox -lubus
137 +LIBS += -lubox
138 endif
139
140 ifdef CONFIG_CODE_COVERAGE
141 @@ -999,6 +1011,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o
142 ifdef CONFIG_UBUS
143 OBJS += ../src/ap/ubus.o
144 endif
145 +ifdef CONFIG_UCODE
146 +OBJS += ../src/ap/ucode.o
147 +endif
148 endif
149
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 */
155
156 wpas_ubus_add_bss(wpa_s);
157 + wpas_ucode_add_bss(wpa_s);
158
159 return wpa_s;
160 }
161 @@ -7663,6 +7664,7 @@ int wpa_supplicant_remove_iface(struct w
162 struct wpa_supplicant *parent = wpa_s->parent;
163 #endif /* CONFIG_MESH */
164
165 + wpas_ucode_free_bss(wpa_s);
166 wpas_ubus_free_bss(wpa_s);
167
168 /* Remove interface from the global list of interfaces */
169 @@ -7973,6 +7975,7 @@ struct wpa_global * wpa_supplicant_init(
170
171 eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0,
172 wpas_periodic, global, NULL);
173 + wpas_ucode_init(global);
174
175 return global;
176 }
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);
180
181 - wpas_ubus_add(global);
182 -
183 eloop_run();
184
185 - wpas_ubus_free(global);
186 -
187 return 0;
188 }
189
190 @@ -8049,6 +8048,8 @@ void wpa_supplicant_deinit(struct wpa_gl
191
192 wpas_notify_supplicant_deinitialized(global);
193
194 + wpas_ucode_free();
195 +
196 eap_peer_unregister_methods();
197 #ifdef CONFIG_AP
198 eap_server_unregister_methods();
199 --- a/wpa_supplicant/wpa_supplicant_i.h
200 +++ b/wpa_supplicant/wpa_supplicant_i.h
201 @@ -22,6 +22,7 @@
202 #include "wmm_ac.h"
203 #include "pasn/pasn_common.h"
204 #include "ubus.h"
205 +#include "ucode.h"
206
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];
211 char ifname[100];
212 struct wpas_ubus_bss ubus;
213 + struct wpas_ucode_bss ucode;
214 #ifdef CONFIG_MATCH_IFACE
215 int matched;
216 #endif /* CONFIG_MATCH_IFACE */
217 --- a/hostapd/ctrl_iface.c
218 +++ b/hostapd/ctrl_iface.c
219 @@ -4921,6 +4921,7 @@ try_again:
220 return -1;
221 }
222
223 + interface->ctrl_iface_recv = hostapd_ctrl_iface_receive_process;
224 wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
225
226 return 0;
227 @@ -5022,6 +5023,7 @@ fail:
228 os_free(fname);
229
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,
233 interface, NULL);
234