This is similar to the control interface event MESH-GROUP-REMOVED Signed-off-by: Saurav Babu <saurav.babu@xxxxxxxxxxx> --- doc/dbus.doxygen | 9 +++++++++ wpa_supplicant/dbus/dbus_new.c | 38 ++++++++++++++++++++++++++++++++++++++ wpa_supplicant/dbus/dbus_new.h | 8 ++++++++ wpa_supplicant/notify.c | 11 +++++++++++ wpa_supplicant/notify.h | 2 ++ wpa_supplicant/wpa_supplicant.c | 1 + 6 files changed, 69 insertions(+) diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen index 42260f9..a894770 100644 --- a/doc/dbus.doxygen +++ b/doc/dbus.doxygen @@ -2269,6 +2269,15 @@ Interface for performing Mesh operations. <dd>A dictionary containing information of started Mesh Group.</dd> </dl> </li> + <li> + <h3>MeshGroupRemoved ( a{sv} : args )</h3> + <p></p> + <h4>Arguments</h4> + <dl> + <dt>a{sv} : args</dt> + <dd>A dictionary containing information of removed Mesh Group.</dd> + </dl> + </li> </ul> */ diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 3c30cbc..5d77cd8 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -824,6 +824,38 @@ void wpas_dbus_signal_mesh_group_started(struct wpa_supplicant *wpa_s, dbus_connection_send(iface->con, msg, NULL); dbus_message_unref(msg); } + +void wpas_dbus_signal_mesh_group_removed(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid, int reason) +{ + struct wpas_dbus_priv *iface; + DBusMessage *msg; + DBusMessageIter iter, dict_iter; + + 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_MESH, + "MeshGroupRemoved"); + if (msg == NULL) + return; + + dbus_message_iter_init_append(msg, &iter); + if (!wpa_dbus_dict_open_write(&iter, &dict_iter) || + !wpa_dbus_dict_append_byte_array(&dict_iter, "SSID", + (const char *) ssid->ssid, + ssid->ssid_len) || + !wpa_dbus_dict_append_int32(&dict_iter, "DisconnectReason", reason) || + !wpa_dbus_dict_close_write(&iter, &dict_iter)) + wpa_printf(MSG_ERROR, "dbus: Failed to construct signal"); + else + dbus_connection_send(iface->con, msg, NULL); + dbus_message_unref(msg); +} #endif /* CONFIG_MESH */ void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s, @@ -3662,6 +3694,12 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = { END_ARGS } }, + { "MeshGroupRemoved", WPAS_DBUS_NEW_IFACE_MESH, + { + { "args", "a{sv}", ARG_OUT }, + END_ARGS + } + }, #endif /* CONFIG_MESH */ { NULL, NULL, { END_ARGS } } }; diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h index 4c33ac8..b86df20 100644 --- a/wpa_supplicant/dbus/dbus_new.h +++ b/wpa_supplicant/dbus/dbus_new.h @@ -243,6 +243,8 @@ void wpas_dbus_signal_p2p_invitation_received(struct wpa_supplicant *wpa_s, int op_freq); void wpas_dbus_signal_mesh_group_started(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); +void wpas_dbus_signal_mesh_group_removed(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid, int reason); #else /* CONFIG_CTRL_IFACE_DBUS_NEW */ @@ -564,6 +566,12 @@ void wpas_dbus_signal_mesh_group_started(struct wpa_supplicant *wpa_s, { } +static inline +void wpas_dbus_signal_mesh_group_removed(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid, int reason) +{ +} + #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ #endif /* CTRL_IFACE_DBUS_H_NEW */ diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c index 3be1242..b4372e8 100644 --- a/wpa_supplicant/notify.c +++ b/wpa_supplicant/notify.c @@ -861,3 +861,14 @@ void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s, wpas_dbus_signal_mesh_group_started(wpa_s, ssid); #endif /* CONFIG_MESH */ } + +void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid, int reason_code) +{ + if (wpa_s->p2p_mgmt) + return; + +#ifdef CONFIG_MESH + wpas_dbus_signal_mesh_group_removed(wpa_s, ssid, reason_code); +#endif /* CONFIG_MESH */ +} diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h index e620dd2..59ce9e2 100644 --- a/wpa_supplicant/notify.h +++ b/wpa_supplicant/notify.h @@ -143,5 +143,7 @@ void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s, const u8 *bssid, int id, int op_freq); void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); +void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid, int reason_code); #endif /* NOTIFY_H */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 2b13c0b..0d695b1 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2964,6 +2964,7 @@ void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s, if (wpa_s->ifmsh) { wpa_msg(wpa_s, MSG_INFO, MESH_GROUP_REMOVED "%s", wpa_s->ifname); + wpas_notify_mesh_group_removed(wpa_s, wpa_s->last_ssid, reason_code); wpa_supplicant_leave_mesh(wpa_s); } #endif /* CONFIG_MESH */ -- 1.9.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap