200-multicall.patch 10 KB

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