From bbf133ff466e814ed75ecdb300b3d889a2bf8beb Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 25 Dec 2021 17:25:38 +0100 Subject: [PATCH] policy: fix not selecting better candidate on request 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 --- event.h | 2 ++ policy.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/event.h b/event.h index 57b35a0..86d9232 100644 --- 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; diff --git a/policy.c b/policy.c index 08ab902..04a1b3c 100644 --- 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; -- 2.30.2