3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

station: Don't expire BSSes between freq subset scans

Add a parameter to station_set_scan_results to allow skipping the
removal of old BSSes.  In the DBus-triggered scan only expire BSSes
after having gone through the full supported frequency set.

It should be safe to pass partial scan results to
station_set_scan_results() when not expiring BSSes so using this new
parameter I guess we could also call it for roam scan results.
This commit is contained in:
Andrew Zaborowski 2020-12-17 02:28:59 +01:00 committed by Denis Kenzior
parent e3bece76f9
commit f5a30a1cfc
3 changed files with 25 additions and 12 deletions

View File

@ -610,7 +610,8 @@ static bool station_start_anqp(struct station *station, struct network *network,
*/
void station_set_scan_results(struct station *station,
struct l_queue *new_bss_list,
bool add_to_autoconnect)
bool add_to_autoconnect,
bool expire)
{
const struct l_queue_entry *bss_entry;
struct network *network;
@ -624,7 +625,8 @@ void station_set_scan_results(struct station *station,
l_queue_destroy(station->autoconnect_list, l_free);
station->autoconnect_list = l_queue_new();
station_bss_list_remove_expired_bsses(station);
if (expire)
station_bss_list_remove_expired_bsses(station);
for (bss_entry = l_queue_get_entries(station->bss_list); bss_entry;
bss_entry = bss_entry->next) {
@ -1022,7 +1024,7 @@ static bool new_scan_results(int err, struct l_queue *bss_list, void *userdata)
return false;
autoconnect = station_is_autoconnecting(station);
station_set_scan_results(station, bss_list, autoconnect);
station_set_scan_results(station, bss_list, autoconnect, true);
return true;
}
@ -1088,7 +1090,7 @@ static bool station_quick_scan_results(int err, struct l_queue *bss_list,
goto done;
autoconnect = station_is_autoconnecting(station);
station_set_scan_results(station, bss_list, autoconnect);
station_set_scan_results(station, bss_list, autoconnect, true);
done:
if (station->state == STATION_STATE_AUTOCONNECT_QUICK)
@ -2889,10 +2891,21 @@ static struct l_dbus_message *station_dbus_get_hidden_access_points(
return reply;
}
static void station_dbus_scan_done(struct station *station)
static void station_dbus_scan_done(struct station *station, bool expired)
{
station->dbus_scan_id = 0;
if (!expired) {
/*
* We haven't dropped old BSS records from bss_list during
* this scan yet so do it now. Call station_set_scan_results
* with an empty new BSS list to do this. Not the cheapest
* but this should only happen when station_dbus_scan_done is
* called early, i.e. due to an error.
*/
station_set_scan_results(station, l_queue_new(), false, true);
}
station_property_set_scanning(station, false);
}
@ -2910,7 +2923,7 @@ static void station_dbus_scan_triggered(int err, void *user_data)
dbus_pending_reply(&station->scan_pending, reply);
}
station_dbus_scan_done(station);
station_dbus_scan_done(station, false);
return;
}
@ -2937,7 +2950,7 @@ static bool station_dbus_scan_results(int err, struct l_queue *bss_list, void *u
bool last_subset;
if (err) {
station_dbus_scan_done(station);
station_dbus_scan_done(station, false);
return false;
}
@ -2945,12 +2958,12 @@ static bool station_dbus_scan_results(int err, struct l_queue *bss_list, void *u
last_subset = next_idx >= L_ARRAY_SIZE(station->scan_freqs_order) ||
station->scan_freqs_order[next_idx] == NULL;
station_set_scan_results(station, bss_list, autoconnect);
station_set_scan_results(station, bss_list, autoconnect, last_subset);
station->dbus_scan_subset_idx = next_idx;
if (last_subset || !station_dbus_scan_subset(station))
station_dbus_scan_done(station);
station_dbus_scan_done(station, last_subset);
return true;
}

View File

@ -65,7 +65,7 @@ struct network *station_network_find(struct station *station, const char *ssid,
enum security security);
void station_set_scan_results(struct station *station, struct l_queue *bss_list,
bool add_to_autoconnect);
bool add_to_autoconnect, bool expire);
enum station_state station_get_state(struct station *station);
uint32_t station_add_state_watch(struct station *station,

View File

@ -787,7 +787,7 @@ static bool push_button_scan_results(int err, struct l_queue *bss_list,
}
wsc_cancel_scan(wsc);
station_set_scan_results(wsc->station, bss_list, false);
station_set_scan_results(wsc->station, bss_list, false, true);
l_debug("Found AP to connect to: %s",
util_address_to_string(target->addr));
@ -931,7 +931,7 @@ static bool pin_scan_results(int err, struct l_queue *bss_list, void *userdata)
}
wsc_cancel_scan(wsc);
station_set_scan_results(wsc->station, bss_list, false);
station_set_scan_results(wsc->station, bss_list, false, true);
l_debug("Found AP to connect to: %s",
util_address_to_string(target->addr));