From 78f79fe5fc251e3ababa2970956cc9a84f29f209 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 30 Jun 2013 23:32:13 +0300 Subject: [PATCH] P2P: Do not add ctrl interface for P2P_DEVICE (p2p-dev-*) Adding a new wpa_supplicant control interface for the dedicated P2P_DEVICE would be quite confusing for programs that manage P2P operations. Remove this control interface and require the global control interface to be used since it will provide consistent interface for both the new dedicated P2P_DEVICE (non-netdev) and old style P2P management through a netdev. Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 10 ++++++++-- wpa_supplicant/wpa_supplicant.c | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 37e58961c..cbc0a38dd 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -1092,7 +1092,13 @@ wpas_p2p_init_group_interface(struct wpa_supplicant *wpa_s, int go) os_memset(&iface, 0, sizeof(iface)); iface.ifname = wpa_s->pending_interface_name; iface.driver = wpa_s->driver->name; - iface.ctrl_interface = wpa_s->conf->ctrl_interface; + if (wpa_s->conf->ctrl_interface == NULL && + wpa_s->parent != wpa_s && + wpa_s->p2p_mgmt && + (wpa_s->drv_flags & WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE)) + iface.ctrl_interface = wpa_s->parent->conf->ctrl_interface; + else + iface.ctrl_interface = wpa_s->conf->ctrl_interface; iface.driver_param = wpa_s->conf->driver_param; group_wpa_s = wpa_supplicant_add_iface(wpa_s->global, &iface); if (group_wpa_s == NULL) { @@ -3015,7 +3021,6 @@ int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s) iface.p2p_mgmt = 1; iface.ifname = wpa_s->pending_interface_name; iface.driver = wpa_s->driver->name; - iface.ctrl_interface = wpa_s->conf->ctrl_interface; iface.driver_param = wpa_s->conf->driver_param; iface.confname = wpa_s->confname; p2pdev_wpa_s = wpa_supplicant_add_iface(wpa_s->global, &iface); @@ -3023,6 +3028,7 @@ int wpas_p2p_add_p2pdev_interface(struct wpa_supplicant *wpa_s) wpa_printf(MSG_DEBUG, "P2P: Failed to add P2P Device interface"); return -1; } + p2pdev_wpa_s->parent = wpa_s; wpa_s->pending_interface_name[0] = '\0'; return 0; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index e23b5c644..5773013eb 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2838,6 +2838,11 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, wpa_s->conf->driver_param = os_strdup(iface->driver_param); } + + if (iface->p2p_mgmt && !iface->ctrl_interface) { + os_free(wpa_s->conf->ctrl_interface); + wpa_s->conf->ctrl_interface = NULL; + } } else wpa_s->conf = wpa_config_alloc_empty(iface->ctrl_interface, iface->driver_param);