From f2a6ac63eeea09b56df3539f7e554974c1e8a326 Mon Sep 17 00:00:00 2001 From: Purushottam Kushwaha Date: Fri, 1 Feb 2019 17:16:40 +0530 Subject: [PATCH] P2P: Update find_start timer only when p2p_scan is started. p2p->find_start timer was updated on each p2p_find call irrespective of p2p_find being successful/failed/rejected. For cases where p2p_find was in progress/pending, another call to p2p_find would be rejected but p2p->find_start timer would still be updated. p2p->find_start is maintained in wpa_supplicant to reject the kernel scan entries before the p2p->find_start time. In above scenario, some of the scan entries could be discarded even if the Probe Respons frame(s) were received during the last scan/p2p_find. This commit changes this to update the p2p->find_start timer only when call to p2p_find is successful, i.e., a new scan is actually started. Signed-off-by: Jouni Malinen --- src/p2p/p2p.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 19fa7b78b..b21b144b4 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -1172,9 +1172,9 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout, u8 seek_count, const char **seek, int freq) { int res; + struct os_reltime start; p2p_dbg(p2p, "Starting find (type=%d)", type); - os_get_reltime(&p2p->find_start); if (p2p->p2p_scan_running) { p2p_dbg(p2p, "p2p_scan is already running"); } @@ -1258,6 +1258,7 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout, if (timeout) eloop_register_timeout(timeout, 0, p2p_find_timeout, p2p, NULL); + os_get_reltime(&start); switch (type) { case P2P_FIND_START_WITH_FULL: if (freq > 0) { @@ -1289,6 +1290,9 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout, return -1; } + if (!res) + p2p->find_start = start; + if (res != 0 && p2p->p2p_scan_running) { p2p_dbg(p2p, "Failed to start p2p_scan - another p2p_scan was already running"); /* wait for the previous p2p_scan to complete */