[PATCH v2] P2P: Handle INTERFACE_DISABLED event on a P2P GO interface
Ilan Peer
ilan.peer
Mon Sep 2 05:40:59 PDT 2013
An INTERFACE_DISABLED event received on an interface that is
currently operating a P2P_GO means that the group session ended.
In such a case, if the interface was dynamically added remove it, and
if not, remove all the network blocks that are temporary, assuming
that if needed a new session will be started by an external entity.
Signed-hostap: Ilan Peer <ilan.peer at intel.com>
---
wpa_supplicant/events.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 69e4030..7bf3d7b 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2580,6 +2580,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
union wpa_event_data *data)
{
struct wpa_supplicant *wpa_s = ctx;
+ struct wpa_ssid *ssid;
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED &&
event != EVENT_INTERFACE_ENABLED &&
@@ -3045,7 +3046,35 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
break;
case EVENT_INTERFACE_DISABLED:
wpa_dbg(wpa_s, MSG_DEBUG, "Interface was disabled");
+#ifdef CONFIG_P2P
+ if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_GO) {
+ /*
+ * The interface was externally disabled. Remove
+ * it assuming an external entity will start a
+ * new session if needed.
+ */
+ wpas_p2p_disconnect(wpa_s);
+ break;
+ }
+#endif /* CONFIG_P2P */
+
wpa_supplicant_mark_disassoc(wpa_s);
+
+#ifdef CONFIG_P2P
+ /*
+ * Since the interface was externally disabled, remove any
+ * temporary network blocks
+ */
+ ssid = wpa_s->conf->ssid;
+ while (ssid) {
+ int id = ssid->id;
+ ssid = ssid->next;
+ if (ssid->p2p_group && ssid->temporary &&
+ ssid->mode == WPAS_MODE_P2P_GO)
+ wpa_config_remove_network(wpa_s->conf, id);
+ }
+#endif /* CONFIG_P2P */
+
wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
break;
case EVENT_CHANNEL_LIST_CHANGED:
--
1.7.10.4
More information about the Hostap
mailing list