Add a new API function wpas_p2p_disconnect() to disconnect from or dissolve a group. Signed-off-by: Johannes Berg --- wpa_supplicant/p2p_supplicant.c | 25 +++++++++++++++++++++++++ wpa_supplicant/p2p_supplicant.h | 1 + 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index d351e4b..6264750 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -4179,3 +4179,28 @@ int wpas_p2p_unauthorize(struct wpa_supplicant *wpa_s, const char *addr) return p2p_unauthorize(p2p, peer); } + + +/** + * wpas_p2p_disconnect + * @wpa_s: Pointer to wpa_supplicant data + * + * Returns: 0 on success, -1 on failure + * + * This can be used to disconnect from a group in which the + * local end is a P2P Client or to end a P2P Group in case the + * local end is the Group Owner. If a virtual network interface + * was created for this group, that interface will be removed. + * Otherwise, only the configured P2P group network will be + * removed from the interface. + */ +int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s) +{ + + if (wpa_s == NULL) + return -1; + + wpas_p2p_group_delete(wpa_s); + + return 0; +} diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index 8b03ce9..5b3b1d2 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -122,5 +122,6 @@ void wpas_p2p_interface_unavailable(struct wpa_supplicant *wpa_s); void wpas_p2p_update_best_channels(struct wpa_supplicant *wpa_s, int freq_24, int freq_5, int freq_overall); int wpas_p2p_unauthorize(struct wpa_supplicant *wpa_s, const char *addr); +int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s); #endif /* P2P_SUPPLICANT_H */ -- 1.7.2.3