From 1e0a02942b9ea867e20a5cdf161510d51e523c71 Mon Sep 17 00:00:00 2001 From: Ilan Peer Date: Tue, 12 May 2015 17:40:00 +0300 Subject: [PATCH] P2P: Fix wpas_p2p_add_persistent_group_client() to use P2P mgmt interface The function used wpa_s->parent->conf to iterate the P2P networks and update the configuration file. However, wpa_s->parent is not necessarily the interface used to manage the P2P Device operations. Fix this by accessing the configuration file of the interface initialized to managed the P2P Device operations. Signed-off-by: Ilan Peer --- wpa_supplicant/p2p_supplicant.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 004d84d..c46e3c9 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -1113,13 +1113,14 @@ static void wpas_p2p_add_persistent_group_client(struct wpa_supplicant *wpa_s, u8 *n; size_t i; int found = 0; + struct wpa_supplicant *p2p_wpa_s = wpa_s->global->p2p_init_wpa_s; ssid = wpa_s->current_ssid; if (ssid == NULL || ssid->mode != WPAS_MODE_P2P_GO || !ssid->p2p_persistent_group) return; - for (s = wpa_s->parent->conf->ssid; s; s = s->next) { + for (s = p2p_wpa_s->conf->ssid; s; s = s->next) { if (s->disabled != 2 || s->mode != WPAS_MODE_P2P_GO) continue; @@ -1178,8 +1179,8 @@ static void wpas_p2p_add_persistent_group_client(struct wpa_supplicant *wpa_s, 0xff, ETH_ALEN); } - if (wpa_s->parent->conf->update_config && - wpa_config_write(wpa_s->parent->confname, wpa_s->parent->conf)) + if (p2p_wpa_s->conf->update_config && + wpa_config_write(p2p_wpa_s->confname, p2p_wpa_s->conf)) wpa_printf(MSG_DEBUG, "P2P: Failed to update configuration"); } -- 2.1.4