200-multicall.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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. @@ -198,7 +199,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. @@ -330,10 +332,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. @@ -1077,6 +1083,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. @@ -1118,6 +1130,12 @@ HOBJS += ../src/crypto/aes-internal.o
  46. HOBJS += ../src/crypto/aes-internal-enc.o
  47. endif
  48. +dump_cflags:
  49. + @printf "%s " "$(CFLAGS)"
  50. +
  51. +dump_ldflags:
  52. + @printf "%s " "$(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. @@ -329,7 +330,9 @@ endif
  66. ifdef CONFIG_IBSS_RSN
  67. NEED_RSN_AUTHENTICATOR=y
  68. CFLAGS += -DCONFIG_IBSS_RSN
  69. +ifndef MULTICALL
  70. CFLAGS += -DCONFIG_NO_VLAN
  71. +endif
  72. OBJS += ibss_rsn.o
  73. endif
  74. @@ -820,6 +823,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  75. CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
  76. LIBS += -ldl -rdynamic
  77. endif
  78. +else
  79. + ifdef MULTICALL
  80. + OBJS += ../src/eap_common/eap_common.o
  81. + endif
  82. endif
  83. ifdef CONFIG_MACSEC
  84. @@ -840,9 +847,11 @@ NEED_EAP_COMMON=y
  85. NEED_RSN_AUTHENTICATOR=y
  86. CFLAGS += -DCONFIG_AP
  87. OBJS += ap.o
  88. +ifndef MULTICALL
  89. CFLAGS += -DCONFIG_NO_RADIUS
  90. CFLAGS += -DCONFIG_NO_ACCOUNTING
  91. CFLAGS += -DCONFIG_NO_VLAN
  92. +endif
  93. OBJS += ../src/ap/hostapd.o
  94. OBJS += ../src/ap/wpa_auth_glue.o
  95. OBJS += ../src/ap/utils.o
  96. @@ -910,6 +919,12 @@ endif
  97. ifdef CONFIG_HS20
  98. OBJS += ../src/ap/hs20.o
  99. endif
  100. +else
  101. + ifdef MULTICALL
  102. + OBJS += ../src/eap_server/eap_server.o
  103. + OBJS += ../src/eap_server/eap_server_identity.o
  104. + OBJS += ../src/eap_server/eap_server_methods.o
  105. + endif
  106. endif
  107. ifdef CONFIG_MBO
  108. @@ -918,7 +933,9 @@ CFLAGS += -DCONFIG_MBO
  109. endif
  110. ifdef NEED_RSN_AUTHENTICATOR
  111. +ifndef MULTICALL
  112. CFLAGS += -DCONFIG_NO_RADIUS
  113. +endif
  114. NEED_AES_WRAP=y
  115. OBJS += ../src/ap/wpa_auth.o
  116. OBJS += ../src/ap/wpa_auth_ie.o
  117. @@ -1706,6 +1723,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  118. $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
  119. +wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
  120. + $(Q)$(CC) -c -o wpa_supplicant_multi.o -Dmain=wpa_supplicant_main $(CFLAGS) main.c
  121. + @$(E) " CC " $<
  122. + @rm -f $@
  123. + @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
  124. +
  125. wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
  126. $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
  127. @$(E) " LD " $@
  128. @@ -1808,6 +1831,12 @@ endif
  129. -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@
  130. @$(E) " sed" $<
  131. +dump_cflags:
  132. + @printf "%s " "$(CFLAGS)"
  133. +
  134. +dump_ldflags:
  135. + @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
  136. +
  137. wpa_supplicant.exe: wpa_supplicant
  138. mv -f $< $@
  139. wpa_cli.exe: wpa_cli
  140. --- a/src/drivers/driver.h
  141. +++ b/src/drivers/driver.h
  142. @@ -4968,8 +4968,8 @@ union wpa_event_data {
  143. * Driver wrapper code should call this function whenever an event is received
  144. * from the driver.
  145. */
  146. -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
  147. - union wpa_event_data *data);
  148. +extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  149. + union wpa_event_data *data);
  150. /**
  151. * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
  152. @@ -4981,7 +4981,7 @@ void wpa_supplicant_event(void *ctx, enu
  153. * Same as wpa_supplicant_event(), but we search for the interface in
  154. * wpa_global.
  155. */
  156. -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  157. +extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  158. union wpa_event_data *data);
  159. /*
  160. --- a/src/ap/drv_callbacks.c
  161. +++ b/src/ap/drv_callbacks.c
  162. @@ -1163,8 +1163,8 @@ static void hostapd_event_dfs_cac_starte
  163. #endif /* NEED_AP_MLME */
  164. -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
  165. - union wpa_event_data *data)
  166. +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
  167. + union wpa_event_data *data)
  168. {
  169. struct hostapd_data *hapd = ctx;
  170. #ifndef CONFIG_NO_STDOUT_DEBUG
  171. @@ -1373,7 +1373,7 @@ void wpa_supplicant_event(void *ctx, enu
  172. }
  173. -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  174. +void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  175. union wpa_event_data *data)
  176. {
  177. struct hapd_interfaces *interfaces = ctx;
  178. --- a/wpa_supplicant/wpa_priv.c
  179. +++ b/wpa_supplicant/wpa_priv.c
  180. @@ -1031,8 +1031,8 @@ static void wpa_priv_send_ft_response(st
  181. }
  182. -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
  183. - union wpa_event_data *data)
  184. +static void supplicant_event(void *ctx, enum wpa_event_type event,
  185. + union wpa_event_data *data)
  186. {
  187. struct wpa_priv_interface *iface = ctx;
  188. @@ -1101,7 +1101,7 @@ void wpa_supplicant_event(void *ctx, enu
  189. }
  190. -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  191. +void supplicant_event_global(void *ctx, enum wpa_event_type event,
  192. union wpa_event_data *data)
  193. {
  194. struct wpa_priv_global *global = ctx;
  195. @@ -1213,6 +1213,8 @@ int main(int argc, char *argv[])
  196. if (os_program_init())
  197. return -1;
  198. + wpa_supplicant_event = supplicant_event;
  199. + wpa_supplicant_event_global = supplicant_event_global;
  200. wpa_priv_fd_workaround();
  201. os_memset(&global, 0, sizeof(global));
  202. --- a/wpa_supplicant/events.c
  203. +++ b/wpa_supplicant/events.c
  204. @@ -3610,8 +3610,8 @@ static void wpa_supplicant_event_assoc_a
  205. }
  206. -void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
  207. - union wpa_event_data *data)
  208. +void supplicant_event(void *ctx, enum wpa_event_type event,
  209. + union wpa_event_data *data)
  210. {
  211. struct wpa_supplicant *wpa_s = ctx;
  212. int resched;
  213. @@ -4315,7 +4315,7 @@ void wpa_supplicant_event(void *ctx, enu
  214. #endif /* CONFIG_AP */
  215. break;
  216. case EVENT_ACS_CHANNEL_SELECTED:
  217. -#ifdef CONFIG_ACS
  218. +#if defined(CONFIG_ACS) && defined(CONFIG_AP)
  219. if (!wpa_s->ap_iface)
  220. break;
  221. hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0],
  222. @@ -4337,7 +4337,7 @@ void wpa_supplicant_event(void *ctx, enu
  223. }
  224. -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  225. +void supplicant_event_global(void *ctx, enum wpa_event_type event,
  226. union wpa_event_data *data)
  227. {
  228. struct wpa_supplicant *wpa_s;
  229. --- a/wpa_supplicant/wpa_supplicant.c
  230. +++ b/wpa_supplicant/wpa_supplicant.c
  231. @@ -5136,7 +5136,6 @@ struct wpa_interface * wpa_supplicant_ma
  232. return NULL;
  233. }
  234. -
  235. /**
  236. * wpa_supplicant_match_existing - Match existing interfaces
  237. * @global: Pointer to global data from wpa_supplicant_init()
  238. @@ -5173,6 +5172,11 @@ static int wpa_supplicant_match_existing
  239. #endif /* CONFIG_MATCH_IFACE */
  240. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  241. + union wpa_event_data *data);
  242. +
  243. +extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  244. + union wpa_event_data *data);
  245. /**
  246. * wpa_supplicant_add_iface - Add a new network interface
  247. @@ -5428,6 +5432,8 @@ struct wpa_global * wpa_supplicant_init(
  248. #ifndef CONFIG_NO_WPA_MSG
  249. wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
  250. #endif /* CONFIG_NO_WPA_MSG */
  251. + wpa_supplicant_event = supplicant_event;
  252. + wpa_supplicant_event_global = supplicant_event_global;
  253. if (params->wpa_debug_file_path)
  254. wpa_debug_open_file(params->wpa_debug_file_path);
  255. --- a/hostapd/main.c
  256. +++ b/hostapd/main.c
  257. @@ -590,6 +590,11 @@ fail:
  258. return -1;
  259. }
  260. +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
  261. + union wpa_event_data *data);
  262. +
  263. +void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  264. + union wpa_event_data *data);
  265. #ifdef CONFIG_WPS
  266. static int gen_uuid(const char *txt_addr)
  267. @@ -667,6 +672,8 @@ int main(int argc, char *argv[])
  268. interfaces.global_ctrl_sock = -1;
  269. dl_list_init(&interfaces.global_ctrl_dst);
  270. + wpa_supplicant_event = hostapd_wpa_event;
  271. + wpa_supplicant_event_global = hostapd_wpa_event_global;
  272. for (;;) {
  273. c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:");
  274. if (c < 0)
  275. --- a/src/drivers/drivers.c
  276. +++ b/src/drivers/drivers.c
  277. @@ -10,6 +10,10 @@
  278. #include "utils/common.h"
  279. #include "driver.h"
  280. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  281. + union wpa_event_data *data);
  282. +void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  283. + union wpa_event_data *data);
  284. const struct wpa_driver_ops *const wpa_drivers[] =
  285. {
  286. --- a/wpa_supplicant/eapol_test.c
  287. +++ b/wpa_supplicant/eapol_test.c
  288. @@ -29,7 +29,12 @@
  289. #include "ctrl_iface.h"
  290. #include "pcsc_funcs.h"
  291. #include "wpas_glue.h"
  292. +#include "drivers/driver.h"
  293. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  294. + union wpa_event_data *data);
  295. +void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  296. + union wpa_event_data *data);
  297. const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
  298. @@ -1295,6 +1300,10 @@ static void usage(void)
  299. "option several times.\n");
  300. }
  301. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  302. + union wpa_event_data *data);
  303. +extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  304. + union wpa_event_data *data);
  305. int main(int argc, char *argv[])
  306. {
  307. @@ -1315,6 +1324,8 @@ int main(int argc, char *argv[])
  308. if (os_program_init())
  309. return -1;
  310. + wpa_supplicant_event = supplicant_event;
  311. + wpa_supplicant_event_global = supplicant_event_global;
  312. hostapd_logger_register_cb(hostapd_logger_cb);
  313. os_memset(&eapol_test, 0, sizeof(eapol_test));