hostapd: initial prototype of an ubus binding
[openwrt/svn-archive/archive.git] / package / network / services / hostapd / patches / 410-multicall.patch
1 --- a/hostapd/Makefile
2 +++ b/hostapd/Makefile
3 @@ -14,6 +14,7 @@ CFLAGS += -I../src/utils
4 # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
5
6 -include .config
7 +-include $(if $(MULTICALL), ../wpa_supplicant/.config)
8
9 ifndef CONFIG_OS
10 ifdef CONFIG_NATIVE_WINDOWS
11 @@ -192,10 +193,14 @@ ifdef CONFIG_IEEE80211AC
12 CFLAGS += -DCONFIG_IEEE80211AC
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 @@ -860,6 +865,12 @@ install: all
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 @@ -898,6 +909,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 @@ -14,6 +14,7 @@ CFLAGS += -I../src
58 CFLAGS += -I../src/utils
59
60 -include .config
61 +-include $(if $(MULTICALL),../hostapd/.config)
62
63 BINALL=wpa_supplicant wpa_cli
64
65 @@ -704,6 +705,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_AP
76 @@ -712,9 +717,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 @@ -769,10 +776,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 @@ -1521,6 +1536,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 @@ -1591,6 +1612,12 @@ eap_ikev2.so: ../src/eap_peer/eap_ikev2.
121 %@.service: %.service.arg.in
122 sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
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 @@ -3726,8 +3726,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 /*
146 --- a/src/ap/drv_callbacks.c
147 +++ b/src/ap/drv_callbacks.c
148 @@ -714,8 +714,8 @@ static void hostapd_event_eapol_rx(struc
149 }
150
151
152 -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
153 - union wpa_event_data *data)
154 +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
155 + union wpa_event_data *data)
156 {
157 struct hostapd_data *hapd = ctx;
158 #ifndef CONFIG_NO_STDOUT_DEBUG
159 --- a/wpa_supplicant/wpa_priv.c
160 +++ b/wpa_supplicant/wpa_priv.c
161 @@ -819,8 +819,8 @@ static void wpa_priv_send_ft_response(st
162 }
163
164
165 -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
166 - union wpa_event_data *data)
167 +static void supplicant_event(void *ctx, enum wpa_event_type event,
168 + union wpa_event_data *data)
169 {
170 struct wpa_priv_interface *iface = ctx;
171
172 @@ -962,6 +962,7 @@ int main(int argc, char *argv[])
173 if (os_program_init())
174 return -1;
175
176 + wpa_supplicant_event = supplicant_event;
177 wpa_priv_fd_workaround();
178
179 for (;;) {
180 --- a/wpa_supplicant/events.c
181 +++ b/wpa_supplicant/events.c
182 @@ -2333,8 +2333,8 @@ static void wpa_supplicant_event_unprot_
183 }
184
185
186 -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
187 - union wpa_event_data *data)
188 +void supplicant_event(void *ctx, enum wpa_event_type event,
189 + union wpa_event_data *data)
190 {
191 struct wpa_supplicant *wpa_s = ctx;
192 u16 reason_code = 0;
193 --- a/wpa_supplicant/wpa_supplicant.c
194 +++ b/wpa_supplicant/wpa_supplicant.c
195 @@ -2972,6 +2972,9 @@ static void wpa_supplicant_deinit_iface(
196 }
197 }
198
199 +extern void supplicant_event(void *ctx, enum wpa_event_type event,
200 + union wpa_event_data *data);
201 +
202
203 /**
204 * wpa_supplicant_add_iface - Add a new network interface
205 @@ -3164,6 +3167,7 @@ struct wpa_global * wpa_supplicant_init(
206 wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
207 #endif /* CONFIG_NO_WPA_MSG */
208
209 + wpa_supplicant_event = supplicant_event;
210 wpa_debug_open_file(params->wpa_debug_file_path);
211 if (params->wpa_debug_syslog)
212 wpa_debug_open_syslog();
213 --- a/hostapd/main.c
214 +++ b/hostapd/main.c
215 @@ -530,6 +530,9 @@ static int hostapd_get_global_ctrl_iface
216 return 0;
217 }
218
219 +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
220 + union wpa_event_data *data);
221 +
222
223 int main(int argc, char *argv[])
224 {
225 @@ -555,6 +558,7 @@ int main(int argc, char *argv[])
226 interfaces.global_iface_name = NULL;
227 interfaces.global_ctrl_sock = -1;
228
229 + wpa_supplicant_event = hostapd_wpa_event;
230 for (;;) {
231 c = getopt(argc, argv, "Bde:f:hKP:tvg:");
232 if (c < 0)
233 --- a/src/drivers/drivers.c
234 +++ b/src/drivers/drivers.c
235 @@ -7,7 +7,11 @@
236 */
237
238 #include "includes.h"
239 +#include "common.h"
240 +#include "driver.h"
241
242 +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
243 + union wpa_event_data *data);
244
245 #ifdef CONFIG_DRIVER_WEXT
246 extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */