policy: fix not selecting better candidate on request
authorDavid Bauer <mail@david-bauer.net>
Sat, 25 Dec 2021 16:25:38 +0000 (17:25 +0100)
committerDavid Bauer <mail@david-bauer.net>
Sat, 25 Dec 2021 16:40:04 +0000 (17:40 +0100)
A unset bitmask leads to the candidate selection always return no
candidate, even if there is one.

To select a better candidate regardless of it's classification, provide
a bitmask containing all selection criteria.

Signed-off-by: David Bauer <mail@david-bauer.net>
event.h
policy.c

diff --git a/event.h b/event.h
index 57b35a0163554cf327be53f55d9a6dcd6eedfa1b..86d923256c63debdbbdcb7dc3a10110fc05a4ccb 100644 (file)
--- a/event.h
+++ b/event.h
@@ -30,6 +30,8 @@ enum uevent_select_reason {
        UEV_SELECT_REASON_LOAD,
 };
 
+#define UEV_SELECT_REASON_ALL ((1 << UEV_SELECT_REASON_NUM_ASSOC) | (1 << UEV_SELECT_REASON_SIGNAL) | (1 << UEV_SELECT_REASON_LOAD))
+
 struct uevent {
        enum uevent_type type;
        enum uevent_reason reason;
index 08ab90204f75c8a786b55bc5741bba0fe4280743..04a1b3c8ccd2443e01d535f80115e8add130b847 100644 (file)
--- a/policy.c
+++ b/policy.c
@@ -192,7 +192,7 @@ usteer_check_request(struct sta_info *si, enum usteer_event_type type)
                goto out;
        }
 
-       if (!find_better_candidate(si, &ev, 0))
+       if (!find_better_candidate(si, &ev, UEV_SELECT_REASON_ALL))
                goto out;
 
        ev.reason = UEV_REASON_BETTER_CANDIDATE;