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 <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-02-12 18:14:48 +02:00 committed by Jouni Malinen
parent e47588279a
commit 954ee628ee

View file

@ -570,8 +570,18 @@ static void p2p_copy_wps_info(struct p2p_device *dev, int probe_req,
} }
if (!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; 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;
}
} }
} }