]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not allow peer update to clear config_methods
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 12 Feb 2013 16:14:48 +0000 (18:14 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 12 Feb 2013 16:14:48 +0000 (18:14 +0200)
It could be possible for the scan results to include two entries for a
peer, one from the Listen state and the second one from the GO role. The
latter could be based on a Beason frame. If that happens and the entry
from GO is processed last, the P2P peer config_methods value could
potentially get cleared since Beacon frames do not include this
information in either WPS or P2P element. Avoid this by allowing the
config_methods value for P2P peers to be updated only if the new value
is non-zero.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/p2p/p2p.c

index 55a95b5710b26e08a787f9de68ab3afbfde2bc40..ca15d2b3d722f1b3863a168f5eca646efc26eed1 100644 (file)
@@ -570,8 +570,18 @@ static void p2p_copy_wps_info(struct p2p_device *dev, int probe_req,
        }
 
        if (!probe_req) {
-               dev->info.config_methods = msg->config_methods ?
+               u16 new_config_methods;
+               new_config_methods = msg->config_methods ?
                        msg->config_methods : msg->wps_config_methods;
+               if (new_config_methods &&
+                   dev->info.config_methods != new_config_methods) {
+                       wpa_printf(MSG_DEBUG, "P2P: Update peer " MACSTR
+                                  " config_methods 0x%x -> 0x%x",
+                                  MAC2STR(dev->info.p2p_device_addr),
+                                  dev->info.config_methods,
+                                  new_config_methods);
+                       dev->info.config_methods = new_config_methods;
+               }
        }
 }