--- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -168,9 +168,21 @@ OBJS += ../src/eapol_auth/eapol_auth_sm. ifdef CONFIG_UBUS CFLAGS += -DUBUS_SUPPORT -OBJS += ../src/utils/uloop.o OBJS += ../src/ap/ubus.o -LIBS += -lubox -lubus +LIBS += -lubus +NEED_ULOOP:=y +endif + +ifdef CONFIG_UCODE +CFLAGS += -DUCODE_SUPPORT +OBJS += ../src/utils/ucode.o +OBJS += ../src/ap/ucode.o +NEED_ULOOP:=y +endif + +ifdef NEED_ULOOP +OBJS += ../src/utils/uloop.o +LIBS += -lubox endif ifdef CONFIG_CODE_COVERAGE --- a/hostapd/main.c +++ b/hostapd/main.c @@ -895,6 +895,7 @@ int main(int argc, char *argv[]) } hostapd_global_ctrl_iface_init(&interfaces); + hostapd_ucode_init(&interfaces); if (hostapd_global_run(&interfaces, daemonize, pid_file)) { wpa_printf(MSG_ERROR, "Failed to start eloop"); @@ -904,6 +905,7 @@ int main(int argc, char *argv[]) ret = 0; out: + hostapd_ucode_free(); hostapd_global_ctrl_iface_deinit(&interfaces); /* Deinitialize all interfaces */ for (i = 0; i < interfaces.count; i++) { --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -18,6 +18,7 @@ #include "ap_config.h" #include "drivers/driver.h" #include "ubus.h" +#include "ucode.h" #define OCE_STA_CFON_ENABLED(hapd) \ ((hapd->conf->oce & OCE_STA_CFON) && \ @@ -50,6 +51,10 @@ struct hapd_interfaces { struct hostapd_config * (*config_read_cb)(const char *config_fname); int (*ctrl_iface_init)(struct hostapd_data *hapd); void (*ctrl_iface_deinit)(struct hostapd_data *hapd); + int (*ctrl_iface_recv)(struct hostapd_data *hapd, + char *buf, char *reply, int reply_size, + struct sockaddr_storage *from, + socklen_t fromlen); int (*for_each_interface)(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); @@ -171,6 +176,7 @@ struct hostapd_data { struct hostapd_config *iconf; struct hostapd_bss_config *conf; struct hostapd_ubus_bss ubus; + struct hostapd_ucode_bss ucode; int interface_added; /* virtual interface added for this BSS */ unsigned int started:1; unsigned int disabled:1; @@ -463,6 +469,7 @@ struct hostapd_sta_info { */ struct hostapd_iface { struct hapd_interfaces *interfaces; + struct hostapd_ucode_iface ucode; void *owner; char *config_fname; struct hostapd_config *conf; --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -239,6 +239,8 @@ int hostapd_reload_config(struct hostapd size_t j; int i; + hostapd_ucode_reload_bss(hapd, reconf); + if (iface->config_fname == NULL) { /* Only in-memory config in use - assume it has been updated */ hostapd_clear_old(iface); @@ -395,6 +397,7 @@ void hostapd_free_hapd_data(struct hosta hapd->beacon_set_done = 0; wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); + hostapd_ucode_free_bss(hapd); hostapd_ubus_free_bss(hapd); accounting_deinit(hapd); hostapd_deinit_wpa(hapd); @@ -549,6 +552,7 @@ void hostapd_cleanup_iface_partial(struc static void hostapd_cleanup_iface(struct hostapd_iface *iface) { wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); + hostapd_ucode_free_iface(iface); eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, NULL); @@ -1419,6 +1423,7 @@ static int hostapd_setup_bss(struct host hapd->driver->set_operstate(hapd->drv_priv, 1); hostapd_ubus_add_bss(hapd); + hostapd_ucode_add_bss(hapd); return 0; } --- a/wpa_supplicant/Makefile +++ b/wpa_supplicant/Makefile @@ -174,8 +174,20 @@ endif ifdef CONFIG_UBUS CFLAGS += -DUBUS_SUPPORT OBJS += ubus.o +LIBS += -lubus +NEED_ULOOP:=y +endif + +ifdef CONFIG_UCODE +CFLAGS += -DUCODE_SUPPORT +OBJS += ../src/utils/ucode.o +OBJS += ucode.o +NEED_ULOOP:=y +endif + +ifdef NEED_ULOOP OBJS += ../src/utils/uloop.o -LIBS += -lubox -lubus +LIBS += -lubox endif ifdef CONFIG_CODE_COVERAGE --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -7013,6 +7013,7 @@ struct wpa_supplicant * wpa_supplicant_a #endif /* CONFIG_P2P */ wpas_ubus_add_bss(wpa_s); + wpas_ucode_add_bss(wpa_s); return wpa_s; } @@ -7040,6 +7041,7 @@ int wpa_supplicant_remove_iface(struct w struct wpa_supplicant *parent = wpa_s->parent; #endif /* CONFIG_MESH */ + wpas_ucode_free_bss(wpa_s); wpas_ubus_free_bss(wpa_s); /* Remove interface from the global list of interfaces */ @@ -7307,6 +7309,7 @@ struct wpa_global * wpa_supplicant_init( eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0, wpas_periodic, global, NULL); + wpas_ucode_init(global); return global; } @@ -7345,12 +7348,8 @@ int wpa_supplicant_run(struct wpa_global eloop_register_signal_terminate(wpa_supplicant_terminate, global); eloop_register_signal_reconfig(wpa_supplicant_reconfig, global); - wpas_ubus_add(global); - eloop_run(); - wpas_ubus_free(global); - return 0; } @@ -7383,6 +7382,8 @@ void wpa_supplicant_deinit(struct wpa_gl wpas_notify_supplicant_deinitialized(global); + wpas_ucode_free(); + eap_peer_unregister_methods(); #ifdef CONFIG_AP eap_server_unregister_methods(); --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -20,6 +20,7 @@ #include "config_ssid.h" #include "wmm_ac.h" #include "ubus.h" +#include "ucode.h" extern const char *const wpa_supplicant_version; extern const char *const wpa_supplicant_license; @@ -605,6 +606,7 @@ struct wpa_supplicant { unsigned char perm_addr[ETH_ALEN]; char ifname[100]; struct wpas_ubus_bss ubus; + struct wpas_ucode_bss ucode; #ifdef CONFIG_MATCH_IFACE int matched; #endif /* CONFIG_MATCH_IFACE */ --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -4941,6 +4941,7 @@ try_again: return -1; } + interface->ctrl_iface_recv = hostapd_ctrl_iface_receive_process; wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb); return 0; @@ -5042,6 +5043,7 @@ fail: os_free(fname); interface->global_ctrl_sock = s; + interface->ctrl_iface_recv = hostapd_ctrl_iface_receive_process; eloop_register_read_sock(s, hostapd_global_ctrl_iface_receive, interface, NULL);