From patchwork Wed Mar 20 07:30:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya X-Patchwork-Id: 229257 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]) by ozlabs.org (Postfix) with ESMTP id EFA712C00AA for ; Wed, 20 Mar 2013 18:31:07 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 5D8EF9C1BE; Wed, 20 Mar 2013 03:31:05 -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 5+bLef5NUl6J; Wed, 20 Mar 2013 03:31:05 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 1F3C19C1C0; Wed, 20 Mar 2013 03:31:01 -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 07B129C1C0 for ; Wed, 20 Mar 2013 03:31:00 -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 yp1gUjgj0AAy for ; Wed, 20 Mar 2013 03:30:56 -0400 (EDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 0F27D9C1BE for ; Wed, 20 Mar 2013 03:30:55 -0400 (EDT) Received: by mail-pb0-f50.google.com with SMTP id up1so1106959pbc.23 for ; Wed, 20 Mar 2013 00:30:55 -0700 (PDT) X-Received: by 10.66.172.36 with SMTP id az4mr7542694pac.103.1363764654962; Wed, 20 Mar 2013 00:30:54 -0700 (PDT) Received: from [192.168.10.129] ([122.183.20.86]) by mx.google.com with ESMTPS id qp13sm1136249pbb.3.2013.03.20.00.30.51 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Mar 2013 00:30:53 -0700 (PDT) Message-ID: <514965A8.5050804@gmail.com> Date: Wed, 20 Mar 2013 13:00:48 +0530 From: Chaitanya TK User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: hostap@lists.shmoo.com Subject: [PATCH] Omit P2P Group Info, in case of no connected peers References: <201303200723.r2K7NapG012507@chaitanya-desktop> In-Reply-To: <201303200723.r2K7NapG012507@chaitanya-desktop> X-Forwarded-Message-Id: <201303200723.r2K7NapG012507@chaitanya-desktop> Cc: j@w1.fi X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list Reply-To: chaitanyatk@posedge.com 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 As per P2P-sec V1.2: "The P2P Group Info attribute shall be omitted if there are zero connected P2P Clients." Don't add the IE if the no of peers are zero. Signed-hostap: Chaitanya T K --- @Jan/Arend, In that particular line, "+" sign is not there because of the line wrapping. The patch applied cleanly, so that should not be an issue. --- src/p2p/p2p_group.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c index edb8d72..697aa64 100644 --- a/src/p2p/p2p_group.c +++ b/src/p2p/p2p_group.c @@ -413,14 +413,16 @@ static struct wpabuf * p2p_group_build_probe_resp_ie(struct p2p_group *group) /* P2P Device Info */ p2p_buf_add_device_info(p2p_subelems, group->p2p, NULL); - /* P2P Group Info */ - group_info = wpabuf_put(p2p_subelems, 0); - wpabuf_put_u8(p2p_subelems, P2P_ATTR_GROUP_INFO); - wpabuf_put_le16(p2p_subelems, 0); /* Length to be filled */ - for (m = group->members; m; m = m->next) - p2p_client_info(p2p_subelems, m); - WPA_PUT_LE16(group_info + 1, + /* P2P Group Info: Only when at least 1 P2P CLI is connected */ + if (group->members != 0) { + group_info = wpabuf_put(p2p_subelems, 0); + wpabuf_put_u8(p2p_subelems, P2P_ATTR_GROUP_INFO); + wpabuf_put_le16(p2p_subelems, 0); /* Length to be filled */ + for (m = group->members; m; m = m->next) + p2p_client_info(p2p_subelems, m); + WPA_PUT_LE16(group_info + 1, (u8 *) wpabuf_put(p2p_subelems, 0) - group_info - 3); + } ie = p2p_group_encaps_probe_resp(p2p_subelems); wpabuf_free(p2p_subelems);