From 7e608d1def0b3b2304f26f89faaac4aabaca6914 Mon Sep 17 00:00:00 2001 From: Ilan Peer Date: Sun, 18 Jan 2015 20:44:10 -0500 Subject: [PATCH] P2P: Use the correct wpa_s interface to handle P2P state flush A control interface call to flush the current state used the current wpa_s to clear the P2P state even though it might not be the interface controlling the P2P state. Fix it by using the correct interface to flush the P2P state. Signed-off-by: Ilan Peer --- wpa_supplicant/ctrl_iface.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 0afe5cf17..8e71727fd 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -6114,20 +6114,24 @@ static int wpa_supplicant_vendor_cmd(struct wpa_supplicant *wpa_s, char *cmd, static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) { +#ifdef CONFIG_P2P + struct wpa_supplicant *p2p_wpa_s = wpa_s->global->p2p_init_wpa_s ? + wpa_s->global->p2p_init_wpa_s : wpa_s; +#endif /* CONFIG_P2P */ + wpa_dbg(wpa_s, MSG_DEBUG, "Flush all wpa_supplicant state"); #ifdef CONFIG_P2P - wpas_p2p_cancel(wpa_s); - wpas_p2p_stop_find(wpa_s); - p2p_ctrl_flush(wpa_s); - wpas_p2p_group_remove(wpa_s, "*"); - wpas_p2p_service_flush(wpa_s); - wpa_s->global->p2p_disabled = 0; - wpa_s->global->p2p_per_sta_psk = 0; - wpa_s->conf->num_sec_device_types = 0; - wpa_s->p2p_disable_ip_addr_req = 0; - os_free(wpa_s->global->p2p_go_avoid_freq.range); - wpa_s->global->p2p_go_avoid_freq.range = NULL; + wpas_p2p_cancel(p2p_wpa_s); + p2p_ctrl_flush(p2p_wpa_s); + wpas_p2p_group_remove(p2p_wpa_s, "*"); + wpas_p2p_service_flush(p2p_wpa_s); + p2p_wpa_s->global->p2p_disabled = 0; + p2p_wpa_s->global->p2p_per_sta_psk = 0; + p2p_wpa_s->conf->num_sec_device_types = 0; + p2p_wpa_s->p2p_disable_ip_addr_req = 0; + os_free(p2p_wpa_s->global->p2p_go_avoid_freq.range); + p2p_wpa_s->global->p2p_go_avoid_freq.range = NULL; #endif /* CONFIG_P2P */ #ifdef CONFIG_WPS_TESTING