Added dbus signal for dpp authentication and configuration process. Signed-off-by: Jeonghwan Yoon <jeonghwan.yoon@xxxxxxx> --- doc/dbus.doxygen | 126 +++++++++++ wpa_supplicant/dbus/dbus_new.c | 374 ++++++++++++++++++++++++++++++++ wpa_supplicant/dbus/dbus_new.h | 72 ++++++ wpa_supplicant/dpp_supplicant.c | 28 ++- wpa_supplicant/gas_query.c | 8 + wpa_supplicant/notify.c | 63 ++++++ wpa_supplicant/notify.h | 15 ++ wpa_supplicant/wpa_supplicant.c | 4 + 8 files changed, 686 insertions(+), 4 deletions(-) diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen index 610b44cda..a3974b65f 100644 --- a/doc/dbus.doxygen +++ b/doc/dbus.doxygen @@ -1489,6 +1489,132 @@ Interface for performing DPP (Device Provisioning Protocol) Device operations. <dd>reason of failed.</dd> </dl> </li> + <li> + <h3>DppAuthSuccess ( ) -> i : initiator</h3> + <p>Authentication is succeed.</p> + <h4>Returns</h4> + <dl> + <dt>i : initiator</dt> + <dd>0 (responder) or 1 (initiator)</dd> + </dl> + </li> + + <li> + <h3>DppConFailed ( ) -> nothing</h3> + <p>Configuration is failed.</p> + </li> + + <li> + <h3>DppPkexTLimit ( ) -> nothing</h3> + <p>Pkex retry operation is failed.</p> + </li> + + <li> + <h3>DppGasQueryStart ( s: addr, i : dialog token, u : frequency )</h3> + <p> Gas query is started.</p> + <h4>Arguments</h4> + <dl> + <dt>s : addr</dt> + <dd>destination mac address</dd> + </dl> + <dl> + <dt>i : dialog token</dt> + <dd>dialog token for gas query</dd> + </dl> + <dl> + <dt>u : frequency</dt> + <dd>operating frequency</dd> + </dl> + </li> + + <li> + <h3>DppGasQueryDone ( s: addr, i : dialog token, u : frequency, i : status code, s : result)</h3> + <p> Finished Gas query.</p> + <h4>Arguments</h4> + <dl> + <dt>s : addr</dt> + <dd>destination mac address</dd> + </dl> + <dl> + <dt>i : dialog token</dt> + <dd>dialog token for gas query</dd> + </dl> + <dl> + <dt>u : frequency</dt> + <dd>operating frequency</dd> + </dl> + <dl> + <dt>i : status code</dt> + <dd>dialog token for gas query</dd> + </dl> + <dl> + <dt>s : result</dt> + <dd>query result : possible values are "SUCCESS", "FAILURE", "TIMEOUT", "PEER_ERROR", "INTERNAL_ERROR", "DELETED_AT_DEINIT", "N/A"</dd> + </dl> + </li> + + <li> + <h3>DppConReceived ( )</h3> + <p>Received configuration object.</p> + </li> + + <li> + <h3>DppConfobjSSID ( s : ssid )</h3> + <p> Received configuration object (ssid).</p> + <dl> + <dt>s : ssid</dt> + <dd>SSID in the received configuration object.</dd> + </dl> + </li> + + <li> + <h3>DppConfobjAkm ( s : akm )</h3> + <p> Received configuration object (AKM).</p> + <dl> + <dt>s : akm</dt> + <dd>AKM in the received configuration object.</dd> + </dl> + </li> + + <li> + <h3>DppConfobjPass ( s : passphrase )</h3> + <p> Received configuration object (passphrase).</p> + <dl> + <dt>s : passphrase</dt> + <dd>passphrase in the received configuration object.</dd> + </dl> + </li> + + <li> + <h3>DppNetworkID ( s : networkID )</h3> + <p> Added new network.</p> + <dl> + <dt>s : networkID</dt> + <dd>added new network id by dpp process.</dd> + </dl> + </li> + + <li> + <h3>DppWpaCompleted ( s : ssid )</h3> + <p> Completed all authentication.</p> + <dl> + <dt>s : ssid</dt> + <dd>added new ssid by dpp process.</dd> + </dl> + </li> + + <li> + <h3>DppConfReqRx ( )</h3> + <p> Received configuration Request.</p> + </li> + <li> + <h3>DppConfSent ( s : dst mac )</h3> + <p> Sent configuration object.</p> + <dl> + <dt>s : dst mac</dt> + <dd> destination mac address.</dd> + </dl> + </li> </ul> \section dbus_p2pdevice fi.w1.wpa_supplicant1.Interface.P2PDevice diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 361fba9de..bf44473fe 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -25,6 +25,9 @@ #include "dbus_new_handlers_p2p.h" #include "p2p/p2p.h" #include "../p2p_supplicant.h" +#ifdef CONFIG_DPP +#include "../src/common/dpp.h" +#endif #ifdef CONFIG_AP /* until needed by something else */ @@ -2246,6 +2249,377 @@ void wpas_dbus_signal_dpp_failed(struct wpa_supplicant *wpa_s, const char *res) dbus_message_unref(msg); } + +void wpas_dbus_signal_dpp_auth_success(struct wpa_supplicant *wpa_s, int initiator) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppAuthSuccess"); + if (msg == NULL) + return; + + if (dbus_message_append_args(msg, DBUS_TYPE_INT32, &initiator, + DBUS_TYPE_INVALID)) + dbus_connection_send(iface->con, msg, NULL); + else + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_gas_query_start(struct wpa_supplicant *wpa_s, const u8 *addr, + int dialog_token, unsigned int freq) +{ + DBusMessage *msg; + DBusMessageIter iter; + struct wpas_dbus_priv *iface; + char mac_addr[WPAS_DBUS_OBJECT_PATH_MAX], *mac_addr_p; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + os_snprintf(mac_addr, WPAS_DBUS_OBJECT_PATH_MAX, MACSTR, MAC2STR(addr)); + mac_addr_p = mac_addr; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppGasQueryStart"); + + if (msg == NULL) + return; + + dbus_message_iter_init_append(msg, &iter); + + if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, + &mac_addr_p) || + !dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, + &dialog_token) || + !dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, + &freq)) + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + else + dbus_connection_send(iface->con, msg, NULL); + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_gas_query_done(struct wpa_supplicant *wpa_s, const u8 *addr, + int dialog_token, unsigned int freq, + int status_code, const char *res) +{ + DBusMessage *msg; + DBusMessageIter iter; + struct wpas_dbus_priv *iface; + char mac_addr[WPAS_DBUS_OBJECT_PATH_MAX], *mac_addr_p; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + os_snprintf(mac_addr, WPAS_DBUS_OBJECT_PATH_MAX, MACSTR, MAC2STR(addr)); + mac_addr_p = mac_addr; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppGasQueryDone"); + if (msg == NULL) + return; + + dbus_message_iter_init_append(msg, &iter); + + if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, + &mac_addr_p) || + !dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, + &dialog_token) || + !dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, + &freq) || + !dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, + &status_code) || + !dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, + &res)) + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + else + dbus_connection_send(iface->con, msg, NULL); + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_conf_received(struct wpa_supplicant *wpa_s) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppConfReceived"); + if (msg == NULL) + return; + + dbus_connection_send(iface->con, msg, NULL); + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_conf_failed(struct wpa_supplicant *wpa_s) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppConfFailed"); + if (msg == NULL) + return; + + dbus_connection_send(iface->con, msg, NULL); + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_confobj_ssid(struct wpa_supplicant *wpa_s, const char *ssid) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppConfobjSSID"); + if (msg == NULL) + return; + + if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &ssid, + DBUS_TYPE_INVALID)){ + dbus_connection_send(iface->con, msg, NULL); + }else{ + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + } + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_confobj_pass(struct wpa_supplicant *wpa_s, const char *pass) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppConfobjPass"); + if (msg == NULL) + return; + + + if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &pass, + DBUS_TYPE_INVALID)) { + dbus_connection_send(iface->con, msg, NULL); + } else { + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + } + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_confobj_akm(struct wpa_supplicant *wpa_s, int akm) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + char akm_string[10]; + char *akm_p; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppConfobjAkm"); + if (msg == NULL) + return; + + if (akm == DPP_AKM_PSK || akm == DPP_AKM_PSK_SAE || akm == DPP_AKM_SAE) { + os_snprintf(akm_string, sizeof(akm_string), "%s", "psk"); + } else { + os_snprintf(akm_string, sizeof(akm_string), "%s", "unknown"); + } + akm_p = akm_string; + + if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &akm_p, + DBUS_TYPE_INVALID)) { + dbus_connection_send(iface->con, msg, NULL); + } else { + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + } + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_network_id(struct wpa_supplicant *wpa_s, int network_id) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppNetworkID"); + if (msg == NULL) + return; + + if (dbus_message_append_args(msg, DBUS_TYPE_INT32, &network_id, + DBUS_TYPE_INVALID)){ + dbus_connection_send(iface->con, msg, NULL); + }else{ + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + } + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_wpa_completed(struct wpa_supplicant *wpa_s, const char *ssid) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppWpaCompleted"); + if (msg == NULL) + return; + + + if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &ssid, + DBUS_TYPE_INVALID)) { + dbus_connection_send(iface->con, msg, NULL); + } else { + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + } + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_conf_req_rx(struct wpa_supplicant *wpa_s, const u8 *addr) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + char mac_addr[18], *mac_addr_p; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + os_snprintf(mac_addr, sizeof(mac_addr), MACSTR, MAC2STR(addr)); + mac_addr_p = mac_addr; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppConfReqRx"); + if (msg == NULL) + return; + + if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &mac_addr_p, + DBUS_TYPE_INVALID)) { + dbus_connection_send(iface->con, msg, NULL); + } else { + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + } + + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_conf_sent(struct wpa_supplicant *wpa_s) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppConfSent"); + if (msg == NULL) + return; + + dbus_connection_send(iface->con, msg, NULL); + dbus_message_unref(msg); +} + +void wpas_dbus_signal_dpp_pkex_t_limit(struct wpa_supplicant *wpa_s) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + + iface = wpa_s->global->dbus; + + /* Do nothing if the control interface is not turned on */ + if (iface == NULL || !wpa_s->dbus_new_path) + return; + + msg = dbus_message_new_signal(wpa_s->dbus_new_path, + WPAS_DBUS_NEW_IFACE_DPPDEVICE, + "DppPkexTLimit"); + if (msg == NULL) + return; + + dbus_connection_send(iface->con, msg, NULL); + dbus_message_unref(msg); +} #endif /* CONFIG_DPP */ /** diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h index e1962546e..a7fe79ae8 100644 --- a/wpa_supplicant/dbus/dbus_new.h +++ b/wpa_supplicant/dbus/dbus_new.h @@ -261,6 +261,21 @@ void wpas_dbus_signal_dpp_tx_status(struct wpa_supplicant *wpa_s, void wpas_dbus_signal_dpp_rx(struct wpa_supplicant *wpa_s, const u8 *src, unsigned int freq, int type); void wpas_dbus_signal_dpp_failed(struct wpa_supplicant *wpa_s, const char *res); +void wpas_dbus_signal_dpp_auth_success(struct wpa_supplicant *wpa_s, int initiator); +void wpas_dbus_signal_dpp_gas_query_start(struct wpa_supplicant *wpa_s, const u8 *addr, + int dialog_token, unsigned int freq); +void wpas_dbus_signal_dpp_gas_query_done(struct wpa_supplicant *wpa_s, const u8 *addr, + int dialog_token, unsigned int freq, int status_code, const char *res); +void wpas_dbus_signal_dpp_conf_received(struct wpa_supplicant *wpa_s); +void wpas_dbus_signal_dpp_conf_failed(struct wpa_supplicant *wpa_s); +void wpas_dbus_signal_dpp_confobj_ssid(struct wpa_supplicant *wpa_s, const char *ssid); +void wpas_dbus_signal_dpp_confobj_akm(struct wpa_supplicant *wpa_s, int akm); +void wpas_dbus_signal_dpp_confobj_pass(struct wpa_supplicant *wpa_s, const char *pass); +void wpas_dbus_signal_dpp_network_id(struct wpa_supplicant *wpa_s, int network_id); +void wpas_dbus_signal_dpp_wpa_completed(struct wpa_supplicant *wpa_s, const char *ssid); +void wpas_dbus_signal_dpp_conf_req_rx(struct wpa_supplicant *wpa_s, const u8 *addr); +void wpas_dbus_signal_dpp_conf_sent(struct wpa_supplicant *wpa_s); +void wpas_dbus_signal_dpp_pkex_t_limit(struct wpa_supplicant *wpa_s); #endif /* CONFIG_DPP */ #else /* CONFIG_CTRL_IFACE_DBUS_NEW */ @@ -620,6 +635,63 @@ static inline void wpas_dbus_signal_dpp_failed(struct wpa_supplicant *wpa_s, const char *res) { } +static inline +void wpas_dbus_signal_dpp_auth_success(struct wpa_supplicant *wpa_s, int initiator) + +{ +} +static inline +void wpas_dbus_signal_dpp_gas_query_start(struct wpa_supplicant *wpa_s, const u8 *addr, + int dialog_token, unsigned int freq) +{ +} +static inline +void wpas_dbus_signal_dpp_gas_query_done(struct wpa_supplicant *wpa_s, const u8 *addr, + int dialog_token, unsigned int freq, int status_code, const char *res) +{ +} +static inline +void wpas_dbus_signal_dpp_conf_received(struct wpa_supplicant *wpa_s) +{ +} +static inline +void wpas_dbus_signal_dpp_conf_failed(struct wpa_supplicant *wpa_s) +{ +} +static inline +void wpas_dbus_signal_dpp_confobj_ssid(struct wpa_supplicant *wpa_s, const char *ssid) +{ +} +static inline +void wpas_dbus_signal_dpp_confobj_pass(struct wpa_supplicant *wpa_s, const char *pass) + +{ +} +static inline +void wpas_dbus_signal_dpp_confobj_akm(struct wpa_supplicant *wpa_s, int akm) + +{ +} +static inline +void wpas_dbus_signal_dpp_network_id(struct wpa_supplicant *wpa_s, int network_id) +{ +} +static inline +void wpas_dbus_signal_dpp_wpa_completed(struct wpa_supplicant *wpa_s, const char *ssid) +{ +} +static inline +void wpas_dbus_signal_dpp_conf_req_rx(struct wpa_supplicant *wpa_s, const u8 *addr) +{ +} +static inline +void wpas_dbus_signal_dpp_conf_sent(struct wpa_supplicant *wpa_s) +{ +} +static inline +void wpas_dbus_signal_dpp_pkex_t_limit(struct wpa_supplicant *wpa_s) +{ +} #endif /* CONFIG_DPP */ #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ #endif /* CTRL_IFACE_DBUS_H_NEW */ diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c index 621ea3ef7..197f81d25 100644 --- a/wpa_supplicant/dpp_supplicant.c +++ b/wpa_supplicant/dpp_supplicant.c @@ -1256,6 +1256,7 @@ static void wpas_dpp_process_config(struct wpa_supplicant *wpa_s, return; wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_NETWORK_ID "%d", ssid->id); + wpas_notify_dpp_network_id(wpa_s, ssid->id); if (wpa_s->conf->dpp_config_processing < 2) return; @@ -1274,9 +1275,19 @@ static void wpas_dpp_handle_config_obj(struct wpa_supplicant *wpa_s, struct dpp_authentication *auth) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_RECEIVED); - if (auth->ssid_len) + wpas_notify_dpp_conf_received(wpa_s); + + if (auth->ssid_len) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONFOBJ_SSID "%s", wpa_ssid_txt(auth->ssid, auth->ssid_len)); + wpas_notify_dpp_confobj_ssid(wpa_s,wpa_ssid_txt(auth->ssid, auth->ssid_len)); + } + + if (auth->passphrase) { + wpas_notify_dpp_confobj_akm(wpa_s, auth->akm); + wpas_notify_dpp_confobj_pass(wpa_s, auth->passphrase); + } + if (auth->connector) { /* TODO: Save the Connector and consider using a command * to fetch the value instead of sending an event with @@ -1379,6 +1390,7 @@ static void wpas_dpp_gas_resp_cb(void *ctx, const u8 *addr, u8 dialog_token, fail: wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_FAILED); + wpas_notify_dpp_conf_failed(wpa_s); dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; } @@ -1456,6 +1468,7 @@ static void wpas_dpp_auth_success(struct wpa_supplicant *wpa_s, int initiator) { wpa_printf(MSG_DEBUG, "DPP: Authentication succeeded"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_AUTH_SUCCESS "init=%d", initiator); + wpas_notify_dpp_auth_success(wpa_s,initiator); #ifdef CONFIG_TESTING_OPTIONS if (dpp_test == DPP_TEST_STOP_AT_AUTH_CONF) { wpa_printf(MSG_INFO, @@ -2126,6 +2139,7 @@ void wpas_dpp_rx_action(struct wpa_supplicant *wpa_s, const u8 *src, pkex_t = 0; if (pkex_t >= PKEX_COUNTER_T_LIMIT) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_PKEX_T_LIMIT "id=0"); + wpas_notify_dpp_pkex_t_limit(wpa_s); wpas_dpp_pkex_remove(wpa_s, "*"); } } @@ -2151,9 +2165,12 @@ wpas_dpp_gas_req_handler(void *ctx, const u8 *sa, const u8 *query, query, query_len); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_REQ_RX "src=" MACSTR, MAC2STR(sa)); + wpas_notify_dpp_conf_req_rx(wpa_s, sa); resp = dpp_conf_req_rx(auth, query, query_len); - if (!resp) + if (!resp){ wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_FAILED); + wpas_notify_dpp_conf_failed(wpa_s); + } auth->conf_resp = resp; return resp; } @@ -2183,10 +2200,13 @@ wpas_dpp_gas_status_handler(void *ctx, struct wpabuf *resp, int ok) eloop_cancel_timeout(wpas_dpp_auth_resp_retry_timeout, wpa_s, NULL); offchannel_send_action_done(wpa_s); wpas_dpp_listen_stop(wpa_s); - if (ok) + if (ok){ wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_SENT); - else + wpas_notify_dpp_conf_sent(wpa_s); + } else { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_FAILED); + wpas_notify_dpp_conf_failed(wpa_s); + } dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; wpabuf_free(resp); diff --git a/wpa_supplicant/gas_query.c b/wpa_supplicant/gas_query.c index f4f60c58b..05de5464e 100644 --- a/wpa_supplicant/gas_query.c +++ b/wpa_supplicant/gas_query.c @@ -21,6 +21,7 @@ #include "driver_i.h" #include "offchannel.h" #include "gas_query.h" +#include "notify.h" /** GAS query timeout in seconds */ @@ -159,6 +160,10 @@ static void gas_query_done(struct gas_query *gas, " dialog_token=%u freq=%d status_code=%u result=%s", MAC2STR(query->addr), query->dialog_token, query->freq, query->status_code, gas_result_txt(result)); +#ifdef CONFIG_DPP + wpas_notify_dpp_gas_query_done(gas->wpa_s, query->addr, + query->dialog_token, query->freq, query->status_code, gas_result_txt(result)); +#endif if (gas->current == query) gas->current = NULL; if (query->offchannel_tx_started) @@ -847,6 +852,9 @@ int gas_query_req(struct gas_query *gas, const u8 *dst, int freq, wpa_msg(gas->wpa_s, MSG_INFO, GAS_QUERY_START "addr=" MACSTR " dialog_token=%u freq=%d", MAC2STR(query->addr), query->dialog_token, query->freq); +#ifdef CONFIG_DPP + wpas_notify_dpp_gas_query_start(gas->wpa_s, query->addr, query->dialog_token, query->freq); +#endif if (radio_add_work(gas->wpa_s, freq, "gas-query", 0, gas_query_start_cb, query) < 0) { diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c index 82d75baf2..bb9e30c9e 100644 --- a/wpa_supplicant/notify.c +++ b/wpa_supplicant/notify.c @@ -923,4 +923,67 @@ void wpas_notify_dpp_failed(struct wpa_supplicant *wpa_s, const char *res) { wpas_dbus_signal_dpp_failed(wpa_s, res); } +void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s, int initiator) +{ + wpas_dbus_signal_dpp_auth_success(wpa_s, initiator); +} +void wpas_notify_dpp_gas_query_start(struct wpa_supplicant *wpa_s, const u8 *addr, + int dialog_token, unsigned int freq) +{ + wpas_dbus_signal_dpp_gas_query_start(wpa_s, addr, dialog_token, freq); +} + +void wpas_notify_dpp_gas_query_done(struct wpa_supplicant *wpa_s, const u8 *addr, + int dialog_token, unsigned int freq, int status_code, const char *res) +{ + wpas_dbus_signal_dpp_gas_query_done(wpa_s, addr, dialog_token, freq, status_code, res); +} + +void wpas_notify_dpp_conf_received(struct wpa_supplicant *wpa_s) +{ + wpas_dbus_signal_dpp_conf_received(wpa_s); +} + +void wpas_notify_dpp_conf_failed(struct wpa_supplicant *wpa_s) +{ + wpas_dbus_signal_dpp_conf_failed(wpa_s); +} +void wpas_notify_dpp_confobj_ssid(struct wpa_supplicant *wpa_s, const char *ssid) +{ + wpas_dbus_signal_dpp_confobj_ssid(wpa_s, ssid); +} + +void wpas_notify_dpp_confobj_pass(struct wpa_supplicant *wpa_s, const char *pass) +{ + wpas_dbus_signal_dpp_confobj_pass(wpa_s, pass); +} + +void wpas_notify_dpp_confobj_akm(struct wpa_supplicant *wpa_s, int akm) +{ + wpas_dbus_signal_dpp_confobj_akm(wpa_s, akm); +} + +void wpas_notify_dpp_network_id(struct wpa_supplicant *wpa_s, int network_id) +{ + wpas_dbus_signal_dpp_network_id(wpa_s, network_id); +} + +void wpas_notify_dpp_wpa_completed(struct wpa_supplicant *wpa_s, const char *ssid) +{ + wpas_dbus_signal_dpp_wpa_completed(wpa_s, ssid); +} +void wpas_notify_dpp_conf_req_rx(struct wpa_supplicant *wpa_s, const u8 *addr) +{ + wpas_dbus_signal_dpp_conf_req_rx(wpa_s, addr); +} + +void wpas_notify_dpp_conf_sent(struct wpa_supplicant *wpa_s) +{ + wpas_dbus_signal_dpp_conf_sent(wpa_s); +} + +void wpas_notify_dpp_pkex_t_limit(struct wpa_supplicant *wpa_s) +{ + wpas_dbus_signal_dpp_pkex_t_limit(wpa_s); +} #endif /* CONFIG_DPP */ diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h index 7f0dfb587..82bc21dc2 100644 --- a/wpa_supplicant/notify.h +++ b/wpa_supplicant/notify.h @@ -159,5 +159,20 @@ void wpas_notify_dpp_tx_status(struct wpa_supplicant *wpa_s, const u8 *dst, void wpas_notify_dpp_rx(struct wpa_supplicant *wpa_s, const u8 *src, unsigned int freq, int type); void wpas_notify_dpp_failed(struct wpa_supplicant *wpa_s, const char *res); +void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s, int initiator); +void wpas_notify_dpp_gas_query_start(struct wpa_supplicant *wpa_s, const u8 *addr, + int dialog_token, unsigned int freq); +void wpas_notify_dpp_gas_query_done(struct wpa_supplicant *wpa_s, const u8 *addr, + int dialog_token, unsigned int freq, int status_code, const char *res); +void wpas_notify_dpp_conf_received(struct wpa_supplicant *wpa_s); +void wpas_notify_dpp_conf_failed(struct wpa_supplicant *wpa_s); +void wpas_notify_dpp_confobj_ssid(struct wpa_supplicant *wpa_s, const char *ssid); +void wpas_notify_dpp_confobj_pass(struct wpa_supplicant *wpa_s, const char *pass); +void wpas_notify_dpp_confobj_akm(struct wpa_supplicant *wpa_s, int akm); +void wpas_notify_dpp_network_id(struct wpa_supplicant *wpa_s, int network_id); +void wpas_notify_dpp_wpa_completed(struct wpa_supplicant *wpa_s, const char *ssid); +void wpas_notify_dpp_conf_req_rx(struct wpa_supplicant *wpa_s, const u8 *addr); +void wpas_notify_dpp_conf_sent(struct wpa_supplicant *wpa_s); +void wpas_notify_dpp_pkex_t_limit(struct wpa_supplicant *wpa_s); #endif /* CONFIG_DPP */ #endif /* NOTIFY_H */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index e587d7e3c..1dd621654 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -905,6 +905,10 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, ssid && ssid->id_str ? ssid->id_str : "", fils_hlp_sent ? " FILS_HLP_SENT" : ""); #endif /* CONFIG_CTRL_IFACE || !CONFIG_NO_STDOUT_DEBUG */ +#ifdef CONFIG_DPP + if(wpa_s->dpp_gas_client) + wpas_notify_dpp_wpa_completed(wpa_s, ssid->ssid); +#endif wpas_clear_temp_disabled(wpa_s, ssid, 1); wpa_blacklist_clear(wpa_s); wpa_s->extra_blacklist_count = 0; -- 2.17.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap