]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - wpa_supplicant/events.c
P2P: Require fresh scan results for persistent group re-invocation
[thirdparty/hostap.git] / wpa_supplicant / events.c
index 8b468101e2539f4b7d52d29e246e9366302e5ab6..4f082d2a9832c7d95490a79dfca2d3d965258820 100644 (file)
@@ -1036,6 +1036,19 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
                 */
 #endif /* CONFIG_P2P */
 
+               if (os_reltime_before(&bss->last_update, &wpa_s->scan_min_time))
+               {
+                       struct os_reltime diff;
+
+                       os_reltime_sub(&wpa_s->scan_min_time,
+                                      &bss->last_update, &diff);
+                       wpa_dbg(wpa_s, MSG_DEBUG,
+                               "   skip - scan result not recent enough (%u.%06u seconds too old)",
+                               (unsigned int) diff.sec,
+                               (unsigned int) diff.usec);
+                       continue;
+               }
+
                /* Matching configuration found */
                return ssid;
        }
@@ -2377,7 +2390,8 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s,
                        "try to re-connect");
                wpa_s->reassociate = 0;
                wpa_s->disconnected = 1;
-               wpa_supplicant_cancel_sched_scan(wpa_s);
+               if (!wpa_s->pno)
+                       wpa_supplicant_cancel_sched_scan(wpa_s);
        }
        bssid = wpa_s->bssid;
        if (is_zero_ether_addr(bssid))
@@ -3015,7 +3029,7 @@ static void wpa_supplicant_update_channel_list(
                wpa_supplicant_req_scan(wpa_s, 0, 0);
        }
 
-       wpas_p2p_update_channel_list(wpa_s);
+       wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_DRIVER);
 }
 
 
@@ -3154,7 +3168,8 @@ static void wpa_supplicant_notify_avoid_freq(struct wpa_supplicant *wpa_s,
                 * The update channel flow will also take care of moving a GO
                 * from the unsafe frequency if needed.
                 */
-               wpas_p2p_update_channel_list(wpa_s);
+               wpas_p2p_update_channel_list(wpa_s,
+                                            WPAS_P2P_CHANNEL_UPDATE_AVOID);
        }
 #endif /* CONFIG_P2P */