diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2016-02-21 23:04:15 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2016-02-22 17:11:01 +0100 |
commit | f6d0fc3341742a9f122048b072bf8b33d391365f (patch) | |
tree | c1b4602571b115e7c7f16c97fe7786ce9afc2f13 | |
parent | 79b0a4361c297432426940199fce1e54e9dfd2ab (diff) | |
download | NetworkManager-f6d0fc3341742a9f122048b072bf8b33d391365f.tar.gz |
wifi: avoid autoconnecting Ad-Hoc networks with method=auto
This fixes the issue where all Ad-Hoc networks try to connect one after one on
NM startup instead of the managed network that has AP available.
Fixes: e2637760f160f8d790438f3ca26df1b888de7909
-rw-r--r-- | src/devices/wifi/nm-device-wifi.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 18bbfcbf75..64f728d0a5 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -928,12 +928,13 @@ can_auto_connect (NMDevice *device, s_wifi = nm_connection_get_setting_wireless (connection); g_return_val_if_fail (s_wifi, FALSE); - /* Always allow autoconnect for shared/Ad-Hoc/AP */ + /* Always allow autoconnect for AP and non-autoconf Ad-Hoc */ method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG); mode = nm_setting_wireless_get_mode (s_wifi); - if ( g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_ADHOC) == 0 - || g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_AP) == 0 - || g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) == 0) + if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_AP) == 0) + return TRUE; + else if ( g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_ADHOC) == 0 + && g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) != 0) return TRUE; /* Don't autoconnect to networks that have been tried at least once |