From patchwork Wed Feb 1 12:37:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neeraj Garg X-Patchwork-Id: 138933 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 D8969B6EF1 for ; Wed, 1 Feb 2012 23:38:08 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 07B729D20D; Wed, 1 Feb 2012 07:38:03 -0500 (EST) 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 ykgWzNkYgc6u; Wed, 1 Feb 2012 07:38:02 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A87539D1FF; Wed, 1 Feb 2012 07:37:57 -0500 (EST) 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 2D99D9D1FF for ; Wed, 1 Feb 2012 07:37:56 -0500 (EST) 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 C-QRW-Zb3evN for ; Wed, 1 Feb 2012 07:37:52 -0500 (EST) Received: from mms1.broadcom.com (mms1.broadcom.com [216.31.210.17]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 35CAE9D1FE for ; Wed, 1 Feb 2012 07:37:52 -0500 (EST) Received: from [10.16.192.232] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Wed, 01 Feb 2012 04:47:09 -0800 X-Server-Uuid: 02CED230-5797-4B57-9875-D5D2FEE4708A Received: from SJEXCHCCR02.corp.ad.broadcom.com ([10.16.192.131]) by SJEXCHHUB02.corp.ad.broadcom.com ([10.16.192.232]) with mapi; Wed, 1 Feb 2012 04:37:38 -0800 From: "Neeraj Kumar Garg" To: "'hostap@lists.shmoo.com'" Date: Wed, 1 Feb 2012 04:37:36 -0800 Subject: [PATCH] P2P: Inviting a p2p device from already running persistent p2p go Thread-Topic: [PATCH] P2P: Inviting a p2p device from already running persistent p2p go Thread-Index: AcyPwhfd+vZ6Gx30RZaAxyonsfcKChRGuE/A Message-ID: <2C2F1EBA8050E74EA81502D5740B4BD6BBDA4D2FC9@SJEXCHCCR02.corp.ad.broadcom.com> References: In-Reply-To: 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: 6337EBC73DS21227596-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 Hello Jouni, Thanks for your earlier comments of adding group=xxx option for a persistent invite. I tried to take that approach but with my limited knowledge, I found it equally unclean from implementation point of view. My patch is based on below understanding: 1. In the receive path of persistent invitation, supplicant code already checks for an already running group. So in that way, it makes more sense to check already running group in persistent= command for transmit case too. 2. We have to use either group= or persistent= command to find out if we are already running a persistent group. Lets say we use p2p_invite peer=xx group=xxx persistent=x command. [Doing automatically without persistent= will be difficult as we might have multiple entries in conf file with same go_dev_addr but different ssid]. For this we have to add the complete code of persistent verification from persistent invite to group invite. 3. Logic is since an application want to do a persistent invite, we can make persistent invite to find out if the group is already running or not. The alternative logic is since group is already running, should the application do a persistent invite or a normal invite. I think both weighs equal in this aspect. From: Neeraj Garg Date: Fri, 21 Oct 2011 12:22:04 +0530 Subject: [PATCH] P2P: Inviting a p2p device from already running persistent p2p go Signed-off-by: Neeraj Garg --- wpa_supplicant/p2p_supplicant.c | 31 ++++++++++++++++++++----------- 1 files changed, 20 insertions(+), 11 deletions(-) mode change 100644 => 100755 wpa_supplicant/p2p_supplicant.c diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c old mode 100644 new mode 100755 index 9af1839..2935e81 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3517,6 +3517,7 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, { enum p2p_invite_role role; u8 *bssid = NULL; + int go; if (ssid->mode == WPAS_MODE_P2P_GO) { role = P2P_INVITE_ROLE_GO; @@ -3525,17 +3526,25 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, "address in invitation command"); return -1; } - if (wpas_p2p_create_iface(wpa_s)) { - if (wpas_p2p_add_group_interface(wpa_s, - WPA_IF_P2P_GO) < 0) { - wpa_printf(MSG_ERROR, "P2P: Failed to " - "allocate a new interface for the " - "group"); - return -1; - } - bssid = wpa_s->pending_interface_addr; - } else - bssid = wpa_s->own_addr; + /* P2P: Check to see if we are already running a persistent group */ + if (wpas_get_p2p_group(wpa_s, ssid->ssid, ssid->ssid_len, &go)) { + if (go) + bssid = wpa_s->own_addr; + } + else { + /* P2P: We are not already running a persistent group so create an interface */ + if (wpas_p2p_create_iface(wpa_s)) { + if (wpas_p2p_add_group_interface(wpa_s, + WPA_IF_P2P_GO) < 0) { + wpa_printf(MSG_ERROR, "P2P: Failed to " + "allocate a new interface for the " + "group"); + return -1; + } + bssid = wpa_s->pending_interface_addr; + } else + bssid = wpa_s->own_addr; + } } else { role = P2P_INVITE_ROLE_CLIENT; peer_addr = ssid->bssid;