aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/p2p_supplicant.c
diff options
context:
space:
mode:
authorMax Stepanov <Max.Stepanov@intel.com>2015-10-08 09:36:03 (GMT)
committerJouni Malinen <j@w1.fi>2015-10-11 18:42:03 (GMT)
commitcd571e14dda862c64202ab7bf590d14d6c0e9fb6 (patch)
tree52d498080a9512d998444ad8be1bb54fd627edf7 /wpa_supplicant/p2p_supplicant.c
parentecf56c7270aa3f1672e139d3baedc2394874758b (diff)
downloadhostap-cd571e14dda862c64202ab7bf590d14d6c0e9fb6.zip
hostap-cd571e14dda862c64202ab7bf590d14d6c0e9fb6.tar.gz
hostap-cd571e14dda862c64202ab7bf590d14d6c0e9fb6.tar.bz2
P2PS: Fix persistent group reporting in wpas_p2ps_prov_complete()
When one peer doesn't include a persistent group info in PD Request the other peer shouldn't report a persistent group usage with this peer even if such a persistent group exists locally. This condition could be violated in the previous implementation. In case a local persistent group exists and the wpas_p2ps_prov_complete() function is called with persist_ssid parameter set to NULL, wpa_supplicant reported P2PS-PROV-DONE with persist=<idx> instead of conncap=<role> parameter. This happened because the wpas_p2p_get_persistent() function was called without verification whether the persist_ssid was set to NULL. In this case the wpas_p2p_get_persistent() returns the first existing persistent group matching the P2P Device Address without verifying the group's SSID. After that the group ID is used as persist=<idx> parameter of P2PS-PROV-DONE event. Fix the issue by adding persist_ssid and persist_ssid_size verification as a condition for the wpas_p2p_get_persistent() call. Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Diffstat (limited to 'wpa_supplicant/p2p_supplicant.c')
-rw-r--r--wpa_supplicant/p2p_supplicant.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index f7c43a9..fd8252e 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3817,7 +3817,7 @@ static void wpas_p2ps_prov_complete(void *ctx, u8 status, const u8 *dev,
{
struct wpa_supplicant *wpa_s = ctx;
u8 mac[ETH_ALEN];
- struct wpa_ssid *persistent_go, *stale, *s;
+ struct wpa_ssid *persistent_go, *stale, *s = NULL;
int save_config = 0;
struct wpa_supplicant *go_wpa_s;
char feat_cap_str[256];
@@ -3888,8 +3888,9 @@ static void wpas_p2ps_prov_complete(void *ctx, u8 status, const u8 *dev,
}
/* Clean up stale persistent groups with this device */
- s = wpas_p2p_get_persistent(wpa_s, dev, persist_ssid,
- persist_ssid_size);
+ if (persist_ssid && persist_ssid_size)
+ s = wpas_p2p_get_persistent(wpa_s, dev, persist_ssid,
+ persist_ssid_size);
if (persist_ssid && s && s->mode != WPAS_MODE_P2P_GO &&
is_zero_ether_addr(grp_mac)) {