From patchwork Mon Aug 13 13:59:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eyal Shapira X-Patchwork-Id: 176945 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 58BA62C0085 for ; Tue, 14 Aug 2012 00:00:06 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 152A49D2C7; Mon, 13 Aug 2012 10:00: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 YY9KcEr15LCm; Mon, 13 Aug 2012 10:00:02 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id F176E9D2D3; Mon, 13 Aug 2012 09:59: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 E19069D2D3 for ; Mon, 13 Aug 2012 09:59: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 LH7I3OU5I8Z5 for ; Mon, 13 Aug 2012 09:59:52 -0400 (EDT) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) (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 06DEB9D2C7 for ; Mon, 13 Aug 2012 09:59:51 -0400 (EDT) Received: by wibhq12 with SMTP id hq12so2808891wib.5 for ; Mon, 13 Aug 2012 06:59:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=SMCJ/BjaajMAao1cj3g9j3U27ruTTN+gK8XPp1d8Ixc=; b=h4Xk3+ZBn+oUsE2PWup015rz9g5Lb8kpXXaxOQTbvOaW22CAQAmc50RBBSn/XuwoX2 cxn0/f2I+RI43J/vOWWHnOJul36yPD3aCS+fI5c51KN0ip5ITGTsFqSD7E40xAgzBieU EhoNK/AW7akAF/pTdC9EYrjPJ0K4smAxXbuqSv2NyfMjxVorq1+ItRaGHwKDIez2/utp ODtDAkn7mR68lMsoc4mIX1UlFSheGTcCoJGpJRNoOlsJ4ESjViy6BYaFkAc32bKWP2qQ Tui5VqMPKZBZ2bgzCtMDj/1eGFeIT3Sfdlk4PbN4C8PUA1K3QpIes0IhmBZ+2jtCybJe 406A== Received: by 10.180.99.133 with SMTP id eq5mr18820906wib.0.1344866390723; Mon, 13 Aug 2012 06:59:50 -0700 (PDT) Received: from localhost.localdomain ([213.57.153.193]) by mx.google.com with ESMTPS id h9sm16602229wiz.1.2012.08.13.06.59.49 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Aug 2012 06:59:50 -0700 (PDT) From: Eyal Shapira To: Subject: [PATCH] Add P2P IEs to probe requests only when in P2P Date: Mon, 13 Aug 2012 16:59:44 +0300 Message-Id: <1344866384-12147-1-git-send-email-eyal@wizery.com> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQn1MsEqBssOmt39KGm05yp3zdmwdwCLbaIcqreQ/6BrgGjtw+BNlj3RpwXpfaLKs/Sn+5V1 Cc: j@w1.fi 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: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com The current code caused P2P and consquently WPS IEs to be added to any probe as the check was for non null global->p2p. global->p2p gets set whenever P2P is initialized globally and that occurs on the first interface init. Fix this by indicating wps is in use only when in active P2P discovery or connection establishement. (i.e. not P2P_IDLE - either doing search, neg or provisioning) Signed-hostap: Eyal Shapira --- src/p2p/p2p.c | 7 +++++++ src/p2p/p2p.h | 9 +++++++++ wpa_supplicant/p2p_supplicant.c | 7 +++++++ wpa_supplicant/p2p_supplicant.h | 1 + wpa_supplicant/scan.c | 2 +- 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 80b345a..0d8fcf4 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -3959,3 +3959,10 @@ int p2p_in_progress(struct p2p_data *p2p) return 0; return p2p->state != P2P_IDLE && p2p->state != P2P_PROVISIONING; } + +int p2p_non_idle(struct p2p_data *p2p) +{ + if (p2p == NULL) + return 0; + return p2p->state != P2P_IDLE; +} diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 7e47270..81f72c4 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -1688,6 +1688,15 @@ int p2p_set_pref_chan(struct p2p_data *p2p, unsigned int num_pref_chan, int p2p_in_progress(struct p2p_data *p2p); /** + * p2p_non_idle - Check whether P2P is not in P2P_IDLE. That + * means we're in either search, GO neg or provisioing. Once connected + * it's back to idle. p2p_in_progress excludes provisioing. + * @p2p: P2P module context from p2p_init() + * Returns: 0 if P2P module is idle or 1 if an operation is in progress + */ +int p2p_non_idle(struct p2p_data *p2p); + +/** * p2p_other_scan_completed - Notify completion of non-P2P scan * @p2p: P2P module context from p2p_init() * Returns: 0 if P2P module is idle or 1 if an operation was started diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index df65de9..adc799c 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -4828,6 +4828,13 @@ int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s) return p2p_in_progress(wpa_s->global->p2p); } +int wpas_p2p_non_idle(struct wpa_supplicant *wpa_s) +{ + if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) + return 0; + + return p2p_non_idle(wpa_s->global->p2p); +} void wpas_p2p_network_removed(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index e2fe259..dc9f8a9 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -133,6 +133,7 @@ int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s); void wpas_p2p_wps_failed(struct wpa_supplicant *wpa_s, struct wps_event_fail *fail); int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s); +int wpas_p2p_non_idle(struct wpa_supplicant *wpa_s); void wpas_p2p_network_removed(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s, diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 6c3f625..386a3fb 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -66,7 +66,7 @@ static int wpas_wps_in_use(struct wpa_supplicant *wpa_s, } #ifdef CONFIG_P2P - if (!wpa_s->global->p2p_disabled && wpa_s->global->p2p) { + if (wpas_p2p_non_idle(wpa_s)) { wpa_s->wps->dev.p2p = 1; if (!wps) { wps = 1;