Commit e2637760 authored by Dan Williams's avatar Dan Williams

wifi: allow autoconnect on AP/AdHoc mode connections with manual IP configuration

The existing checks assumed that all AP/AdHoc connections would use the
shared IP method.  But what we really want to check for here is whether the
connection is AP/AdHoc.  Leave the existing 'shared' check for backwards

Also move the check above the timestamp check, since the user shouldn't need
to manually set a timestamp just to get an AP-mode connection to autoconnect.
parent 1fd91056
......@@ -920,13 +920,25 @@ can_auto_connect (NMDevice *device,
char **specific_object)
NMDeviceWifi *self = NM_DEVICE_WIFI (device);
NMSettingWireless *s_wifi;
NMAccessPoint *ap;
const char *method = NULL;
const char *method, *mode;
guint64 timestamp = 0;
if (!NM_DEVICE_CLASS (nm_device_wifi_parent_class)->can_auto_connect (device, connection, specific_object))
return FALSE;
s_wifi = nm_connection_get_setting_wireless (connection);
g_return_val_if_fail (s_wifi, FALSE);
/* Always allow autoconnect for shared/Ad-Hoc/AP */
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)
return TRUE;
/* Don't autoconnect to networks that have been tried at least once
* but haven't been successful, since these are often accidental choices
* from the menu and the user may not know the password.
......@@ -936,11 +948,6 @@ can_auto_connect (NMDevice *device,
return FALSE;
/* Use the connection if it's a shared connection */
method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG);
if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED))
return TRUE;
ap = find_first_compatible_ap (self, connection, FALSE);
if (ap) {
/* All good; connection is usable */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment