From 45a51613c4c24067fe0e35b4c084a50124282b36 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 21 Mar 2019 09:03:45 -0700 Subject: [PATCH] netdev: add conf option to set RSSI threshold Environments with several AP's, all at low signal strength may want to lower the roaming RSSI threshold to prevent IWD from roaming excessively. This adds an option 'roam_rssi_threshold', which is still defaulted to -70. --- src/netdev.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index 2edf86a3..62f203bd 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -724,8 +724,8 @@ static void netdev_lost_beacon(struct netdev *netdev) netdev->user_data); } -/* -70 dBm is a popular choice for low signal threshold for roaming */ -#define LOW_SIGNAL_THRESHOLD -70 +/* Threshold RSSI for roaming to trigger, configurable in main.conf */ +static int LOW_SIGNAL_THRESHOLD; static void netdev_cqm_event_rssi_threshold(struct netdev *netdev, uint32_t rssi_event) @@ -5054,6 +5054,8 @@ bool netdev_watch_remove(uint32_t id) bool netdev_init(const char *whitelist, const char *blacklist) { + const struct l_settings *settings = iwd_get_config(); + if (rtnl) return false; @@ -5075,6 +5077,10 @@ bool netdev_init(const char *whitelist, const char *blacklist) return false; } + if (!l_settings_get_int(settings, "General", "roam_rssi_threshold", + &LOW_SIGNAL_THRESHOLD)) + LOW_SIGNAL_THRESHOLD = -70; + watchlist_init(&netdev_watches, NULL); netdev_list = l_queue_new();