policy: don't select better candidate with bad signal
authorDavid Bauer <mail@david-bauer.net>
Tue, 21 Dec 2021 13:09:15 +0000 (14:09 +0100)
committerDavid Bauer <mail@david-bauer.net>
Sun, 9 Jan 2022 01:09:26 +0000 (02:09 +0100)
Don't select a node as a better candidate where a STA has insufficient
signal to. This is the case when the roam_trigger_snr is greater than
the projected signal of the client.

This stops clients from being selected to roam to a node where the
signal is not sufficient to maintain the connection. A selection might
otherwise happen e.g. due to better channel load on the remote node.

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

index 2b94d87bd163fbdacd05ff67a7557b5c868aa2c4..445abdefe8d9d57d3420bf01b387b557c67756b3 100644 (file)
--- a/policy.c
+++ b/policy.c
@@ -72,6 +72,18 @@ below_max_assoc(struct sta_info *si)
        return !node->max_assoc || node->n_assoc < node->max_assoc;
 }
 
+static bool
+over_min_signal(struct sta_info *si)
+{
+       if (config.min_snr && si->signal < usteer_snr_to_signal(si->node, config.min_snr))
+               return false;
+
+       if (config.roam_trigger_snr && si->signal < usteer_snr_to_signal(si->node, config.roam_trigger_snr))
+               return false;
+       
+       return true;
+}
+
 static uint32_t
 is_better_candidate(struct sta_info *si_cur, struct sta_info *si_new)
 {
@@ -80,6 +92,9 @@ is_better_candidate(struct sta_info *si_cur, struct sta_info *si_new)
        if (!below_max_assoc(si_new))
                return 0;
 
+       if (!over_min_signal(si_new))
+               return 0;
+
        if (below_assoc_threshold(si_cur, si_new) &&
            !below_assoc_threshold(si_new, si_cur))
                reasons |= (1 << UEV_SELECT_REASON_NUM_ASSOC);