Commit 90e7c8bf authored by Thomas Haller's avatar Thomas Haller

core/trivial: rename "nm-generated-assumed" flag to "volatile"

The concept of assumed-connection will change. Currently we mark
connections that are generated and assumed as "nm-generated-assumed".
That has several consequences, one of them being that such a settings
connection gets deleted when the device disconnects.

That is, such a settings connection lingers around as long as it's active,
but once it deactivates it gets automatically deleted. As such, it's
a more volatile concept of an in-memory connection.

The concept of such automatically cleaned up connections is useful beyond
generated-assumed. See the related bug rh#1401515.
parent d43a54c9
......@@ -1606,7 +1606,7 @@ nm_device_uses_generated_assumed_connection (NMDevice *self)
&& nm_active_connection_get_assumed (NM_ACTIVE_CONNECTION (priv->act_request))) {
connection = nm_act_request_get_settings_connection (priv->act_request);
if ( connection
&& nm_settings_connection_get_nm_generated_assumed (connection))
&& nm_settings_connection_get_volatile (connection))
return TRUE;
}
return FALSE;
......
......@@ -575,7 +575,7 @@ _dispatcher_call (NMDispatcherAction action,
NMD_CONNECTION_PROPS_FILENAME,
g_variant_new_string (filename));
}
if (nm_settings_connection_get_nm_generated_assumed (settings_connection)) {
if (nm_settings_connection_get_volatile (settings_connection)) {
g_variant_builder_add (&connection_props, "{sv}",
NMD_CONNECTION_PROPS_EXTERNAL,
g_variant_new_boolean (TRUE));
......
......@@ -272,7 +272,7 @@ active_connection_remove (NMManager *self, NMActiveConnection *active)
if ( nm_active_connection_get_assumed (active)
&& (connection = nm_active_connection_get_settings_connection (active))
&& nm_settings_connection_get_nm_generated_assumed (connection))
&& nm_settings_connection_get_volatile (connection))
g_object_ref (connection);
else
connection = NULL;
......@@ -1697,7 +1697,7 @@ done:
static gboolean
match_connection_filter (NMConnection *connection, gpointer user_data)
{
if (nm_settings_connection_get_nm_generated_assumed (NM_SETTINGS_CONNECTION (connection)))
if (nm_settings_connection_get_volatile (NM_SETTINGS_CONNECTION (connection)))
return FALSE;
return nm_device_check_connection_compatible (NM_DEVICE (user_data), connection);
......@@ -1800,7 +1800,7 @@ get_existing_connection (NMManager *self, NMDevice *device, gboolean *out_genera
if (added) {
nm_settings_connection_set_flags (NM_SETTINGS_CONNECTION (added),
NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED |
NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED,
NM_SETTINGS_CONNECTION_FLAGS_VOLATILE,
TRUE);
if (out_generated)
*out_generated = TRUE;
......
......@@ -498,7 +498,7 @@ set_unsaved (NMSettingsConnection *self, gboolean now_unsaved)
else {
flags &= ~(NM_SETTINGS_CONNECTION_FLAGS_UNSAVED |
NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED |
NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED);
NM_SETTINGS_CONNECTION_FLAGS_VOLATILE);
}
nm_settings_connection_set_flags_all (self, flags);
}
......@@ -561,7 +561,7 @@ nm_settings_connection_replace_settings (NMSettingsConnection *self,
_LOGD ("replace settings from connection %p (%s)", new_connection, nm_connection_get_id (NM_CONNECTION (self)));
nm_settings_connection_set_flags (self,
NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED | NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED,
NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED | NM_SETTINGS_CONNECTION_FLAGS_VOLATILE,
FALSE);
/* Cache the just-updated system secrets in case something calls
......@@ -2641,18 +2641,18 @@ nm_settings_connection_get_nm_generated (NMSettingsConnection *self)
}
/**
* nm_settings_connection_get_nm_generated_assumed:
* nm_settings_connection_get_volatile:
* @self: an #NMSettingsConnection
*
* Gets the "nm-generated-assumed" flag on @self.
* Gets the "volatile" flag on @self.
*
* The connection is a generated connection especially
* generated for connection assumption.
* The connection is marked as volatile and will be removed when
* it disconnects.
*/
gboolean
nm_settings_connection_get_nm_generated_assumed (NMSettingsConnection *self)
nm_settings_connection_get_volatile (NMSettingsConnection *self)
{
return NM_FLAGS_HAS (nm_settings_connection_get_flags (self), NM_SETTINGS_CONNECTION_FLAGS_NM_GENERATED_ASSUMED);
return NM_FLAGS_HAS (nm_settings_connection_get_flags (self), NM_SETTINGS_CONNECTION_FLAGS_VOLATILE);
}
gboolean
......
......@@ -58,9 +58,9 @@
* @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_VOLATILE: The connection will be deleted
* when it disconnects. That is for in-memory connections (unsaved), which are
* currently active but cleanup on disconnect.
* @NM_SETTINGS_CONNECTION_FLAGS_ALL: special mask, for all known flags
*
* #NMSettingsConnection flags.
......@@ -70,7 +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_VOLATILE = 0x04,
__NM_SETTINGS_CONNECTION_FLAGS_LAST,
NM_SETTINGS_CONNECTION_FLAGS_ALL = ((__NM_SETTINGS_CONNECTION_FLAGS_LAST - 1) << 1) - 1,
......@@ -228,7 +228,7 @@ void nm_settings_connection_set_autoconnect_blocke
gboolean nm_settings_connection_can_autoconnect (NMSettingsConnection *self);
gboolean nm_settings_connection_get_nm_generated (NMSettingsConnection *self);
gboolean nm_settings_connection_get_nm_generated_assumed (NMSettingsConnection *self);
gboolean nm_settings_connection_get_volatile (NMSettingsConnection *self);
gboolean nm_settings_connection_get_ready (NMSettingsConnection *self);
void nm_settings_connection_set_ready (NMSettingsConnection *self,
......
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