]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Continue scanning specified channel with P2P_FIND freq argument
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 13 Mar 2017 10:50:50 +0000 (12:50 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 13 Mar 2017 10:50:50 +0000 (12:50 +0200)
This makes the "P2P_FIND freq=<MHz>" operation more robust by continuing
to include the specified frequency in the consecutive scan rounds
instead of including it only once in the first scan. In other words, the
first scan is only for the specified frequency just like the previous
behavior, but the following scans include all the social channels and
the specified frequency instead of just the previously used social
channels.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/p2p/p2p.c
src/p2p/p2p_i.h

index 1374005f96c910d4169f2472a1ff36ae97901a01..047e59a7f9c3b809e828fe68e1650df309a75ba2 100644 (file)
@@ -1010,8 +1010,10 @@ static void p2p_search(struct p2p_data *p2p)
        }
        p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
 
-       if (p2p->find_type == P2P_FIND_PROGRESSIVE &&
-           (freq = p2p_get_next_prog_freq(p2p)) > 0) {
+       if ((p2p->find_type == P2P_FIND_PROGRESSIVE &&
+           (freq = p2p_get_next_prog_freq(p2p)) > 0) ||
+           (p2p->find_type == P2P_FIND_START_WITH_FULL &&
+            (freq = p2p->find_specified_freq) > 0)) {
                type = P2P_SCAN_SOCIAL_PLUS_ONE;
                p2p_dbg(p2p, "Starting search (+ freq %u)", freq);
        } else {
@@ -1235,6 +1237,10 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
        }
        p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
        p2p->find_type = type;
+       if (freq != 2412 && freq != 2437 && freq != 2462 && freq != 60480)
+               p2p->find_specified_freq = freq;
+       else
+               p2p->find_specified_freq = 0;
        p2p_device_clear_reported(p2p);
        os_memset(p2p->sd_query_no_ack, 0, ETH_ALEN);
        p2p_set_state(p2p, P2P_SEARCH);
@@ -1250,7 +1256,7 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
                if (freq > 0) {
                        /*
                         * Start with the specified channel and then move to
-                        * social channels only scans.
+                        * scans for social channels and this specific channel.
                         */
                        res = p2p->cfg->p2p_scan(p2p->cfg->cb_ctx,
                                                 P2P_SCAN_SPECIFIC, freq,
index 0041d5978c484d7979556813697d57bd0920408f..e995c6d94938284f6989c148e76e33b4c6a20795 100644 (file)
@@ -437,6 +437,7 @@ struct p2p_data {
        int inv_persistent;
 
        enum p2p_discovery_type find_type;
+       int find_specified_freq;
        unsigned int last_p2p_find_timeout;
        u8 last_prog_scan_class;
        u8 last_prog_scan_chan;