From patchwork Sun Oct 28 19:41:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 194745 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 AF25C2C008B for ; Mon, 29 Oct 2012 06:42:05 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 218EB9C175; Sun, 28 Oct 2012 15:42:03 -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 XJxePb2XZFPv; Sun, 28 Oct 2012 15:42:02 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id EED939C17A; Sun, 28 Oct 2012 15:41: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 746E59C17A for ; Sun, 28 Oct 2012 15:41:57 -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 DcfEPW4bTR5N for ; Sun, 28 Oct 2012 15:41:53 -0400 (EDT) Received: from jmaline2.user.openhosting.com (kvm.w1.fi [128.177.28.162]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id E8F9E9C175 for ; Sun, 28 Oct 2012 15:41:53 -0400 (EDT) Received: from jm (91-157-45-131.elisa-laajakaista.fi [91.157.45.131]) (authenticated bits=0) by jmaline2.user.openhosting.com (8.13.8/8.13.8) with ESMTP id q9SJaJaA012258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 28 Oct 2012 15:36:20 -0400 Received: by jm (sSMTP sendmail emulation); Sun, 28 Oct 2012 21:41:50 +0200 Date: Sun, 28 Oct 2012 21:41:50 +0200 From: Jouni Malinen To: hostap@lists.shmoo.com Subject: Re: PATCH:P2P We need to set conf variable for group_idle timeout if application has not set it for p2p_client Message-ID: <20121028194150.GG17172@w1.fi> Mail-Followup-To: hostap@lists.shmoo.com References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Tue, Oct 23, 2012 at 10:19:48AM +0000, Neeraj Kumar Garg wrote: > This patch is to fix the group_removal for p2p_client when the application has not configured the p2p_group_idle timeout to a non-zero value. So wpa_s->conf->p2p_group_idle remains to a default value as 0. But we configure the timeout to P2P_MAX_CLIENT_IDLE if it is p2p_client and application configured value is 0. In the function wpas_p2p_group_idle_timeout(), we check for conf value being 0 and we are not p2p_client. Without the below patch, conf value remains 0 and since current_ssid is removed by wpa_supplicant_mark_disassoc(), we don't have info about current_ssid. Please note that error can be reproduced only if P2P GO is completely removed or no longer in p2p_client range. > > The below patch simply sets the conf value to P2P_MAX_CLIENT_IDLE if timeout has been set. This is somewhat problematic way of solving the issue since it changes the configuration and in case no separate P2P group interface is used, this new value (10) could end up being used for the next P2P group instance and in that case, the local end could be the GO and get unexpected group idle timeouts. I fixed this bit differently: commit 5fbddfdcf1a7322d2929f8034576a24efb9b7334 P2P: Fix default p2p_group_idle timeout for P2P client role Commit 0d30cc240fa36905b034dc9676f9d8da0ac18e56 forced wpa_s->current_ssid to be cleared in wpa_supplicant_mark_disassoc() which gets called from wpa_supplicant_event_disassoc(). This breaks the P2P group idle mechanism for the case where p2p_group_idle is not set (i.e., is the default 0) since wpas_p2p_group_idle_timeout() ignores the timeout in that case if the interface is not recognized as a client interface (which was based on wpa_s->current_ssid being set). Fix this by making wpas_p2p_is_client() default to client case if wpa_s->current_ssid is NULL. This is much more likely case since the P2P GO mode operation would not really clear the pointer without explicit request to disconnect. Signed-hostap: Jouni Malinen diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index be87567..c4e9176 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -4593,8 +4593,15 @@ int wpas_p2p_ext_listen(struct wpa_supplicant *wpa_s, unsigned int period, static int wpas_p2p_is_client(struct wpa_supplicant *wpa_s) { - return wpa_s->current_ssid != NULL && - wpa_s->current_ssid->p2p_group && + if (wpa_s->current_ssid == NULL) { + /* + * current_ssid can be clearead when P2P client interface gets + * disconnected, so assume this interface was used as P2P + * client. + */ + return 1; + } + return wpa_s->current_ssid->p2p_group && wpa_s->current_ssid->mode == WPAS_MODE_INFRA; }