From patchwork Tue Dec 27 05:38:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neeraj Garg X-Patchwork-Id: 133296 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 BE8FAB6FC3 for ; Tue, 27 Dec 2011 16:39:10 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A394E9C15F; Tue, 27 Dec 2011 00:39:07 -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 JJg6+N2DDoGH; Tue, 27 Dec 2011 00:39:07 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 519209C144; Tue, 27 Dec 2011 00:39:03 -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 B31709C144 for ; Tue, 27 Dec 2011 00:39:01 -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 IqzDm8GBBWjN for ; Tue, 27 Dec 2011 00:38:57 -0500 (EST) Received: from mms2.broadcom.com (mms2.broadcom.com [216.31.210.18]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A1F929C141 for ; Tue, 27 Dec 2011 00:38:57 -0500 (EST) Received: from [10.16.192.224] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Mon, 26 Dec 2011 21:46:57 -0800 X-Server-Uuid: D3C04415-6FA8-4F2C-93C1-920E106A2031 Received: from SJEXCHCCR02.corp.ad.broadcom.com ([10.16.192.130]) by SJEXCHHUB01.corp.ad.broadcom.com ([10.16.192.224]) with mapi; Mon, 26 Dec 2011 21:38:46 -0800 From: "Neeraj Kumar Garg" To: "hostap@lists.shmoo.com" Date: Mon, 26 Dec 2011 21:38:42 -0800 Subject: [PATCH] Fail p2p_group_add if freq= param is specified and if we are already running legacy STA on a different freq Thread-Topic: [PATCH] Fail p2p_group_add if freq= param is specified and if we are already running legacy STA on a different freq Thread-Index: AczEWcsuBYjX/JbCTIaB/y4KHOdb3A== Message-ID: <2C2F1EBA8050E74EA81502D5740B4BD6BBBCDE6801@SJEXCHCCR02.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: 62E7845B3GG13240421-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 will ensure that if p2p_group_add freq=xxxx is given, then we need to fail it if STA is already associated on a different frequency. Same code already exists in the path of p2p connection with go negotiation but is missing for autonomous GO. Please check if patch is OK. Signed-hostap: Neeraj Garg --- wpa_supplicant/p2p_supplicant.c | 26 +++++++++++++++++++------- 1 files changed, 19 insertions(+), 7 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 5ff94ef..ca0cb98 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3005,7 +3005,7 @@ int wpas_p2p_group_remove(struct wpa_supplicant *wpa_s, const char *ifname) } -static void wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s, +static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s, struct p2p_go_neg_results *params, int freq) { @@ -3064,11 +3064,21 @@ static void wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s, } res = wpa_drv_shared_freq(wpa_s); - if (res > 0 && !freq) { - wpa_printf(MSG_DEBUG, "P2P: Force GO on the channel we are " - "already using on a shared interface"); - params->freq = res; + if (res > 0) { + if (!freq) { + wpa_printf(MSG_DEBUG, "P2P: Force GO on the channel we are " + "already using on a shared interface"); + params->freq = res; + } + else if ((freq != res) && !(wpa_s->drv_flags & + WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT)) { + wpa_printf(MSG_DEBUG, "P2P: Cannot start P2P group " + "on %u MHz while connected on another " + "channel (%u MHz)", freq, res); + return -1; + } } + return 0; } @@ -3163,7 +3173,8 @@ int wpas_p2p_group_add(struct wpa_supplicant *wpa_s, int persistent_group, return -1; } - wpas_p2p_init_go_params(wpa_s, ¶ms, freq); + if (wpas_p2p_init_go_params(wpa_s, ¶ms, freq)) + return -1; p2p_go_params(wpa_s->global->p2p, ¶ms); params.persistent_group = persistent_group; @@ -3246,7 +3257,8 @@ int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s, if (ssid->mode != WPAS_MODE_P2P_GO) return -1; - wpas_p2p_init_go_params(wpa_s, ¶ms, freq); + if (wpas_p2p_init_go_params(wpa_s, ¶ms, freq)) + return -1; params.role_go = 1; if (ssid->passphrase == NULL ||