From: Nishant Chaprana Date: Tue, 5 Jul 2016 09:41:45 +0000 (+0530) Subject: P2Ps: Clear existing value when peer stops sending adv_service_instance X-Git-Tag: hostap_2_6~188 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f282c76ee2735b26048ac753ec553818c0f81f7;p=thirdparty%2Fhostap.git P2Ps: Clear existing value when peer stops sending adv_service_instance If a peer stops sending adv_service_instance, we should clear the existing dev->info.p2ps_instance. This commit fixes the following scenario: When peer device stops sending adv_service_instance, wpa_supplicant did not remove old dev->info.p2ps_instance from device's property. This variable should be updated as per peer behavior and should be cleared when peer stops sending this information. Signed-off-by: Nishant Chaprana --- diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index ea54f7428..996b4e824 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -788,11 +788,11 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, dev->oper_ssid_len = msg.ssid[1]; } - if (msg.adv_service_instance && msg.adv_service_instance_len) { - wpabuf_free(dev->info.p2ps_instance); + wpabuf_free(dev->info.p2ps_instance); + dev->info.p2ps_instance = NULL; + if (msg.adv_service_instance && msg.adv_service_instance_len) dev->info.p2ps_instance = wpabuf_alloc_copy( msg.adv_service_instance, msg.adv_service_instance_len); - } if (freq >= 2412 && freq <= 2484 && msg.ds_params && *msg.ds_params >= 1 && *msg.ds_params <= 14) {