From 2bd8887e9f2523d90649ac2fa3afc9839b108f23 Mon Sep 17 00:00:00 2001 From: Qiwei Cai Date: Mon, 29 May 2023 13:11:06 +0800 Subject: [PATCH] P2P: Pass the known BSSID to the driver to optimize scan time After GO negotiation is completed, the P2P Client needs to scan the GO before connecting. Only SSID was specified for this and the driver still might need to scan all channels which wastes time. wpa_supplicant can pass the known BSSID in the scan request in additional P2P cases and this allows the driver sto stop the scan once the specific BSSID is found. This helps reduce some time for P2P connection. Signed-off-by: Jouni Malinen --- wpa_supplicant/scan.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 0212aab3f..e4883d518 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -1184,6 +1184,10 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) params.ssids[0].ssid = wpa_s->go_params->ssid; params.ssids[0].ssid_len = wpa_s->go_params->ssid_len; params.num_ssids = 1; + params.bssid = wpa_s->go_params->peer_interface_addr; + wpa_printf(MSG_DEBUG, "P2P: Use specific BSSID " MACSTR + " (peer interface address) for scan", + MAC2STR(params.bssid)); goto ssid_list_set; } @@ -1194,6 +1198,12 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) params.ssids[0].ssid_len = wpa_s->current_ssid->ssid_len; params.num_ssids = 1; + if (wpa_s->current_ssid->bssid_set) { + params.bssid = wpa_s->current_ssid->bssid; + wpa_printf(MSG_DEBUG, "P2P: Use specific BSSID " + MACSTR " for scan", + MAC2STR(params.bssid)); + } } else { wpa_printf(MSG_DEBUG, "P2P: No specific SSID known for scan during invitation"); }