]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not request station mode scans during P2P operations
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 29 Sep 2011 13:53:55 +0000 (16:53 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 29 Sep 2011 13:53:55 +0000 (16:53 +0300)
The P2P search mechanism depends on the same scan functionality that
is used for station mode scans. If these operations are being used
at the same time, scan result processing is not handled properly.
Avoid unexpected behavior by delaying station mode scan requests
if a P2P operation is in progress.

Among other things, this allows the station mode connection attempt
to be continued after a P2P find or group formation has been completed
if the interface is available (i.e., when the P2P group uses a
separate virtual interface).

src/p2p/p2p.c
src/p2p/p2p.h
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/p2p_supplicant.h
wpa_supplicant/scan.c

index c0c59a6f9c0a723c926ea57230e8307853356a6d..62926b544126d9ad210ca3db3059b3a24df44e64 100644 (file)
@@ -3681,3 +3681,11 @@ p2p_get_peer_found(struct p2p_data *p2p, const u8 *addr, int next)
 
        return &dev->info;
 }
+
+
+int p2p_in_progress(struct p2p_data *p2p)
+{
+       if (p2p == NULL)
+               return 0;
+       return p2p->state != P2P_IDLE;
+}
index d01f574547a39202d42d95585013f9b82d0e5d50..4cab3da9a68b7df95b4009747cd6ac26174f98f8 100644 (file)
@@ -1509,4 +1509,11 @@ int p2p_add_wps_vendor_extension(struct p2p_data *p2p,
 int p2p_set_oper_channel(struct p2p_data *p2p, u8 op_reg_class, u8 op_channel,
                         int cfg_op_channel);
 
+/**
+ * p2p_in_progress - Check whether a P2P operation is progress
+ * @p2p: P2P module context from p2p_init()
+ * Returns: 0 if P2P module is idle or 1 if an operation is in progress
+ */
+int p2p_in_progress(struct p2p_data *p2p);
+
 #endif /* P2P_H */
index 9894bfeb39fe8e56f0c8a7e9a488fa99d5bcded8..f1912f3e9614d3c66ea332ce63f7a373ea1fddd3 100644 (file)
@@ -4365,3 +4365,12 @@ int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s)
 
        return 0;
 }
+
+
+int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s)
+{
+       if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
+               return 0;
+
+       return p2p_in_progress(wpa_s->global->p2p);
+}
index ad74217ba9c27ed4a37fb0c539dcbec77ec1657d..9a13f9f6c24eaa76a86fc4412bb6d0c77e712c8d 100644 (file)
@@ -127,5 +127,6 @@ int wpas_p2p_unauthorize(struct wpa_supplicant *wpa_s, const char *addr);
 int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s);
 void wpas_p2p_wps_failed(struct wpa_supplicant *wpa_s,
                         struct wps_event_fail *fail);
+int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s);
 
 #endif /* P2P_SUPPLICANT_H */
index 7689ff6a33f011d91c2899573d8d393b04b908f9..5be661a2e82f0f2da0cbd68528db94ae21e3e047 100644 (file)
@@ -284,6 +284,20 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
                return;
        }
 
+#ifdef CONFIG_P2P
+       if (wpas_p2p_in_progress(wpa_s)) {
+               if (wpa_s->wpa_state == WPA_SCANNING) {
+                       wpa_dbg(wpa_s, MSG_DEBUG, "Delay station mode scan "
+                               "while P2P operation is in progress");
+                       wpa_supplicant_req_scan(wpa_s, 5, 0);
+               } else {
+                       wpa_dbg(wpa_s, MSG_DEBUG, "Do not request scan while "
+                               "P2P operation is in progress");
+               }
+               return;
+       }
+#endif /* CONFIG_P2P */
+
        if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME) ||
            wpa_s->conf->ap_scan == 2)
                max_ssids = 1;