]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix sibling scan results update criteria for different channels
authorRohan Dutta <quic_drohan@quicinc.com>
Fri, 21 Mar 2025 09:38:04 +0000 (15:08 +0530)
committerJouni Malinen <j@w1.fi>
Sat, 22 Mar 2025 08:55:10 +0000 (10:55 +0200)
When scan results are received for a wpa_s instance, currently, other
wpa_s instances sharing the radio (siblings) will get updated with the
same scan results to reduce scan time.

But if the scan frequencies included in the requests for these siblings
are different, especially when they are exclusive when one wpa_s is a
non-AP MLD with 2.4 GHz and 5 GHz links and another wpa_s is a single
link non-AP MLD with 6 GHz link, the siblings will lose scan results for
the desired frequencies. Fix the sibling scan results update by checking
that they scan the same frequencies and they are not MANUAL_SCAN.

Fixes: 6859f1cb2407 ("Enable sharing of scan result events among virtual interfaces")
Co-developed-by: Pooventhiran G <quic_pooventh@quicinc.com>
Signed-off-by: Pooventhiran G <quic_pooventh@quicinc.com>
Signed-off-by: Rohan Dutta <quic_drohan@quicinc.com>
wpa_supplicant/events.c

index 8b575534be473c20afb0d8adf5f21d90b5b37894..6f6e94c55974e5fd9f631cc4ee489d0db3d31e3b 100644 (file)
@@ -2866,6 +2866,20 @@ static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
 }
 
 
+static bool equal_scan_freq_list(struct wpa_supplicant *self,
+                                struct wpa_supplicant *other)
+{
+       const int *list1, *list2;
+
+       list1 = self->conf->freq_list ? self->conf->freq_list :
+               self->last_scan_freqs;
+       list2 = other->conf->freq_list ? other->conf->freq_list :
+               other->last_scan_freqs;
+
+       return int_array_equal(list1, list2);
+}
+
+
 static int wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
                                             union wpa_event_data *data)
 {
@@ -2893,12 +2907,19 @@ static int wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
        }
 
        /*
-        * Check other interfaces to see if they share the same radio. If
-        * so, they get updated with this same scan info.
+        * Manual scan requests are more specific to a use case than the
+        * normal scan requests; hence, skip updating sibling radios.
+        */
+       if (wpa_s->last_scan_req == MANUAL_SCAN_REQ)
+               return 0;
+
+       /*
+        * Check other interfaces to see if they share the same radio and
+        * frequency list. If so, they get updated with this same scan info.
         */
        dl_list_for_each(ifs, &wpa_s->radio->ifaces, struct wpa_supplicant,
                         radio_list) {
-               if (ifs != wpa_s) {
+               if (ifs != wpa_s && equal_scan_freq_list(wpa_s, ifs)) {
                        wpa_printf(MSG_DEBUG, "%s: Updating scan results from "
                                   "sibling", ifs->ifname);
                        res = _wpa_supplicant_event_scan_results(ifs, data, 0,