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 <jouni@codeaurora.org>
This commit is contained in:
Purushottam Kushwaha 2019-02-01 17:16:40 +05:30 committed by Jouni Malinen
parent 3281c1590d
commit f2a6ac63ee

View file

@ -1172,9 +1172,9 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
u8 seek_count, const char **seek, int freq) u8 seek_count, const char **seek, int freq)
{ {
int res; int res;
struct os_reltime start;
p2p_dbg(p2p, "Starting find (type=%d)", type); p2p_dbg(p2p, "Starting find (type=%d)", type);
os_get_reltime(&p2p->find_start);
if (p2p->p2p_scan_running) { if (p2p->p2p_scan_running) {
p2p_dbg(p2p, "p2p_scan is already 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) if (timeout)
eloop_register_timeout(timeout, 0, p2p_find_timeout, eloop_register_timeout(timeout, 0, p2p_find_timeout,
p2p, NULL); p2p, NULL);
os_get_reltime(&start);
switch (type) { switch (type) {
case P2P_FIND_START_WITH_FULL: case P2P_FIND_START_WITH_FULL:
if (freq > 0) { if (freq > 0) {
@ -1289,6 +1290,9 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
return -1; return -1;
} }
if (!res)
p2p->find_start = start;
if (res != 0 && p2p->p2p_scan_running) { if (res != 0 && p2p->p2p_scan_running) {
p2p_dbg(p2p, "Failed to start p2p_scan - another p2p_scan was already running"); p2p_dbg(p2p, "Failed to start p2p_scan - another p2p_scan was already running");
/* wait for the previous p2p_scan to complete */ /* wait for the previous p2p_scan to complete */