- }
- #endif /* CONFIG_P2P */
-
-+ if (sta->auth_alg < ARRAY_SIZE(auth_algs))
-+ auth_alg = auth_algs[sta->auth_alg];
-+
-+ if (auth_alg)
-+ os_snprintf(alg_buf, sizeof(alg_buf),
-+ " auth_alg=%s", auth_alg);
-+
- keyid = ap_sta_wpa_get_keyid(hapd, sta);
- if (keyid) {
- os_snprintf(keyid_buf, sizeof(keyid_buf),
-@@ -1488,17 +1510,19 @@ void ap_sta_set_authorized_event(struct
- dpp_pkhash, SHA256_MAC_LEN);
- }
-
-- wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s",
-- buf, ip_addr, keyid_buf, dpp_pkhash_buf);
-+ hostapd_ubus_notify_authorized(hapd, sta, auth_alg);
-+ wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s%s",
-+ buf, ip_addr, keyid_buf, dpp_pkhash_buf, alg_buf);
-
- if (hapd->msg_ctx_parent &&
- hapd->msg_ctx_parent != hapd->msg_ctx)
- wpa_msg_no_global(hapd->msg_ctx_parent, MSG_INFO,
-- AP_STA_CONNECTED "%s%s%s%s",
-+ AP_STA_CONNECTED "%s%s%s%s%s",
- buf, ip_addr, keyid_buf,
-- dpp_pkhash_buf);
-+ dpp_pkhash_buf, alg_buf);
- } else {
- wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED "%s", buf);
-+ hostapd_ubus_notify(hapd, "disassoc", sta->addr);
-
- if (hapd->msg_ctx_parent &&
- hapd->msg_ctx_parent != hapd->msg_ctx)
---- a/src/ap/wpa_auth_glue.c
-+++ b/src/ap/wpa_auth_glue.c
-@@ -275,6 +275,7 @@ static void hostapd_wpa_auth_psk_failure
- struct hostapd_data *hapd = ctx;
- wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR,
- MAC2STR(addr));
-+ hostapd_ubus_notify(hapd, "key-mismatch", addr);
- }
-
-
---- a/wpa_supplicant/Makefile
-+++ b/wpa_supplicant/Makefile
-@@ -189,6 +189,13 @@ ifdef CONFIG_EAPOL_TEST
- CFLAGS += -Werror -DEAPOL_TEST
- endif
-
-+ifdef CONFIG_UBUS
-+CFLAGS += -DUBUS_SUPPORT
-+OBJS += ubus.o
-+OBJS += ../src/utils/uloop.o
-+LIBS += -lubox -lubus
-+endif
-+
- ifdef CONFIG_CODE_COVERAGE
- CFLAGS += -O0 -fprofile-arcs -ftest-coverage -U_FORTIFY_SOURCE
- LIBS += -lgcov
-@@ -1042,6 +1049,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
- CFLAGS += -DCONFIG_CTRL_IFACE_MIB
- endif
- OBJS += ../src/ap/ctrl_iface_ap.o
-+ifdef CONFIG_UBUS
-+OBJS += ../src/ap/ubus.o
-+endif
- endif
-
- CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
---- a/wpa_supplicant/wpa_supplicant.c
-+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -7716,6 +7716,8 @@ struct wpa_supplicant * wpa_supplicant_a
- }
- #endif /* CONFIG_P2P */
-
-+ wpas_ubus_add_bss(wpa_s);
-+
- return wpa_s;
- }
-
-@@ -7742,6 +7744,8 @@ int wpa_supplicant_remove_iface(struct w
- struct wpa_supplicant *parent = wpa_s->parent;
- #endif /* CONFIG_MESH */
-
-+ wpas_ubus_free_bss(wpa_s);
-+
- /* Remove interface from the global list of interfaces */
- prev = global->ifaces;
- if (prev == wpa_s) {
-@@ -8088,8 +8092,12 @@ 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;
- }
-
---- a/wpa_supplicant/wpa_supplicant_i.h
-+++ b/wpa_supplicant/wpa_supplicant_i.h
-@@ -21,6 +21,7 @@
- #include "config_ssid.h"
- #include "wmm_ac.h"
- #include "pasn/pasn_common.h"
-+#include "ubus.h"
-
- extern const char *const wpa_supplicant_version;
- extern const char *const wpa_supplicant_license;
-@@ -319,6 +320,8 @@ struct wpa_global {
- #endif /* CONFIG_WIFI_DISPLAY */
-
- struct psk_list_entry *add_psk; /* From group formation */
-+
-+ struct ubus_object ubus_global;
- };
-
-
-@@ -693,6 +696,7 @@ struct wpa_supplicant {
- unsigned char own_addr[ETH_ALEN];
- unsigned char perm_addr[ETH_ALEN];
- char ifname[100];
-+ struct wpas_ubus_bss ubus;
- #ifdef CONFIG_MATCH_IFACE
- int matched;
- #endif /* CONFIG_MATCH_IFACE */
---- a/wpa_supplicant/wps_supplicant.c
-+++ b/wpa_supplicant/wps_supplicant.c
-@@ -33,6 +33,7 @@
- #include "p2p/p2p.h"
- #include "p2p_supplicant.h"
- #include "wps_supplicant.h"
-+#include "ubus.h"
-
-
- #ifndef WPS_PIN_SCAN_IGNORE_SEL_REG
-@@ -401,6 +402,8 @@ static int wpa_supplicant_wps_cred(void
- wpa_hexdump_key(MSG_DEBUG, "WPS: Received Credential attribute",
- cred->cred_attr, cred->cred_attr_len);
-
-+ wpas_ubus_notify(wpa_s, cred);
-+
- if (wpa_s->conf->wps_cred_processing == 1)
- return 0;
-
---- a/wpa_supplicant/main.c
-+++ b/wpa_supplicant/main.c
-@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
-
- for (;;) {
- c = getopt(argc, argv,
-- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W");
-+ "b:Bc:C:D:de:f:g:G:hi:I:KLMm:nNo:O:p:P:qsTtuv::W");
- if (c < 0)
- break;
- switch (c) {
-@@ -268,6 +268,9 @@ int main(int argc, char *argv[])
- params.conf_p2p_dev = optarg;
- break;