From patchwork Sun Oct 30 18:11:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Remove P2P Group Client virtual interface on getting a Deauth Event. Date: Sun, 30 Oct 2011 08:11:32 -0000 From: Jithu Jance X-Patchwork-Id: 122656 Message-Id: <6C370B347C3FE8438C9692873287D2E119560C6AFE@SJEXCHCCR01.corp.ad.broadcom.com> To: "hostap@lists.shmoo.com" This patch removes P2P Group Client virtual interface on getting a Deauth Event. Kindly see whether the patch is okay. Signed-off-by: Jithu Jance --- wpa_supplicant/events.c | 4 ++++ wpa_supplicant/p2p_supplicant.c | 15 +++++++++++++++ wpa_supplicant/p2p_supplicant.h | 2 ++ 3 files changed, 21 insertions(+), 0 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 80ca869..11fc39b 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2024,6 +2024,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, } #endif /* CONFIG_AP */ wpa_supplicant_event_disassoc(wpa_s, reason_code); +#ifdef CONFIG_P2P + wpas_p2p_group_remove_notif(wpa_s, reason_code); +#endif + break; case EVENT_MICHAEL_MIC_FAILURE: wpa_supplicant_event_michael_mic_failure(wpa_s, data); diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 3723c50..8b20003 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3717,6 +3717,21 @@ void wpas_p2p_deauth_notif(struct wpa_supplicant *wpa_s, const u8 *bssid, p2p_deauth_notif(wpa_s->global->p2p, bssid, reason_code, ie, ie_len); } +void wpas_p2p_group_remove_notif(struct wpa_supplicant *wpa_s, u16 reason_code) +{ + if(wpa_s->global->p2p_disabled) + return; + + /* If we are running a P2P Client and we received a Deauth/Disassoc from the Go, then remove + the virutal interface on which the client is running. */ + if((wpa_s != wpa_s->parent) && (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT) && (wpa_s->key_mgmt != WPA_KEY_MGMT_WPS)) { + + wpa_printf(MSG_DEBUG, "P2P: [EVENT_DEAUTH] Removing P2P_CLIENT virtual intf."); + wpa_supplicant_cancel_scan(wpa_s); + wpa_s->removal_reason = P2P_GROUP_REMOVAL_UNAVAILABLE; + wpas_p2p_group_delete(wpa_s); + } +} void wpas_p2p_disassoc_notif(struct wpa_supplicant *wpa_s, const u8 *bssid, u16 reason_code, const u8 *ie, size_t ie_len) diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index 9a13f9f..3387722 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -109,6 +109,8 @@ int wpas_p2p_ext_listen(struct wpa_supplicant *wpa_s, unsigned int period, unsigned int interval); void wpas_p2p_deauth_notif(struct wpa_supplicant *wpa_s, const u8 *bssid, u16 reason_code, const u8 *ie, size_t ie_len); +void wpas_p2p_group_remove_notif(struct wpa_supplicant *wpa_s, + u16 reason_code); void wpas_p2p_disassoc_notif(struct wpa_supplicant *wpa_s, const u8 *bssid, u16 reason_code, const u8 *ie, size_t ie_len); void wpas_p2p_update_config(struct wpa_supplicant *wpa_s);