]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Support dynamic addition of P2P Device triggering interface
authorJouni Malinen <j@w1.fi>
Mon, 20 Oct 2014 09:42:27 +0000 (12:42 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 21 Oct 2014 14:35:19 +0000 (17:35 +0300)
This moves the addition of P2P Device interface into
wpa_supplicant_add_iface() so that this operation can be done
dynamically when adding an interface to an already running
wpa_supplicant process.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/main.c
wpa_supplicant/wpa_supplicant.c

index e596468455f00bb2092230a9785b1b5d84f4c395..13e976949eb0648d50b1fbe4cd19236e87c84458 100644 (file)
@@ -327,14 +327,6 @@ int main(int argc, char *argv[])
                        exitcode = -1;
                        break;
                }
-#ifdef CONFIG_P2P
-               if (wpa_s->global->p2p == NULL &&
-                   (wpa_s->drv_flags &
-                    WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE) &&
-                   wpas_p2p_add_p2pdev_interface(wpa_s, iface->conf_p2p_dev) <
-                   0)
-                       exitcode = -1;
-#endif /* CONFIG_P2P */
        }
 
        if (exitcode == 0)
index 4ada8ce6ac95ae40eff200857f0919ce6f2276be..27afa8320f4779a7aed81878b9013e94886f0013 100644 (file)
@@ -4028,6 +4028,16 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
        wpa_dbg(wpa_s, MSG_DEBUG, "Added interface %s", wpa_s->ifname);
        wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
 
+#ifdef CONFIG_P2P
+       if (wpa_s->global->p2p == NULL &&
+           (wpa_s->drv_flags & WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE) &&
+           wpas_p2p_add_p2pdev_interface(wpa_s, iface->conf_p2p_dev) < 0) {
+               wpa_printf(MSG_INFO,
+                          "P2P: Failed to enable P2P Device interface");
+               /* Try to continue without. P2P will be disabled. */
+       }
+#endif /* CONFIG_P2P */
+
        return wpa_s;
 }