diff --git a/src/nm-manager.c b/src/nm-manager.c index 4698247f0b..36fa9221de 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1561,9 +1561,12 @@ get_existing_connection (NMManager *manager, NMDevice *device) nm_connection_get_id (connection)); added = nm_settings_add_connection (priv->settings, connection, FALSE, &error); - if (added) - nm_settings_connection_set_flags (NM_SETTINGS_CONNECTION (added), NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED, TRUE); - else { + if (added) { + nm_settings_connection_set_flags (NM_SETTINGS_CONNECTION (added), + NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED | + NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED, + TRUE); + } else { nm_log_warn (LOGD_SETTINGS, "(%s) Couldn't save generated connection '%s': %s", nm_device_get_iface (device), nm_connection_get_id (connection), diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index a36f5ecbda..9fa2801dd3 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -405,7 +405,8 @@ set_unsaved (NMSettingsConnection *self, gboolean now_unsaved) flags |= NM_SETTINGS_CONNECTION_FLAGS_UNSAVED; else { flags &= ~(NM_SETTINGS_CONNECTION_FLAGS_UNSAVED | - NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED); + NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED | + NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED); } nm_settings_connection_set_flags_all (self, flags); } @@ -457,7 +458,9 @@ nm_settings_connection_replace_settings (NMSettingsConnection *self, g_signal_handlers_block_by_func (self, G_CALLBACK (changed_cb), GUINT_TO_POINTER (TRUE)); nm_connection_replace_settings_from_connection (NM_CONNECTION (self), new_connection); - nm_settings_connection_set_flags (self, NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED, FALSE); + nm_settings_connection_set_flags (self, + NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED | NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED, + FALSE); /* Cache the just-updated system secrets in case something calls * nm_connection_clear_secrets() and clears them. @@ -2012,6 +2015,21 @@ nm_settings_connection_get_nm_generated (NMSettingsConnection *connection) return NM_FLAGS_HAS (nm_settings_connection_get_flags (connection), NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED); } +/** + * nm_settings_connection_get_nm_generated_assumed: + * @connection: an #NMSettingsConnection + * + * Gets the "nm-generated-assumed" flag on @connection. + * + * The connection is a generated connection especially + * generated for connection assumption. + */ +gboolean +nm_settings_connection_get_nm_generated_assumed (NMSettingsConnection *connection) +{ + return NM_FLAGS_HAS (nm_settings_connection_get_flags (connection), NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED); +} + /**************************************************************/ static void diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-settings-connection.h index 3191e7aad8..254e927bfd 100644 --- a/src/settings/nm-settings-connection.h +++ b/src/settings/nm-settings-connection.h @@ -58,6 +58,9 @@ G_BEGIN_DECLS * @NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED: A connection is "nm-generated" if * it was generated by NetworkManger. If the connection gets modified or saved * by the user, the flag gets cleared. A nm-generated is implicitly unsaved. + * @NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED: A special kind of "nm-generated" + * connection that was specifically created for connection assumption. "nm-generated-assumed" + * implies "nm-generated". * @NM_SETTINGS_CONNECTION_FLAGS_ALL: special mask, for all known flags * * #NMSettingsConnection flags. @@ -67,6 +70,7 @@ typedef enum NM_SETTINGS_CONNECTION_FLAGS_NONE = 0x00, NM_SETTINGS_CONNECTION_FLAGS_UNSAVED = 0x01, NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED = 0x02, + NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED = 0x04, __NM_SETTINGS_CONNECTION_FLAGS_LAST, NM_SETTINGS_CONNECTION_FLAGS_ALL = ((__NM_SETTINGS_CONNECTION_FLAGS_LAST - 1) << 1) - 1, @@ -190,6 +194,7 @@ void nm_settings_connection_set_autoconnect_blocked_reason (NMSettingsConnection gboolean nm_settings_connection_can_autoconnect (NMSettingsConnection *connection); gboolean nm_settings_connection_get_nm_generated (NMSettingsConnection *connection); +gboolean nm_settings_connection_get_nm_generated_assumed (NMSettingsConnection *connection); G_END_DECLS