From: Jouni Malinen Date: Tue, 12 Feb 2013 16:14:48 +0000 (+0200) Subject: P2P: Do not allow peer update to clear config_methods X-Git-Tag: aosp-kk-from-upstream~565 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=954ee628eee7dd09d99ad7c15ba1164a10a1d219;p=thirdparty%2Fhostap.git P2P: Do not allow peer update to clear config_methods 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 --- diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 55a95b571..ca15d2b3d 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -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; + } } }