developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 1 | --- a/hostapd/Makefile |
| 2 | +++ b/hostapd/Makefile |
| 3 | @@ -1,6 +1,7 @@ |
| 4 | ALL=hostapd hostapd_cli |
| 5 | CONFIG_FILE = .config |
| 6 | |
| 7 | +-include $(if $(MULTICALL), ../wpa_supplicant/.config) |
| 8 | include ../src/build.rules |
| 9 | |
| 10 | ifdef LIBS |
| 11 | @@ -199,7 +200,8 @@ endif |
| 12 | |
| 13 | ifdef CONFIG_NO_VLAN |
| 14 | CFLAGS += -DCONFIG_NO_VLAN |
| 15 | -else |
| 16 | +endif |
| 17 | +ifneq ($(findstring CONFIG_NO_VLAN,$(CFLAGS)), CONFIG_NO_VLAN) |
| 18 | OBJS += ../src/ap/vlan_init.o |
| 19 | OBJS += ../src/ap/vlan_ifconfig.o |
| 20 | OBJS += ../src/ap/vlan.o |
| 21 | @@ -357,10 +359,14 @@ CFLAGS += -DCONFIG_MBO |
| 22 | OBJS += ../src/ap/mbo_ap.o |
| 23 | endif |
| 24 | |
| 25 | +ifndef MULTICALL |
| 26 | +CFLAGS += -DNO_SUPPLICANT |
| 27 | +endif |
| 28 | + |
| 29 | include ../src/drivers/drivers.mak |
| 30 | -OBJS += $(DRV_AP_OBJS) |
| 31 | -CFLAGS += $(DRV_AP_CFLAGS) |
| 32 | -LDFLAGS += $(DRV_AP_LDFLAGS) |
| 33 | +OBJS += $(sort $(DRV_AP_OBJS) $(if $(MULTICALL),$(DRV_WPA_OBJS))) |
| 34 | +CFLAGS += $(DRV_AP_CFLAGS) $(if $(MULTICALL),$(DRV_WPA_CFLAGS)) |
| 35 | +LDFLAGS += $(DRV_AP_LDFLAGS) $(if $(MULTICALL),$(DRV_WPA_LDFLAGS)) |
| 36 | LIBS += $(DRV_AP_LIBS) |
| 37 | |
| 38 | ifdef CONFIG_L2_PACKET |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 39 | @@ -1380,6 +1386,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR) |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 40 | _OBJS_VAR := OBJS |
| 41 | include ../src/objs.mk |
| 42 | |
| 43 | +hostapd_multi.a: $(BCHECK) $(OBJS) |
| 44 | + $(Q)$(CC) -c -o hostapd_multi.o -Dmain=hostapd_main $(CFLAGS) main.c |
| 45 | + @$(E) " CC " $< |
| 46 | + @rm -f $@ |
| 47 | + @$(AR) cr $@ hostapd_multi.o $(OBJS) |
| 48 | + |
| 49 | hostapd: $(OBJS) |
| 50 | $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS) |
| 51 | @$(E) " LD " $@ |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 52 | @@ -1460,6 +1472,12 @@ include ../src/objs.mk |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 53 | _OBJS_VAR := SOBJS |
| 54 | include ../src/objs.mk |
| 55 | |
| 56 | +dump_cflags: |
| 57 | + @printf "%s " "$(CFLAGS)" |
| 58 | + |
| 59 | +dump_ldflags: |
| 60 | + @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)" |
| 61 | + |
| 62 | nt_password_hash: $(NOBJS) |
| 63 | $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n) |
| 64 | @$(E) " LD " $@ |
| 65 | --- a/wpa_supplicant/Makefile |
| 66 | +++ b/wpa_supplicant/Makefile |
| 67 | @@ -10,6 +10,7 @@ ALL += dbus/fi.w1.wpa_supplicant1.servic |
| 68 | EXTRA_TARGETS=dynamic_eap_methods |
| 69 | |
| 70 | CONFIG_FILE=.config |
| 71 | +-include $(if $(MULTICALL),../hostapd/.config) |
| 72 | include ../src/build.rules |
| 73 | |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 74 | ifdef CONFIG_BUILD_PASN_SO |
| 75 | @@ -382,7 +383,9 @@ endif |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 76 | ifdef CONFIG_IBSS_RSN |
| 77 | NEED_RSN_AUTHENTICATOR=y |
| 78 | CFLAGS += -DCONFIG_IBSS_RSN |
| 79 | +ifndef MULTICALL |
| 80 | CFLAGS += -DCONFIG_NO_VLAN |
| 81 | +endif |
| 82 | OBJS += ibss_rsn.o |
| 83 | endif |
| 84 | |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 85 | @@ -924,6 +927,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 86 | CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS |
| 87 | LIBS += -ldl -rdynamic |
| 88 | endif |
| 89 | +else |
| 90 | + ifdef MULTICALL |
| 91 | + OBJS += ../src/eap_common/eap_common.o |
| 92 | + endif |
| 93 | endif |
| 94 | |
| 95 | ifdef CONFIG_AP |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 96 | @@ -931,9 +938,11 @@ NEED_EAP_COMMON=y |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 97 | NEED_RSN_AUTHENTICATOR=y |
| 98 | CFLAGS += -DCONFIG_AP |
| 99 | OBJS += ap.o |
| 100 | +ifndef MULTICALL |
| 101 | CFLAGS += -DCONFIG_NO_RADIUS |
| 102 | CFLAGS += -DCONFIG_NO_ACCOUNTING |
| 103 | CFLAGS += -DCONFIG_NO_VLAN |
| 104 | +endif |
| 105 | OBJS += ../src/ap/hostapd.o |
| 106 | OBJS += ../src/ap/wpa_auth_glue.o |
| 107 | OBJS += ../src/ap/utils.o |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 108 | @@ -1022,6 +1031,12 @@ endif |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 109 | ifdef CONFIG_HS20 |
| 110 | OBJS += ../src/ap/hs20.o |
| 111 | endif |
| 112 | +else |
| 113 | + ifdef MULTICALL |
| 114 | + OBJS += ../src/eap_server/eap_server.o |
| 115 | + OBJS += ../src/eap_server/eap_server_identity.o |
| 116 | + OBJS += ../src/eap_server/eap_server_methods.o |
| 117 | + endif |
| 118 | endif |
| 119 | |
| 120 | ifdef CONFIG_MBO |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 121 | @@ -1030,7 +1045,9 @@ CFLAGS += -DCONFIG_MBO |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 122 | endif |
| 123 | |
| 124 | ifdef NEED_RSN_AUTHENTICATOR |
| 125 | +ifndef MULTICALL |
| 126 | CFLAGS += -DCONFIG_NO_RADIUS |
| 127 | +endif |
| 128 | NEED_AES_WRAP=y |
| 129 | OBJS += ../src/ap/wpa_auth.o |
| 130 | OBJS += ../src/ap/wpa_auth_ie.o |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 131 | @@ -2010,6 +2027,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv) |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 132 | |
| 133 | _OBJS_VAR := OBJS |
| 134 | include ../src/objs.mk |
| 135 | +wpa_supplicant_multi.a: .config $(BCHECK) $(OBJS) $(EXTRA_progs) |
| 136 | + $(Q)$(CC) -c -o wpa_supplicant_multi.o -Dmain=wpa_supplicant_main $(CFLAGS) main.c |
| 137 | + @$(E) " CC " $< |
| 138 | + @rm -f $@ |
| 139 | + @$(AR) cr $@ wpa_supplicant_multi.o $(OBJS) |
| 140 | + |
| 141 | wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs) |
| 142 | $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS) |
| 143 | @$(E) " LD " $@ |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 144 | @@ -2142,6 +2165,12 @@ eap_gpsk.so: $(SRC_EAP_GPSK) |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 145 | $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@ |
| 146 | @$(E) " sed" $< |
| 147 | |
| 148 | +dump_cflags: |
| 149 | + @printf "%s " "$(CFLAGS)" |
| 150 | + |
| 151 | +dump_ldflags: |
| 152 | + @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)" |
| 153 | + |
| 154 | wpa_supplicant.exe: wpa_supplicant |
| 155 | mv -f $< $@ |
| 156 | wpa_cli.exe: wpa_cli |
| 157 | --- a/src/drivers/driver.h |
| 158 | +++ b/src/drivers/driver.h |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 159 | @@ -6667,8 +6667,8 @@ union wpa_event_data { |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 160 | * Driver wrapper code should call this function whenever an event is received |
| 161 | * from the driver. |
| 162 | */ |
| 163 | -void wpa_supplicant_event(void *ctx, enum wpa_event_type event, |
| 164 | - union wpa_event_data *data); |
| 165 | +extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event, |
| 166 | + union wpa_event_data *data); |
| 167 | |
| 168 | /** |
| 169 | * wpa_supplicant_event_global - Report a driver event for wpa_supplicant |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 170 | @@ -6680,7 +6680,7 @@ void wpa_supplicant_event(void *ctx, enu |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 171 | * Same as wpa_supplicant_event(), but we search for the interface in |
| 172 | * wpa_global. |
| 173 | */ |
| 174 | -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event, |
| 175 | +extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event, |
| 176 | union wpa_event_data *data); |
| 177 | |
| 178 | /* |
| 179 | --- a/src/ap/drv_callbacks.c |
| 180 | +++ b/src/ap/drv_callbacks.c |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 181 | @@ -2184,8 +2184,8 @@ err: |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 182 | #endif /* CONFIG_OWE */ |
| 183 | |
| 184 | |
| 185 | -void wpa_supplicant_event(void *ctx, enum wpa_event_type event, |
| 186 | - union wpa_event_data *data) |
| 187 | +void hostapd_wpa_event(void *ctx, enum wpa_event_type event, |
| 188 | + union wpa_event_data *data) |
| 189 | { |
| 190 | struct hostapd_data *hapd = ctx; |
| 191 | #ifndef CONFIG_NO_STDOUT_DEBUG |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 192 | @@ -2489,7 +2489,7 @@ void wpa_supplicant_event(void *ctx, enu |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | |
| 196 | -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event, |
| 197 | +void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event, |
| 198 | union wpa_event_data *data) |
| 199 | { |
| 200 | struct hapd_interfaces *interfaces = ctx; |
| 201 | --- a/wpa_supplicant/wpa_priv.c |
| 202 | +++ b/wpa_supplicant/wpa_priv.c |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 203 | @@ -1039,8 +1039,8 @@ static void wpa_priv_send_ft_response(st |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | |
| 207 | -void wpa_supplicant_event(void *ctx, enum wpa_event_type event, |
| 208 | - union wpa_event_data *data) |
| 209 | +static void supplicant_event(void *ctx, enum wpa_event_type event, |
| 210 | + union wpa_event_data *data) |
| 211 | { |
| 212 | struct wpa_priv_interface *iface = ctx; |
| 213 | |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 214 | @@ -1103,7 +1103,7 @@ void wpa_supplicant_event(void *ctx, enu |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | |
| 218 | -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event, |
| 219 | +void supplicant_event_global(void *ctx, enum wpa_event_type event, |
| 220 | union wpa_event_data *data) |
| 221 | { |
| 222 | struct wpa_priv_global *global = ctx; |
developer | 5e0a8d7 | 2023-05-12 18:58:17 +0800 | [diff] [blame] | 223 | @@ -1217,6 +1217,8 @@ int main(int argc, char *argv[]) |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 224 | if (os_program_init()) |
| 225 | return -1; |
| 226 | |
| 227 | + wpa_supplicant_event = supplicant_event; |
| 228 | + wpa_supplicant_event_global = supplicant_event_global; |
| 229 | wpa_priv_fd_workaround(); |
| 230 | |
| 231 | os_memset(&global, 0, sizeof(global)); |
| 232 | --- a/wpa_supplicant/events.c |
| 233 | +++ b/wpa_supplicant/events.c |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 234 | @@ -5353,8 +5353,8 @@ static void wpas_link_reconfig(struct wp |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | |
| 238 | -void wpa_supplicant_event(void *ctx, enum wpa_event_type event, |
| 239 | - union wpa_event_data *data) |
| 240 | +void supplicant_event(void *ctx, enum wpa_event_type event, |
| 241 | + union wpa_event_data *data) |
| 242 | { |
| 243 | struct wpa_supplicant *wpa_s = ctx; |
| 244 | int resched; |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 245 | @@ -6272,7 +6272,7 @@ void wpa_supplicant_event(void *ctx, enu |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | |
| 249 | -void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event, |
| 250 | +void supplicant_event_global(void *ctx, enum wpa_event_type event, |
| 251 | union wpa_event_data *data) |
| 252 | { |
| 253 | struct wpa_supplicant *wpa_s; |
| 254 | --- a/wpa_supplicant/wpa_supplicant.c |
| 255 | +++ b/wpa_supplicant/wpa_supplicant.c |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 256 | @@ -7462,7 +7462,6 @@ struct wpa_interface * wpa_supplicant_ma |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 257 | return NULL; |
| 258 | } |
| 259 | |
| 260 | - |
| 261 | /** |
| 262 | * wpa_supplicant_match_existing - Match existing interfaces |
| 263 | * @global: Pointer to global data from wpa_supplicant_init() |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 264 | @@ -7497,6 +7496,11 @@ static int wpa_supplicant_match_existing |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 265 | |
| 266 | #endif /* CONFIG_MATCH_IFACE */ |
| 267 | |
| 268 | +extern void supplicant_event(void *ctx, enum wpa_event_type event, |
| 269 | + union wpa_event_data *data); |
| 270 | + |
| 271 | +extern void supplicant_event_global(void *ctx, enum wpa_event_type event, |
| 272 | + union wpa_event_data *data); |
| 273 | |
| 274 | /** |
| 275 | * wpa_supplicant_add_iface - Add a new network interface |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 276 | @@ -7753,6 +7757,8 @@ struct wpa_global * wpa_supplicant_init( |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 277 | #ifndef CONFIG_NO_WPA_MSG |
| 278 | wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb); |
| 279 | #endif /* CONFIG_NO_WPA_MSG */ |
| 280 | + wpa_supplicant_event = supplicant_event; |
| 281 | + wpa_supplicant_event_global = supplicant_event_global; |
| 282 | |
| 283 | if (params->wpa_debug_file_path) |
| 284 | wpa_debug_open_file(params->wpa_debug_file_path); |
| 285 | --- a/hostapd/main.c |
| 286 | +++ b/hostapd/main.c |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 287 | @@ -698,6 +698,11 @@ fail: |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 288 | return -1; |
| 289 | } |
| 290 | |
| 291 | +void hostapd_wpa_event(void *ctx, enum wpa_event_type event, |
| 292 | + union wpa_event_data *data); |
| 293 | + |
| 294 | +void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event, |
| 295 | + union wpa_event_data *data); |
| 296 | |
| 297 | #ifdef CONFIG_WPS |
| 298 | static int gen_uuid(const char *txt_addr) |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 299 | @@ -791,6 +796,8 @@ int main(int argc, char *argv[]) |
developer | f2e3f56 | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 300 | return -1; |
| 301 | #endif /* CONFIG_DPP */ |
| 302 | |
| 303 | + wpa_supplicant_event = hostapd_wpa_event; |
| 304 | + wpa_supplicant_event_global = hostapd_wpa_event_global; |
| 305 | for (;;) { |
| 306 | c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:q"); |
| 307 | if (c < 0) |
| 308 | --- a/src/drivers/drivers.c |
| 309 | +++ b/src/drivers/drivers.c |
| 310 | @@ -10,6 +10,10 @@ |
| 311 | #include "utils/common.h" |
| 312 | #include "driver.h" |
| 313 | |
| 314 | +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event, |
| 315 | + union wpa_event_data *data); |
| 316 | +void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event, |
| 317 | + union wpa_event_data *data); |
| 318 | |
| 319 | const struct wpa_driver_ops *const wpa_drivers[] = |
| 320 | { |
| 321 | --- a/wpa_supplicant/eapol_test.c |
| 322 | +++ b/wpa_supplicant/eapol_test.c |
| 323 | @@ -31,7 +31,12 @@ |
| 324 | #include "ctrl_iface.h" |
| 325 | #include "pcsc_funcs.h" |
| 326 | #include "wpas_glue.h" |
| 327 | +#include "drivers/driver.h" |
| 328 | |
| 329 | +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event, |
| 330 | + union wpa_event_data *data); |
| 331 | +void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event, |
| 332 | + union wpa_event_data *data); |
| 333 | |
| 334 | const struct wpa_driver_ops *const wpa_drivers[] = { NULL }; |
| 335 | |
| 336 | @@ -1303,6 +1308,10 @@ static void usage(void) |
| 337 | "option several times.\n"); |
| 338 | } |
| 339 | |
| 340 | +extern void supplicant_event(void *ctx, enum wpa_event_type event, |
| 341 | + union wpa_event_data *data); |
| 342 | +extern void supplicant_event_global(void *ctx, enum wpa_event_type event, |
| 343 | + union wpa_event_data *data); |
| 344 | |
| 345 | int main(int argc, char *argv[]) |
| 346 | { |
| 347 | @@ -1323,6 +1332,8 @@ int main(int argc, char *argv[]) |
| 348 | if (os_program_init()) |
| 349 | return -1; |
| 350 | |
| 351 | + wpa_supplicant_event = supplicant_event; |
| 352 | + wpa_supplicant_event_global = supplicant_event_global; |
| 353 | hostapd_logger_register_cb(hostapd_logger_cb); |
| 354 | |
| 355 | os_memset(&eapol_test, 0, sizeof(eapol_test)); |