From: Rohan Dutta Date: Fri, 21 Mar 2025 09:38:04 +0000 (+0530) Subject: Fix sibling scan results update criteria for different channels X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4435bc1b8abc2b8145a6a10ac5b5cb65b576f344;p=thirdparty%2Fhostap.git Fix sibling scan results update criteria for different channels 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 Signed-off-by: Pooventhiran G Signed-off-by: Rohan Dutta --- diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 8b575534b..6f6e94c55 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -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,