From 0f3203338c858115149581e090d443f4c4d33267 Mon Sep 17 00:00:00 2001 From: Kristian Klausen Date: Thu, 19 Sep 2019 11:28:59 +0200 Subject: [PATCH] wifi: roam aggressively if we on a multi-AP network A multi-AP network isn't always WPA Enterprise or Dynamic WEP. I have seen multi-AP WPA-PSK networks, so lets try to detect them and use a shorter bgscan interval. We can detect them by checking if seen-bssids > 1. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/279 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/248 --- src/supplicant/nm-supplicant-config.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/supplicant/nm-supplicant-config.c b/src/supplicant/nm-supplicant-config.c index 31740730d3..258039953b 100644 --- a/src/supplicant/nm-supplicant-config.c +++ b/src/supplicant/nm-supplicant-config.c @@ -561,6 +561,7 @@ nm_supplicant_config_add_bgscan (NMSupplicantConfig *self, NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; const char *bgscan; + gsize num_seen_bssids; s_wifi = nm_connection_get_setting_wireless (connection); g_assert (s_wifi); @@ -587,14 +588,16 @@ nm_supplicant_config_add_bgscan (NMSupplicantConfig *self, */ bgscan = "simple:30:-70:86400"; - /* If using WPA Enterprise or Dynamic WEP use a shorter bgscan interval on - * the assumption that this is a multi-AP ESS in which we want more reliable - * roaming between APs. Thus trigger scans when the signal is still somewhat - * OK so we have an up-to-date roam candidate list when the signal gets bad. + /* If using WPA Enterprise, Dynamic WEP or we have seen more than one AP use + * a shorter bgscan interval on the assumption that this is a multi-AP ESS + * in which we want more reliable roaming between APs. Thus trigger scans + * when the signal is still somewhat OK so we have an up-to-date roam + * candidate list when the signal gets bad. */ + num_seen_bssids = nm_setting_wireless_get_num_seen_bssids (s_wifi); s_wsec = nm_connection_get_setting_wireless_security (connection); - if (s_wsec) { - if (NM_IN_STRSET (nm_setting_wireless_security_get_key_mgmt (s_wsec), + if (num_seen_bssids > 1 || s_wsec) { + if (num_seen_bssids > 1 || NM_IN_STRSET (nm_setting_wireless_security_get_key_mgmt (s_wsec), "ieee8021x", "wpa-eap")) bgscan = "simple:30:-65:300";