From patchwork Wed Oct 23 14:31:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peer, Ilan" X-Patchwork-Id: 285678 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 2C12B2C020A for ; Thu, 24 Oct 2013 01:31:58 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 5C2679C11F; Wed, 23 Oct 2013 10:31:54 -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 yS1a6HObzc0u; Wed, 23 Oct 2013 10:31:54 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 7B90D9C131; Wed, 23 Oct 2013 10:31:49 -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 B9C1D9C11F for ; Wed, 23 Oct 2013 10:31:48 -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 yn0EsrNlcGOv for ; Wed, 23 Oct 2013 10:31:43 -0400 (EDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 492229C131 for ; Wed, 23 Oct 2013 10:31:35 -0400 (EDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 23 Oct 2013 07:31:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,554,1378882800"; d="scan'208";a="421408072" Received: from fmsmsx105.amr.corp.intel.com ([10.19.9.36]) by fmsmga002.fm.intel.com with ESMTP; 23 Oct 2013 07:31:34 -0700 Received: from hasmsx152.ger.corp.intel.com (10.184.195.15) by FMSMSX105.amr.corp.intel.com (10.19.9.36) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 23 Oct 2013 07:31:33 -0700 Received: from hasmsx106.ger.corp.intel.com ([169.254.2.14]) by HASMSX152.ger.corp.intel.com ([169.254.3.104]) with mapi id 14.03.0123.003; Wed, 23 Oct 2013 17:31:31 +0300 From: "Peer, Ilan" To: "hostap@lists.shmoo.com" Subject: RE: [PATCH v2] wpa_supplicant: Add a configuration file for the P2P_DEVICE parameters Thread-Topic: [PATCH v2] wpa_supplicant: Add a configuration file for the P2P_DEVICE parameters Thread-Index: AQHOp+G0rZyTV09Sf0yqp/46/GcniJoCqUXA Date: Wed, 23 Oct 2013 14:31:30 +0000 Message-ID: References: <1378125660-16627-1-git-send-email-ilan.peer@intel.com> <1378125660-16627-2-git-send-email-ilan.peer@intel.com> In-Reply-To: <1378125660-16627-2-git-send-email-ilan.peer@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.184.70.13] MIME-Version: 1.0 X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 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 Hi Jouni, Did you get a chance to look at this patch? Thanks in advance, Ilan. -----Original Message----- From: Peer, Ilan Sent: Monday, September 02, 2013 15:41 To: hostap@lists.shmoo.com Cc: Peer, Ilan Subject: [PATCH v2] wpa_supplicant: Add a configuration file for the P2P_DEVICE parameters Add an option to specify a configuration file that can be used to hold the P2P_DEVICE configuration parameters. If this option is not used, the P2P_DEVICE configuration parameters will be read from interface configuration file. Note that it is advised to use this option in some cases such as: 1. If a P2P_DEVICE is supported by the driver, the wpa_supplicant creates a dedicated P2P Device interface, where the configuration file used for the main interface is used. As a consequence, if the configuration file includes network definition etc., the wpa_supplicant will try to perform station specific flows on the P2P Device interface which will fail. 2. If a P2P_DEVICE is supported by the driver and update_config is used, the P2P Device configuration data will override the main interface configuration data. Signed-hostap: Ilan Peer --- wpa_supplicant/README | 3 ++- wpa_supplicant/main.c | 13 ++++++++++++- wpa_supplicant/p2p_supplicant.c | 15 ++++++++++++++- wpa_supplicant/wpa_supplicant.c | 10 ++++++++++ wpa_supplicant/wpa_supplicant_i.h | 16 ++++++++++++++++ 5 files changed, 54 insertions(+), 3 deletions(-) -- 1.7.10.4 diff --git a/wpa_supplicant/README b/wpa_supplicant/README index 78df89e..c215845 100644 --- a/wpa_supplicant/README +++ b/wpa_supplicant/README @@ -413,7 +413,7 @@ usage: [-G] \ -i -c [-C] [-D] [-p] \ [-b [-N -i -c [-C] [-D] \ - [-p] [-b] ...] + [-p] [-b] [-m] ... options: -b = optional bridge interface name @@ -438,6 +438,7 @@ options: -w = wait for interface to be added, if needed -W = wait for a control interface monitor before starting -N = start describing new interface + -m = Configuration file for the P2P Device drivers: nl80211 = Linux nl80211/cfg80211 diff --git a/wpa_supplicant/main.c b/wpa_supplicant/main.c index 39b837e..430b68b 100644 --- a/wpa_supplicant/main.c +++ b/wpa_supplicant/main.c @@ -35,6 +35,9 @@ static void usage(void) " [-N -i -c [-C] " "[-D] \\\n" " [-p] [-b] [-I] " +#ifdef CONFIG_P2P + " [-m] " +#endif "...]\n" "\n" "drivers:\n", @@ -83,6 +86,9 @@ static void usage(void) #endif /* CONFIG_DBUS */ printf(" -v = show version\n" " -W = wait for a control interface monitor before starting\n" +#ifdef CONFIG_P2P + " -m = Configuration file for the P2P Device interface\n" +#endif /* CONFIG_P2P */ " -N = start describing new interface\n"); printf("example:\n" @@ -160,7 +166,7 @@ int main(int argc, char *argv[]) for (;;) { c = getopt(argc, argv, - "b:Bc:C:D:de:f:g:G:hi:I:KLNo:O:p:P:qsTtuvW"); + "b:Bc:C:D:de:f:g:G:hi:I:KLNo:O:p:P:qsTtuvWm:"); if (c < 0) break; switch (c) { @@ -213,6 +219,11 @@ int main(int argc, char *argv[]) case 'I': iface->confanother = optarg; break; +#ifdef CONFIG_P2P + case 'm': + iface->conf_p2p_dev = optarg; + break; +#endif /* CONFIG_P2P */ case 'K': params.wpa_debug_show_keys++; break; diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index c0e8651..c19109d 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3145,7 +3145,20 @@ int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s) iface.ifname = wpa_s->pending_interface_name; iface.driver = wpa_s->driver->name; iface.driver_param = wpa_s->conf->driver_param; - iface.confname = wpa_s->confname; + + /* + * If a P2P Device configuration file was given, use it as the interface + * configuration file (instead of using parent's configuration file. + */ + if (wpa_s->conf_p2p_dev) { + iface.confname = wpa_s->conf_p2p_dev; + iface.ctrl_interface = NULL; + } else { + iface.confname = wpa_s->confname; + iface.ctrl_interface = wpa_s->conf->ctrl_interface; + } + iface.conf_p2p_dev = NULL; + p2pdev_wpa_s = wpa_supplicant_add_iface(wpa_s->global, &iface); if (!p2pdev_wpa_s) { wpa_printf(MSG_DEBUG, "P2P: Failed to add P2P Device interface"); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index c274f3c..f388098 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -404,6 +404,11 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s) os_free(wpa_s->confanother); wpa_s->confanother = NULL; +#ifdef CONFIG_P2P + os_free(wpa_s->conf_p2p_dev); + wpa_s->conf_p2p_dev = NULL; +#endif /* CONFIG_P2P */ + wpa_sm_set_eapol(wpa_s->wpa, NULL); eapol_sm_deinit(wpa_s->eapol); wpa_s->eapol = NULL; @@ -2826,6 +2831,11 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, wpa_s->confanother = os_rel2abs_path(iface->confanother); wpa_config_read(wpa_s->confanother, wpa_s->conf); +#ifdef CONFIG_P2P + wpa_s->conf_p2p_dev = os_rel2abs_path(iface->conf_p2p_dev); + wpa_config_read(wpa_s->conf_p2p_dev, wpa_s->conf); #endif /* +CONFIG_P2P */ + /* * Override ctrl_interface and driver_param if set on command * line. diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index d69cd61..f7b21c9 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -63,6 +63,17 @@ struct wpa_interface { */ const char *confanother; +#ifdef CONFIG_P2P + /** + * conf_p2p_dev - Additional configuration file used to hold the + * P2P Device configuration parameters. + * + * This can also be %NULL. In such a case, if a P2P Device dedicated + * interfaces is created, the main configuration file will be used. + */ + const char *conf_p2p_dev; +#endif /* CONFIG_P2P */ + /** * ctrl_interface - Control interface parameter * @@ -334,6 +345,11 @@ struct wpa_supplicant { char *confname; char *confanother; + +#ifdef CONFIG_P2P + char *conf_p2p_dev; +#endif /* CONFIG_P2P */ + struct wpa_config *conf; int countermeasures; os_time_t last_michael_mic_error;