diff options
author | Eyal Shapira <eyal@wizery.com> | 2012-10-09 23:26:09 +0200 |
---|---|---|
committer | Eyal Shapira <eyal@wizery.com> | 2012-10-10 17:07:52 +0200 |
commit | ba611a1c583af871c72ad50ec0bace0ce03689d2 (patch) | |
tree | 1f568cbd2f8b4452acaf3f09f9de94dbcb92d7af | |
parent | 7b2121a7d004d5859a8e37e107338279db042fe5 (diff) | |
download | external_wpa_supplicant_8_ti-ba611a1c583af871c72ad50ec0bace0ce03689d2.zip external_wpa_supplicant_8_ti-ba611a1c583af871c72ad50ec0bace0ce03689d2.tar.gz external_wpa_supplicant_8_ti-ba611a1c583af871c72ad50ec0bace0ce03689d2.tar.bz2 |
P2P: Don't delete group on non P2P interfaces (UPSTREAM)
p2p_group_remove * calls wpas_p2p_disconnect on all
interfaces including non P2P ones. This has undesired
effects such as disconnecting concurrent connected STA
interfaces as well as emitting P2P-GROUP-REMOVED events
on all interfaces including ones that didn't actually
have a P2P CLI or GO running.
Instead fail explicitly when attempting to p2p disconnect
an interface with no P2P activity.
Signed-off-by: Eyal Shapira <eyal@wizery.com>
-rw-r--r-- | wpa_supplicant/p2p_supplicant.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 3c650c3..b0eb594 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -4916,6 +4916,24 @@ int wpas_p2p_unauthorize(struct wpa_supplicant *wpa_s, const char *addr) return p2p_unauthorize(p2p, peer); } +int wpas_is_p2p_iface(struct wpa_supplicant *wpa_s) +{ + struct wpa_ssid *ssid; + + if (wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) + return 1; + + /* P2P GO in case no group iface */ + if (wpa_s->p2p_group) + return 1; + + /* P2P CLI in case no group iface */ + ssid = wpa_s->current_ssid; + if (ssid && ssid->p2p_group) + return 1; + + return 0; +} /** * wpas_p2p_disconnect - Disconnect from a P2P Group @@ -4934,6 +4952,12 @@ int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s) if (wpa_s == NULL) return -1; + if (!wpas_is_p2p_iface(wpa_s)) { + wpa_printf(MSG_DEBUG, "P2P: No group to disconnect on %s", + wpa_s->ifname); + return -1; + } + wpa_s->removal_reason = P2P_GROUP_REMOVAL_REQUESTED; wpas_p2p_group_delete(wpa_s, 0); |