[PATCH] This patch is to clear existing dev->info.wfd_subelems when peer stops sending wfd_subelems.

Mayank Haarit mayank.h at samsung.com
Wed Dec 7 07:17:16 PST 2016


This patch fixes below scenario:

When peer device stops sending wfd_subelems , then supplicant should remove dev->info.wfd_subelems from device's property.
Currently , Supplicant is not removing old dev->info.wfd_subelems.

Also , Above behaviour generates another issue :

As "wfd_changed" variable becomes true even when peer stops sending wfd_subelems and dev->info.wfd_subelems has an old value.
It results in notifying P2P-DEVICE-FOUND event again and again to upper layer.

Signed-off-by: Mayank Haarit <mayank.h at samsung.com>
---
 src/p2p/p2p.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index cd2fba3..8cc1971 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -839,9 +839,12 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
 
 	wfd_changed = p2p_compare_wfd_info(dev, &msg);
 
-	if (msg.wfd_subelems) {
+	if(wfd_changed)
+	{
 		wpabuf_free(dev->info.wfd_subelems);
-		dev->info.wfd_subelems = wpabuf_dup(msg.wfd_subelems);
+		dev->info.wfd_subelems = NULL;
+		if (msg.wfd_subelems)
+			dev->info.wfd_subelems = wpabuf_dup(msg.wfd_subelems);
 	}
 
 	if (scan_res) {
-- 
1.7.9.5




More information about the Hostap mailing list