]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not add ctrl interface for P2P_DEVICE (p2p-dev-*)
authorJouni Malinen <j@w1.fi>
Sun, 30 Jun 2013 20:32:13 +0000 (23:32 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 30 Jun 2013 21:36:33 +0000 (00:36 +0300)
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 <j@w1.fi>

wpa_supplicant/p2p_supplicant.c
wpa_supplicant/wpa_supplicant.c

index 37e58961c31effcbae34f9c35a6df8f93ba1a4ab..cbc0a38dd7c07bd3db270fa21f4c23ba1b6e158c 100644 (file)
@@ -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;
index e23b5c644e0a4a02e5634e104de82cf8b57b1ab1..5773013ebf7cdac5ab6ae382b7224283b02353ef 100644 (file)
@@ -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);