From: "jeonghwan.yoon" <jeonghwan.yoon@xxxxxxx> Added dbus signal for dpp authentication and configuration process. Signed-off-by: jeonghwan.yoon <jeonghwan.yoon@xxxxxxx> --- doc/dbus.doxygen | 127 ++++++++++++++ wpa_supplicant/dbus/dbus_new.c | 371 +++++++++++++++++++++++++++++++++++++++++ wpa_supplicant/dbus/dbus_new.h | 70 ++++++++ 3 files changed, 568 insertions(+) diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen index 3d1cd2d..fcbdbe8 100644 --- a/doc/dbus.doxygen +++ b/doc/dbus.doxygen @@ -1491,6 +1491,133 @@ Interface for performing DPP (Device Provisioning Protocol) Device operations. </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 3ee7796..3b34248 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -2248,6 +2248,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 a95270a..59f82e2 100644 --- a/wpa_supplicant/dbus/dbus_new.h +++ b/wpa_supplicant/dbus/dbus_new.h @@ -263,6 +263,19 @@ 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_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 */ @@ -623,6 +636,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 */ -- 2.7.4 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap