]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Update find_start timer only when p2p_scan is started.
authorPurushottam Kushwaha <pkushwah@codeaurora.org>
Fri, 1 Feb 2019 11:46:40 +0000 (17:16 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 7 Feb 2019 09:56:35 +0000 (11:56 +0200)
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>
src/p2p/p2p.c

index 19fa7b78b2664a8fdc60804d940f94e13d9ba8cf..b21b144b4e366d33af8527db11ca523b941c3501 100644 (file)
@@ -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 */