diff mbox

P2Ps: When peer has stopped sending adv_service_instance then we should clear existing dev->info.p2ps_instance.

Message ID 1467711705-30402-1-git-send-email-n.chaprana@samsung.com
State Accepted
Headers show

Commit Message

Nishant Chaprana July 5, 2016, 9:41 a.m. UTC
This patch fixes below scenario:
When peer device stops sending adv_service_instance, supplicant does not remove
old dev->info.p2ps_instance from device's property.
This variable should be updated as per peer behaviour and should cleared when
peer stops sending this information.

Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
---
 src/p2p/p2p.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jouni Malinen July 23, 2016, 7:35 p.m. UTC | #1
On Tue, Jul 05, 2016 at 03:11:45PM +0530, Nishant Chaprana wrote:
> This patch fixes below scenario:
> When peer device stops sending adv_service_instance, supplicant does not remove
> old dev->info.p2ps_instance from device's property.
> This variable should be updated as per peer behaviour and should cleared when
> peer stops sending this information.

Thanks, applied.
diff mbox

Patch

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 47abe21..8fa447f 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) {