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

scan: call scan_finished() when periodic scans get aborted

The blamed commit argues that the periodic scan callback doesn't do
anything useful in the event of an aborted scan, but this is not
entirely true. In particular, the callback is responsible for re-arming
the periodic scan timer. Make sure to call scan_finished() so that iwd's
periodic scanning logic continues unabated even when a periodic scan is
aborted.

Also remove the periodic boolean member of struct scan_request, as it
serves no purpose anymore.

Fixes: 6051a14952 ("scan: Don't callback on SCAN_ABORTED")
This commit is contained in:
Alvin Šipraga 2022-12-12 22:10:50 +01:00 committed by Denis Kenzior
parent 3c6a0647b3
commit ed357d78b3

View File

@ -83,7 +83,6 @@ struct scan_request {
bool canceled : 1; /* Is scan_cancel being called on this request? */
bool passive:1; /* Active or Passive scan? */
bool started : 1; /* Has TRIGGER_SCAN succeeded at least once? */
bool periodic : 1; /* Started as a periodic scan? */
/*
* Set to true if the TRIGGER_SCAN command at the head of the 'cmds'
* queue was acked by the kernel indicating that the scan request was
@ -997,7 +996,6 @@ static void scan_periodic_destroy(void *user_data)
static bool scan_periodic_queue(struct scan_context *sc)
{
struct scan_parameters params = {};
struct scan_request *sr;
if (sc->sp.needs_active_scan && known_networks_has_hidden()) {
params.randomize_mac_addr_hint = true;
@ -1015,13 +1013,7 @@ static bool scan_periodic_queue(struct scan_context *sc)
scan_periodic_notify, sc,
scan_periodic_destroy);
if (!sc->sp.id)
return false;
sr = l_queue_peek_tail(sc->requests);
sr->periodic = true;
return true;
return sc->sp.id != 0;
}
static bool scan_periodic_is_disabled(void)
@ -2242,13 +2234,7 @@ static void scan_notify(struct l_genl_msg *msg, void *user_data)
if (sr->triggered) {
sr->triggered = false;
/* If periodic scan, don't report the abort */
if (sr->periodic) {
l_queue_remove(sc->requests, sr);
wiphy_radio_work_done(sc->wiphy, sr->work.id);
} else
scan_finished(sc, -ECANCELED, NULL, NULL, sr);
scan_finished(sc, -ECANCELED, NULL, NULL, sr);
} else if (wiphy_radio_work_is_running(sc->wiphy,
sr->work.id)) {
/*