core: make auto-connect-blocked-reason more specific

Distinguish between connections blocked from autoconnecting by user
request and connections blocked because they failed (and would fail
again).

Later, the reason will be used to unblock failed connection when some
conditions change.
This commit is contained in:
Beniamino Galvani 2017-09-27 19:00:47 +02:00
parent 46dc919e68
commit b80ee4a72c
4 changed files with 10 additions and 8 deletions

View file

@ -392,7 +392,7 @@ device_state_changed (NMDevice *device,
*/
if (connection) {
nm_settings_connection_set_autoconnect_blocked_reason (connection,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_BLOCKED);
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED);
}
break;
default:

View file

@ -1193,7 +1193,7 @@ pending_ac_state_changed (NMActiveConnection *ac, guint state, guint reason, NMP
* loop.
*/
con = nm_active_connection_get_settings_connection (ac);
nm_settings_connection_set_autoconnect_blocked_reason (con, NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_BLOCKED);
nm_settings_connection_set_autoconnect_blocked_reason (con, NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED);
schedule_activate_check (self, nm_active_connection_get_device (ac));
/* Cleanup */
@ -1267,7 +1267,7 @@ auto_activate_device (NMPolicy *self,
error->message);
g_error_free (error);
nm_settings_connection_set_autoconnect_blocked_reason (best_connection,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_BLOCKED);
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED);
schedule_activate_check (self, device);
return;
}
@ -1473,7 +1473,7 @@ block_autoconnect_for_device (NMPolicy *self, NMDevice *device)
if (nm_device_check_connection_compatible (device, NM_CONNECTION (connection))) {
nm_settings_connection_set_autoconnect_blocked_reason (connection,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_BLOCKED);
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST);
}
}
}
@ -1806,7 +1806,7 @@ device_state_changed (NMDevice *device,
_LOGD (LOGD_DEVICE, "blocking autoconnect of connection '%s' by user request",
nm_settings_connection_get_id (connection));
nm_settings_connection_set_autoconnect_blocked_reason (connection,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_BLOCKED);
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST);
}
}
}

View file

@ -2621,7 +2621,8 @@ nm_settings_connection_set_autoconnect_blocked_reason (NMSettingsConnection *sel
{
g_return_if_fail (NM_IN_SET (reason,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_UNBLOCKED,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_BLOCKED,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_NO_SECRETS));
NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->autoconnect_blocked_reason = reason;
}

View file

@ -84,8 +84,9 @@ typedef enum { /*< skip >*/
typedef enum {
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_UNBLOCKED = 0,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_BLOCKED = 1,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_NO_SECRETS = 2,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST = 1,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED = 2,
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_NO_SECRETS = 3,
} NMSettingsAutoconnectBlockedReason;
struct _NMSettingsConnectionCallId;