]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WFD: Clear wfd_subelems when P2P peer stops sending them
authorMayank Haarit <mayank.h@samsung.com>
Wed, 7 Dec 2016 15:17:16 +0000 (20:47 +0530)
committerJouni Malinen <j@w1.fi>
Sun, 11 Dec 2016 10:45:08 +0000 (12:45 +0200)
When a peer device stops sending wfd_subelems, wpa_supplicant should
remove dev->info.wfd_subelems from peer's properties. Previously,
wpa_supplicant left the previously learned dev->info.wfd_subelems in
place whenever the new message did not include wfd_subelems.

In addition to fixing the clearing of the old wfd_subelems, this
resolves another issue. As "wfd_changed" variable becomes true even when
peer stops sending wfd_subelems and dev->info.wfd_subelems has an old
value, a new P2P-DEVICE-FOUND event notification was sent again and
again to upper layers whenever a new discovery response was received
from the peer that previously advertised WFD subelements.

Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
src/p2p/p2p.c

index 170e4778a2b31ed7e6d9c1ea50e122c094071403..3e1e8961a655c1f23262c52ec597b257accaf834 100644 (file)
@@ -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);
+               if (msg.wfd_subelems)
+                       dev->info.wfd_subelems = wpabuf_dup(msg.wfd_subelems);
+               else
+                       dev->info.wfd_subelems = NULL;
        }
 
        if (scan_res) {