core: use "nm-generated-assumed" flag instead of "nm-generated" for assumed connections

At a few places, we checked for nm_device_uses_generated_connection()
whether to touch the device or not. nm_device_uses_generated_connection() used
to look at the "nm-generated" property of the NMSettingsConnection.

We are about to change the meaning of "nm-generated", which will mean
"any connection generated by NM, for whatever reason".

Instead now use the new "nm-generated-assumed" connection flag that has
the meaning "nm-generated" used to have.
So rename nm_device_uses_generated_connection() to nm_device_uses_generated_assumed_connection()
which looks at the "nm-generated-assumed" flag instead.

Also, be more strict in nm_device_uses_generated_assumed_connection() to require
both an "nm-generated-assumed" connection *and* an active connection that is
nm_active_connection_get_assumed().

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-07-30 14:13:36 +02:00
parent 87739dbdf4
commit 6546e9d1ae

View file

@ -743,14 +743,19 @@ nm_device_get_physical_port_id (NMDevice *self)
/***********************************************************/
static gboolean
nm_device_uses_generated_connection (NMDevice *self)
nm_device_uses_generated_assumed_connection (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMConnection *connection;
connection = nm_device_get_connection (self);
if (!connection)
return FALSE;
return nm_settings_connection_get_nm_generated (NM_SETTINGS_CONNECTION (connection));
if ( priv->act_request
&& nm_active_connection_get_assumed (NM_ACTIVE_CONNECTION (priv->act_request))) {
connection = nm_act_request_get_connection (priv->act_request);
if ( connection
&& nm_settings_connection_get_nm_generated_assumed (NM_SETTINGS_CONNECTION (connection)))
return TRUE;
}
return FALSE;
}
static SlaveInfo *
@ -1390,7 +1395,7 @@ nm_device_master_release_slaves (NMDevice *self)
NMDeviceStateReason reason;
/* Don't release the slaves if this connection doesn't belong to NM. */
if (nm_device_uses_generated_connection (self))
if (nm_device_uses_generated_assumed_connection (self))
return;
reason = priv->state_reason;
@ -2285,7 +2290,7 @@ nm_device_activate_stage2_device_config (gpointer user_data)
if (slave_state == NM_DEVICE_STATE_IP_CONFIG)
nm_device_enslave_slave (self, info->slave, nm_device_get_connection (info->slave));
else if ( nm_device_uses_generated_connection (self)
else if ( nm_device_uses_generated_assumed_connection (self)
&& slave_state <= NM_DEVICE_STATE_DISCONNECTED)
nm_device_queue_recheck_assume (info->slave);
}
@ -5238,7 +5243,7 @@ nm_device_set_ip4_config (NMDevice *self,
if (old_config != priv->ip4_config && old_config)
g_object_unref (old_config);
if (nm_device_uses_generated_connection (self)) {
if (nm_device_uses_generated_assumed_connection (self)) {
NMConnection *connection = nm_device_get_connection (self);
NMSetting *s_ip4;
@ -5357,7 +5362,7 @@ nm_device_set_ip6_config (NMDevice *self,
if (old_config != priv->ip6_config && old_config)
g_object_unref (old_config);
if (nm_device_uses_generated_connection (self)) {
if (nm_device_uses_generated_assumed_connection (self)) {
NMConnection *connection = nm_device_get_connection (self);
NMSetting *s_ip6;