aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/events.c
diff options
context:
space:
mode:
authorIlan Peer <ilan.peer@intel.com>2015-06-17 13:18:20 (GMT)
committerJouni Malinen <j@w1.fi>2015-06-19 13:22:26 (GMT)
commitf43c1ae7989c38fe15756f12a9196a1cf798b4d7 (patch)
treeae57b5df37afdbb5bee2f77ca6186d80d005e873 /wpa_supplicant/events.c
parent1ac977bdd51f20c2ee50cebfb79344d3a012db88 (diff)
downloadhostap-f43c1ae7989c38fe15756f12a9196a1cf798b4d7.zip
hostap-f43c1ae7989c38fe15756f12a9196a1cf798b4d7.tar.gz
hostap-f43c1ae7989c38fe15756f12a9196a1cf798b4d7.tar.bz2
P2P: Handle P2P Device dedicated interface parent removal
In case of a network interface removal, check if the interface was also the parent interface of the P2P Device dedicated interface. If this is the case, then stop the P2P Device functionality, and remove the P2P Device dedicated interface. In case that the interface is added again and P2P Device functionality can be enabled again, add a new P2P Device dedicated interface and allow further P2P Device functionality. In case that the P2P Device dedicated interface is re-created, the original P2P Device configuration file is needed, so store it in the global params (instead in the wpa_interface configuration). Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Diffstat (limited to 'wpa_supplicant/events.c')
-rw-r--r--wpa_supplicant/events.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index b615fbd..f15a6a4 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2553,6 +2553,21 @@ wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
wpa_msg(wpa_s, MSG_INFO, "Failed to initialize the "
"driver after interface was added");
}
+
+#ifdef CONFIG_P2P
+ if (!wpa_s->global->p2p &&
+ !wpa_s->global->p2p_disabled &&
+ !wpa_s->conf->p2p_disabled &&
+ (wpa_s->drv_flags &
+ WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE) &&
+ wpas_p2p_add_p2pdev_interface(
+ wpa_s, wpa_s->global->params.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 */
+
break;
case EVENT_INTERFACE_REMOVED:
wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was removed");
@@ -2561,6 +2576,21 @@ wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
l2_packet_deinit(wpa_s->l2);
wpa_s->l2 = NULL;
+
+#ifdef CONFIG_P2P
+ if (wpa_s->global->p2p &&
+ wpa_s->global->p2p_init_wpa_s->parent == wpa_s &&
+ (wpa_s->drv_flags &
+ WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE)) {
+ wpa_dbg(wpa_s, MSG_DEBUG,
+ "Removing P2P Device interface");
+ wpa_supplicant_remove_iface(
+ wpa_s->global, wpa_s->global->p2p_init_wpa_s,
+ 0);
+ wpa_s->global->p2p_init_wpa_s = NULL;
+ }
+#endif /* CONFIG_P2P */
+
#ifdef CONFIG_TERMINATE_ONLASTIF
/* check if last interface */
if (!any_interfaces(wpa_s->global->ifaces))