diff --git a/introspection/org.freedesktop.NetworkManager.Settings.Connection.xml b/introspection/org.freedesktop.NetworkManager.Settings.Connection.xml index 6e518677e..9064ecaf3 100644 --- a/introspection/org.freedesktop.NetworkManager.Settings.Connection.xml +++ b/introspection/org.freedesktop.NetworkManager.Settings.Connection.xml @@ -107,7 +107,8 @@ Provide an empty array, to use the current settings. @flags: optional flags argument. Currently supported flags are: "0x1" (to-disk), - "0x2" (in-memory). + "0x2" (in-memory), + "0x20" (block-autoconnect). Unknown flags cause the call to fail. @args: optional arguments dictionary, for extensibility. Currently no arguments are accepted. Specifying unknown keys causes the call diff --git a/libnm-core/nm-dbus-interface.h b/libnm-core/nm-dbus-interface.h index 0b86fbee0..064bcf65d 100644 --- a/libnm-core/nm-dbus-interface.h +++ b/libnm-core/nm-dbus-interface.h @@ -901,6 +901,10 @@ typedef enum { /*< flags >*/ * @NM_SETTINGS_UPDATE2_FLAG_NONE: an alias for numeric zero, no flags set. * @NM_SETTINGS_UPDATE2_FLAG_TO_DISK: to persist the connection to disk. * @NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY: to make the connection in-memory only. + * @NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT: usually, when the connection + * has autoconnect enabled and is modified, it becomes elegible to autoconnect + * right away. Setting this flag, disables autoconnect until the connection + * is manually activated. * * Since: 1.12 */ @@ -908,6 +912,7 @@ typedef enum { /*< flags >*/ NM_SETTINGS_UPDATE2_FLAG_NONE = 0, NM_SETTINGS_UPDATE2_FLAG_TO_DISK = (1LL << 0), NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY = (1LL << 1), + NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT = (1LL << 5), } NMSettingsUpdate2Flags; #endif /* __NM_DBUS_INTERFACE_H__ */ diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index 62a8ca307..2f6d2f218 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -1742,6 +1742,12 @@ update_auth_cb (NMSettingsConnection *self, else log_diff_name = info->new_settings ? "update-settings" : "write-out-to-disk"; + if (NM_FLAGS_HAS (info->flags, NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT)) { + nm_settings_connection_autoconnect_blocked_reason_set (self, + NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST, + TRUE); + } + _update (self, info->new_settings, persist_mode, @@ -1915,7 +1921,8 @@ impl_settings_connection_update2 (NMSettingsConnection *self, const NMSettingsUpdate2Flags flags = (NMSettingsUpdate2Flags) flags_u; if (NM_FLAGS_ANY (flags_u, ~((guint32) (NM_SETTINGS_UPDATE2_FLAG_TO_DISK | - NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY)))) { + NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY | + NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT)))) { error = g_error_new_literal (NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_ARGUMENTS, "Unknown flags");