From ffad8858370e297b22ff5d9e6e36372755364ec0 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 17 Jul 2011 20:52:49 +0300 Subject: [PATCH] P2P: Set p2p auth/assoc parameter based on connection type Fix the previous code that was hardcoding the p2p parameter based on the driver P2P capability regardless of whether the connection was really used for P2P or not. --- wpa_supplicant/sme.c | 8 +++----- wpa_supplicant/wpa_supplicant.c | 6 +----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 86d6b6a30..b49fd5361 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -227,12 +227,11 @@ void sme_authenticate(struct wpa_supplicant *wpa_s, u8 *pos; size_t len; int res; - int p2p_group; - p2p_group = wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE; pos = wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len; len = sizeof(wpa_s->sme.assoc_req_ie) - wpa_s->sme.assoc_req_ie_len; - res = wpas_p2p_assoc_req_ie(wpa_s, bss, pos, len, p2p_group); + res = wpas_p2p_assoc_req_ie(wpa_s, bss, pos, len, + ssid->p2p_group); if (res >= 0) wpa_s->sme.assoc_req_ie_len += res; } @@ -401,8 +400,7 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode, elems.wpa_ie_len + 2); else wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0); - if (elems.p2p && - (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE)) + if (wpa_s->current_ssid && wpa_s->current_ssid->p2p_group) params.p2p = 1; if (wpa_s->parent->set_sta_uapsd) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 8f835eb1e..3f3e43594 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1348,11 +1348,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_IEEE80211W */ -#ifdef CONFIG_P2P - if (wpa_s->global->p2p && - (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE)) - params.p2p = 1; -#endif /* CONFIG_P2P */ + params.p2p = ssid->p2p_group; if (wpa_s->parent->set_sta_uapsd) params.uapsd = wpa_s->parent->sta_uapsd;