49e7af74d837ddca0478eaba0050d9eb7d8b5790
[openwrt/staging/dedeckeh.git] / package / network / services / hostapd / patches / 200-multicall.patch
1 --- a/hostapd/Makefile
2 +++ b/hostapd/Makefile
3 @@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils)
4 export BINDIR ?= /usr/local/bin/
5
6 -include .config
7 +-include $(if $(MULTICALL), ../wpa_supplicant/.config)
8
9 ifndef CONFIG_NO_GITVER
10 # Add VERSION_STR postfix for builds from a git repository
11 @@ -315,10 +316,14 @@ CFLAGS += -DCONFIG_MBO
12 OBJS += ../src/ap/mbo_ap.o
13 endif
14
15 +ifndef MULTICALL
16 +CFLAGS += -DNO_SUPPLICANT
17 +endif
18 +
19 include ../src/drivers/drivers.mak
20 -OBJS += $(DRV_AP_OBJS)
21 -CFLAGS += $(DRV_AP_CFLAGS)
22 -LDFLAGS += $(DRV_AP_LDFLAGS)
23 +OBJS += $(sort $(DRV_AP_OBJS) $(if $(MULTICALL),$(DRV_WPA_OBJS)))
24 +CFLAGS += $(DRV_AP_CFLAGS) $(if $(MULTICALL),$(DRV_WPA_CFLAGS))
25 +LDFLAGS += $(DRV_AP_LDFLAGS) $(if $(MULTICALL),$(DRV_WPA_LDFLAGS))
26 LIBS += $(DRV_AP_LIBS)
27
28 ifdef CONFIG_L2_PACKET
29 @@ -1051,6 +1056,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
30
31 BCHECK=../src/drivers/build.hostapd
32
33 +hostapd_multi.a: $(BCHECK) $(OBJS)
34 + $(Q)$(CC) -c -o hostapd_multi.o -Dmain=hostapd_main $(CFLAGS) main.c
35 + @$(E) " CC " $<
36 + @rm -f $@
37 + @$(AR) cr $@ hostapd_multi.o $(OBJS)
38 +
39 hostapd: $(BCHECK) $(OBJS)
40 $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
41 @$(E) " LD " $@
42 @@ -1092,6 +1103,12 @@ HOBJS += ../src/crypto/aes-internal.o
43 HOBJS += ../src/crypto/aes-internal-enc.o
44 endif
45
46 +dump_cflags:
47 + @echo -n $(CFLAGS) " "
48 +
49 +dump_ldflags:
50 + @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
51 +
52 nt_password_hash: $(NOBJS)
53 $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
54 @$(E) " LD " $@
55 --- a/wpa_supplicant/Makefile
56 +++ b/wpa_supplicant/Makefile
57 @@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src)
58 CFLAGS += -I$(abspath ../src/utils)
59
60 -include .config
61 +-include $(if $(MULTICALL),../hostapd/.config)
62
63 ifndef CONFIG_NO_GITVER
64 # Add VERSION_STR postfix for builds from a git repository
65 @@ -803,6 +804,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
66 CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
67 LIBS += -ldl -rdynamic
68 endif
69 +else
70 + ifdef MULTICALL
71 + OBJS += ../src/eap_common/eap_common.o
72 + endif
73 endif
74
75 ifdef CONFIG_MACSEC
76 @@ -823,9 +828,11 @@ NEED_EAP_COMMON=y
77 NEED_RSN_AUTHENTICATOR=y
78 CFLAGS += -DCONFIG_AP
79 OBJS += ap.o
80 +ifndef MULTICALL
81 CFLAGS += -DCONFIG_NO_RADIUS
82 CFLAGS += -DCONFIG_NO_ACCOUNTING
83 CFLAGS += -DCONFIG_NO_VLAN
84 +endif
85 OBJS += ../src/ap/hostapd.o
86 OBJS += ../src/ap/wpa_auth_glue.o
87 OBJS += ../src/ap/utils.o
88 @@ -898,10 +905,18 @@ endif
89 ifdef CONFIG_HS20
90 OBJS += ../src/ap/hs20.o
91 endif
92 +else
93 + ifdef MULTICALL
94 + OBJS += ../src/eap_server/eap_server.o
95 + OBJS += ../src/eap_server/eap_server_identity.o
96 + OBJS += ../src/eap_server/eap_server_methods.o
97 + endif
98 endif
99
100 ifdef NEED_RSN_AUTHENTICATOR
101 +ifndef MULTICALL
102 CFLAGS += -DCONFIG_NO_RADIUS
103 +endif
104 NEED_AES_WRAP=y
105 OBJS += ../src/ap/wpa_auth.o
106 OBJS += ../src/ap/wpa_auth_ie.o
107 @@ -1680,6 +1695,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
108
109 $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
110
111 +wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
112 + $(Q)$(CC) -c -o wpa_supplicant_multi.o -Dmain=wpa_supplicant_main $(CFLAGS) main.c
113 + @$(E) " CC " $<
114 + @rm -f $@
115 + @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
116 +
117 wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
118 $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
119 @$(E) " LD " $@
120 @@ -1782,6 +1803,12 @@ endif
121 -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@
122 @$(E) " sed" $<
123
124 +dump_cflags:
125 + @echo -n $(CFLAGS) " "
126 +
127 +dump_ldflags:
128 + @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
129 +
130 wpa_supplicant.exe: wpa_supplicant
131 mv -f $< $@
132 wpa_cli.exe: wpa_cli
133 --- a/src/drivers/driver.h
134 +++ b/src/drivers/driver.h
135 @@ -4775,8 +4775,8 @@ union wpa_event_data {
136 * Driver wrapper code should call this function whenever an event is received
137 * from the driver.
138 */
139 -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
140 - union wpa_event_data *data);
141 +extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
142 + union wpa_event_data *data);
143
144 /**
145 * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
146 @@ -4788,7 +4788,7 @@ void wpa_supplicant_event(void *ctx, enu
147 * Same as wpa_supplicant_event(), but we search for the interface in
148 * wpa_global.
149 */
150 -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
151 +extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
152 union wpa_event_data *data);
153
154 /*
155 --- a/src/ap/drv_callbacks.c
156 +++ b/src/ap/drv_callbacks.c
157 @@ -1144,8 +1144,8 @@ static void hostapd_event_dfs_cac_starte
158 #endif /* NEED_AP_MLME */
159
160
161 -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
162 - union wpa_event_data *data)
163 +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
164 + union wpa_event_data *data)
165 {
166 struct hostapd_data *hapd = ctx;
167 #ifndef CONFIG_NO_STDOUT_DEBUG
168 @@ -1354,7 +1354,7 @@ void wpa_supplicant_event(void *ctx, enu
169 }
170
171
172 -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
173 +void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
174 union wpa_event_data *data)
175 {
176 struct hapd_interfaces *interfaces = ctx;
177 --- a/wpa_supplicant/wpa_priv.c
178 +++ b/wpa_supplicant/wpa_priv.c
179 @@ -940,8 +940,8 @@ static void wpa_priv_send_ft_response(st
180 }
181
182
183 -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
184 - union wpa_event_data *data)
185 +static void supplicant_event(void *ctx, enum wpa_event_type event,
186 + union wpa_event_data *data)
187 {
188 struct wpa_priv_interface *iface = ctx;
189
190 @@ -1010,7 +1010,7 @@ void wpa_supplicant_event(void *ctx, enu
191 }
192
193
194 -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
195 +void supplicant_event_global(void *ctx, enum wpa_event_type event,
196 union wpa_event_data *data)
197 {
198 struct wpa_priv_global *global = ctx;
199 @@ -1122,6 +1122,8 @@ int main(int argc, char *argv[])
200 if (os_program_init())
201 return -1;
202
203 + wpa_supplicant_event = supplicant_event;
204 + wpa_supplicant_event_global = supplicant_event_global;
205 wpa_priv_fd_workaround();
206
207 os_memset(&global, 0, sizeof(global));
208 --- a/wpa_supplicant/events.c
209 +++ b/wpa_supplicant/events.c
210 @@ -3375,8 +3375,8 @@ static void wpa_supplicant_event_assoc_a
211 }
212
213
214 -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
215 - union wpa_event_data *data)
216 +void supplicant_event(void *ctx, enum wpa_event_type event,
217 + union wpa_event_data *data)
218 {
219 struct wpa_supplicant *wpa_s = ctx;
220 int resched;
221 @@ -4037,7 +4037,7 @@ void wpa_supplicant_event(void *ctx, enu
222 #endif /* CONFIG_AP */
223 break;
224 case EVENT_ACS_CHANNEL_SELECTED:
225 -#ifdef CONFIG_ACS
226 +#if defined(CONFIG_ACS) && defined(CONFIG_AP)
227 if (!wpa_s->ap_iface)
228 break;
229 hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0],
230 @@ -4051,7 +4051,7 @@ void wpa_supplicant_event(void *ctx, enu
231 }
232
233
234 -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
235 +void supplicant_event_global(void *ctx, enum wpa_event_type event,
236 union wpa_event_data *data)
237 {
238 struct wpa_supplicant *wpa_s;
239 --- a/wpa_supplicant/wpa_supplicant.c
240 +++ b/wpa_supplicant/wpa_supplicant.c
241 @@ -4967,7 +4967,6 @@ struct wpa_interface * wpa_supplicant_ma
242 return NULL;
243 }
244
245 -
246 /**
247 * wpa_supplicant_match_existing - Match existing interfaces
248 * @global: Pointer to global data from wpa_supplicant_init()
249 @@ -5004,6 +5003,11 @@ static int wpa_supplicant_match_existing
250
251 #endif /* CONFIG_MATCH_IFACE */
252
253 +extern void supplicant_event(void *ctx, enum wpa_event_type event,
254 + union wpa_event_data *data);
255 +
256 +extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
257 + union wpa_event_data *data);
258
259 /**
260 * wpa_supplicant_add_iface - Add a new network interface
261 @@ -5259,6 +5263,8 @@ struct wpa_global * wpa_supplicant_init(
262 #ifndef CONFIG_NO_WPA_MSG
263 wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
264 #endif /* CONFIG_NO_WPA_MSG */
265 + wpa_supplicant_event = supplicant_event;
266 + wpa_supplicant_event_global = supplicant_event_global;
267
268 if (params->wpa_debug_file_path)
269 wpa_debug_open_file(params->wpa_debug_file_path);
270 --- a/hostapd/main.c
271 +++ b/hostapd/main.c
272 @@ -526,6 +526,11 @@ static int hostapd_get_ctrl_iface_group(
273 return 0;
274 }
275
276 +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
277 + union wpa_event_data *data);
278 +
279 +void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
280 + union wpa_event_data *data);
281
282 #ifdef CONFIG_WPS
283 static int gen_uuid(const char *txt_addr)
284 @@ -601,6 +606,8 @@ int main(int argc, char *argv[])
285 interfaces.global_ctrl_sock = -1;
286 dl_list_init(&interfaces.global_ctrl_dst);
287
288 + wpa_supplicant_event = hostapd_wpa_event;
289 + wpa_supplicant_event_global = hostapd_wpa_event_global;
290 for (;;) {
291 c = getopt(argc, argv, "b:Bde:f:hKP:STtu:vg:G:");
292 if (c < 0)
293 --- a/src/drivers/drivers.c
294 +++ b/src/drivers/drivers.c
295 @@ -10,6 +10,11 @@
296 #include "utils/common.h"
297 #include "driver.h"
298
299 +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
300 + union wpa_event_data *data);
301 +void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
302 + union wpa_event_data *data);
303 +
304 #ifdef CONFIG_DRIVER_WEXT
305 extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
306 #endif /* CONFIG_DRIVER_WEXT */
307 --- a/wpa_supplicant/eapol_test.c
308 +++ b/wpa_supplicant/eapol_test.c
309 @@ -29,7 +29,12 @@
310 #include "ctrl_iface.h"
311 #include "pcsc_funcs.h"
312 #include "wpas_glue.h"
313 +#include "drivers/driver.h"
314
315 +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
316 + union wpa_event_data *data);
317 +void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
318 + union wpa_event_data *data);
319
320 const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
321
322 @@ -1295,6 +1300,10 @@ static void usage(void)
323 "option several times.\n");
324 }
325
326 +extern void supplicant_event(void *ctx, enum wpa_event_type event,
327 + union wpa_event_data *data);
328 +extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
329 + union wpa_event_data *data);
330
331 int main(int argc, char *argv[])
332 {
333 @@ -1315,6 +1324,8 @@ int main(int argc, char *argv[])
334 if (os_program_init())
335 return -1;
336
337 + wpa_supplicant_event = supplicant_event;
338 + wpa_supplicant_event_global = supplicant_event_global;
339 hostapd_logger_register_cb(hostapd_logger_cb);
340
341 os_memset(&eapol_test, 0, sizeof(eapol_test));