From patchwork Sun Oct 30 18:11:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Jance X-Patchwork-Id: 122656 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 58490B6F7C for ; Mon, 31 Oct 2011 05:12:05 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 917779C231; Sun, 30 Oct 2011 14:12:02 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Bx2X8bPor9sH; Sun, 30 Oct 2011 14:12:02 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 52C529C1AF; Sun, 30 Oct 2011 14:11:58 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id D985B9C1AF for ; Sun, 30 Oct 2011 14:11:56 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FkMouwov7v70 for ; Sun, 30 Oct 2011 14:11:52 -0400 (EDT) Received: from MMS3.broadcom.com (mms3.broadcom.com [216.31.210.19]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id D78519C1A1 for ; Sun, 30 Oct 2011 14:11:51 -0400 (EDT) Received: from [10.16.192.224] by MMS3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Sun, 30 Oct 2011 11:18:12 -0700 X-Server-Uuid: B55A25B1-5D7D-41F8-BC53-C57E7AD3C201 Received: from SJEXCHCCR01.corp.ad.broadcom.com ([10.252.49.130]) by SJEXCHHUB01.corp.ad.broadcom.com ([10.16.192.224]) with mapi; Sun, 30 Oct 2011 11:11:33 -0700 From: "Jithu Jance" To: "hostap@lists.shmoo.com" Date: Sun, 30 Oct 2011 11:11:32 -0700 Subject: [PATCH] Remove P2P Group Client virtual interface on getting a Deauth Event. Thread-Topic: [PATCH] Remove P2P Group Client virtual interface on getting a Deauth Event. Thread-Index: AQHMly1JNWBpnHvn10eMtF3PNU+ojA== Message-ID: <6C370B347C3FE8438C9692873287D2E119560C6AFE@SJEXCHCCR01.corp.ad.broadcom.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-WSS-ID: 62B34B6E0EG6422535-01-01 X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@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);