mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 01:20:07 +01:00
core/trivial: rename activation-type related checks for device and active-connection
nm_device_uses_assumed_connection() basically called nm_active_connection_get_assumed() on the device. Rename those functions to be closer to the activation-type flags. The concepts of "assume", "external", and "assume_or_external" will make sense with the following commits.
This commit is contained in:
parent
3973f8ebcd
commit
fa015f2aab
7 changed files with 40 additions and 40 deletions
|
|
@ -96,7 +96,7 @@ parent_hwaddr_maybe_changed (NMDevice *parent,
|
|||
NMSettingIPConfig *s_ip6;
|
||||
|
||||
/* Never touch assumed devices */
|
||||
if (nm_device_uses_assumed_connection ((NMDevice *) self))
|
||||
if (nm_device_has_activation_type_assume_or_external ((NMDevice *) self))
|
||||
return;
|
||||
|
||||
connection = nm_device_get_applied_connection ((NMDevice *) self);
|
||||
|
|
|
|||
|
|
@ -1599,13 +1599,13 @@ nm_device_get_physical_port_id (NMDevice *self)
|
|||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
nm_device_uses_generated_assumed_connection (NMDevice *self)
|
||||
nm_device_has_activation_type_external (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMSettingsConnection *connection;
|
||||
|
||||
if ( priv->act_request
|
||||
&& nm_active_connection_get_assumed (NM_ACTIVE_CONNECTION (priv->act_request))) {
|
||||
&& nm_active_connection_has_activation_type_assume_or_external (NM_ACTIVE_CONNECTION (priv->act_request))) {
|
||||
connection = nm_act_request_get_settings_connection (priv->act_request);
|
||||
if ( connection
|
||||
&& nm_settings_connection_get_volatile (connection))
|
||||
|
|
@ -1615,12 +1615,12 @@ nm_device_uses_generated_assumed_connection (NMDevice *self)
|
|||
}
|
||||
|
||||
gboolean
|
||||
nm_device_uses_assumed_connection (NMDevice *self)
|
||||
nm_device_has_activation_type_assume_or_external (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
if ( priv->act_request
|
||||
&& nm_active_connection_get_assumed (NM_ACTIVE_CONNECTION (priv->act_request)))
|
||||
&& nm_active_connection_has_activation_type_assume_or_external (NM_ACTIVE_CONNECTION (priv->act_request)))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -3154,7 +3154,7 @@ nm_device_master_release_slaves (NMDevice *self)
|
|||
gboolean configure = TRUE;
|
||||
|
||||
/* Don't release the slaves if this connection doesn't belong to NM. */
|
||||
if (nm_device_uses_generated_assumed_connection (self))
|
||||
if (nm_device_has_activation_type_external (self))
|
||||
return;
|
||||
|
||||
reason = priv->state_reason;
|
||||
|
|
@ -4192,7 +4192,7 @@ master_ready (NMDevice *self,
|
|||
/* If the master didn't change, add-slave only rechecks whether to assume a connection. */
|
||||
nm_device_master_add_slave (master,
|
||||
self,
|
||||
nm_active_connection_get_assumed (active) ? FALSE : TRUE);
|
||||
nm_active_connection_has_activation_type_assume_or_external (active) ? FALSE : TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -4272,7 +4272,7 @@ activate_stage1_device_prepare (NMDevice *self)
|
|||
nm_device_state_changed (self, NM_DEVICE_STATE_PREPARE, NM_DEVICE_STATE_REASON_NONE);
|
||||
|
||||
/* Assumed connections were already set up outside NetworkManager */
|
||||
if (!nm_active_connection_get_assumed (active)) {
|
||||
if (!nm_active_connection_has_activation_type_assume_or_external (active)) {
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage1_prepare (self, &failure_reason);
|
||||
|
|
@ -4370,7 +4370,7 @@ activate_stage2_device_config (NMDevice *self)
|
|||
nm_device_state_changed (self, NM_DEVICE_STATE_CONFIG, NM_DEVICE_STATE_REASON_NONE);
|
||||
|
||||
/* Assumed connections were already set up outside NetworkManager */
|
||||
if (!nm_active_connection_get_assumed (active)) {
|
||||
if (!nm_active_connection_has_activation_type_assume_or_external (active)) {
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
if (!nm_device_bring_up (self, FALSE, &no_firmware)) {
|
||||
|
|
@ -4398,7 +4398,7 @@ activate_stage2_device_config (NMDevice *self)
|
|||
|
||||
if (slave_state == NM_DEVICE_STATE_IP_CONFIG)
|
||||
nm_device_master_enslave_slave (self, info->slave, nm_device_get_applied_connection (info->slave));
|
||||
else if ( nm_device_uses_generated_assumed_connection (self)
|
||||
else if ( nm_device_has_activation_type_external (self)
|
||||
&& slave_state <= NM_DEVICE_STATE_DISCONNECTED)
|
||||
nm_device_queue_recheck_assume (info->slave);
|
||||
}
|
||||
|
|
@ -4499,7 +4499,7 @@ check_ip_state (NMDevice *self, gboolean may_fail)
|
|||
&& (priv->ip6_state == IP_FAIL || (ip6_ignore && priv->ip6_state == IP_DONE))) {
|
||||
/* Either both methods failed, or only one failed and the other is
|
||||
* disabled */
|
||||
if (nm_device_uses_assumed_connection (self)) {
|
||||
if (nm_device_has_activation_type_assume_or_external (self)) {
|
||||
/* We have assumed configuration, but couldn't redo it. No problem,
|
||||
* move to check state. */
|
||||
_set_ip_state (self, AF_INET, IP_DONE);
|
||||
|
|
@ -4691,7 +4691,7 @@ ipv4_dad_start (NMDevice *self, NMIP4Config **configs, ArpingCallback cb)
|
|||
|| !hw_addr
|
||||
|| !hw_addr_len
|
||||
|| !addr_found
|
||||
|| nm_device_uses_assumed_connection (self)) {
|
||||
|| nm_device_has_activation_type_assume_or_external (self)) {
|
||||
|
||||
/* DAD not needed, signal success */
|
||||
cb (self, configs, TRUE);
|
||||
|
|
@ -4992,7 +4992,7 @@ ensure_con_ip4_config (NMDevice *self)
|
|||
nm_connection_get_setting_ip4_config (connection),
|
||||
nm_device_get_ip4_route_metric (self));
|
||||
|
||||
if (nm_device_uses_assumed_connection (self)) {
|
||||
if (nm_device_has_activation_type_assume_or_external (self)) {
|
||||
/* For assumed connections ignore all addresses and routes. */
|
||||
nm_ip4_config_reset_addresses (priv->con_ip4_config);
|
||||
nm_ip4_config_reset_routes (priv->con_ip4_config);
|
||||
|
|
@ -5018,7 +5018,7 @@ ensure_con_ip6_config (NMDevice *self)
|
|||
nm_connection_get_setting_ip6_config (connection),
|
||||
nm_device_get_ip6_route_metric (self));
|
||||
|
||||
if (nm_device_uses_assumed_connection (self)) {
|
||||
if (nm_device_has_activation_type_assume_or_external (self)) {
|
||||
/* For assumed connections ignore all addresses and routes. */
|
||||
nm_ip6_config_reset_addresses (priv->con_ip6_config);
|
||||
nm_ip6_config_reset_routes (priv->con_ip6_config);
|
||||
|
|
@ -5160,7 +5160,7 @@ ip4_config_merge_and_apply (NMDevice *self,
|
|||
* but if the IP method is automatic we need to update the default route to
|
||||
* maintain connectivity.
|
||||
*/
|
||||
if (nm_device_uses_generated_assumed_connection (self) && !auto_method)
|
||||
if (nm_device_has_activation_type_external (self) && !auto_method)
|
||||
goto END_ADD_DEFAULT_ROUTE;
|
||||
|
||||
/* At this point, we treat assumed and non-assumed connections alike.
|
||||
|
|
@ -5236,7 +5236,7 @@ END_ADD_DEFAULT_ROUTE:
|
|||
|
||||
routes_full_sync = commit
|
||||
&& priv->v4_commit_first_time
|
||||
&& !nm_device_uses_assumed_connection (self);
|
||||
&& !nm_device_has_activation_type_assume_or_external (self);
|
||||
|
||||
success = nm_device_set_ip4_config (self, composite, default_route_metric, commit, routes_full_sync);
|
||||
g_object_unref (composite);
|
||||
|
|
@ -5309,7 +5309,7 @@ dhcp4_fail (NMDevice *self, gboolean timeout)
|
|||
* device will transition to the ACTIVATED state without IP configuration),
|
||||
* retry DHCP again.
|
||||
*/
|
||||
if (nm_device_uses_assumed_connection (self)) {
|
||||
if (nm_device_has_activation_type_assume_or_external (self)) {
|
||||
dhcp_schedule_restart (self, AF_INET, "connection is assumed");
|
||||
return;
|
||||
}
|
||||
|
|
@ -5907,7 +5907,7 @@ ip6_config_merge_and_apply (NMDevice *self,
|
|||
* but if the IP method is automatic we need to update the default route to
|
||||
* maintain connectivity.
|
||||
*/
|
||||
if (nm_device_uses_generated_assumed_connection (self) && !auto_method)
|
||||
if (nm_device_has_activation_type_external (self) && !auto_method)
|
||||
goto END_ADD_DEFAULT_ROUTE;
|
||||
|
||||
/* At this point, we treat assumed and non-assumed connections alike.
|
||||
|
|
@ -5989,7 +5989,7 @@ END_ADD_DEFAULT_ROUTE:
|
|||
|
||||
routes_full_sync = commit
|
||||
&& priv->v6_commit_first_time
|
||||
&& !nm_device_uses_assumed_connection (self);
|
||||
&& !nm_device_has_activation_type_assume_or_external (self);
|
||||
|
||||
success = nm_device_set_ip6_config (self, composite, commit, routes_full_sync);
|
||||
g_object_unref (composite);
|
||||
|
|
@ -6103,7 +6103,7 @@ dhcp6_fail (NMDevice *self, gboolean timeout)
|
|||
* device will transition to the ACTIVATED state without IP configuration),
|
||||
* retry DHCP again.
|
||||
*/
|
||||
if (nm_device_uses_assumed_connection (self)) {
|
||||
if (nm_device_has_activation_type_assume_or_external (self)) {
|
||||
dhcp_schedule_restart (self, AF_INET6, "connection is assumed");
|
||||
return;
|
||||
}
|
||||
|
|
@ -6688,7 +6688,7 @@ _commit_mtu (NMDevice *self, const NMIP4Config *config)
|
|||
if (ifindex <= 0)
|
||||
return;
|
||||
|
||||
if (nm_device_uses_assumed_connection (self)) {
|
||||
if (nm_device_has_activation_type_assume_or_external (self)) {
|
||||
/* for assumed connections we don't tamper with the MTU. This is
|
||||
* a bug and supposed to be fixed by the unmanaged/assumed rework. */
|
||||
return;
|
||||
|
|
@ -7355,7 +7355,7 @@ act_stage3_ip6_config_start (NMDevice *self,
|
|||
* IPv6LL if this is not an assumed connection, since assumed connections
|
||||
* will already have IPv6 set up.
|
||||
*/
|
||||
if (!nm_device_uses_assumed_connection (self))
|
||||
if (!nm_device_has_activation_type_assume_or_external (self))
|
||||
set_nm_ipv6ll (self, TRUE);
|
||||
|
||||
/* Re-enable IPv6 on the interface */
|
||||
|
|
@ -7385,7 +7385,7 @@ act_stage3_ip6_config_start (NMDevice *self,
|
|||
_LOGW (LOGD_IP6, "unhandled IPv6 config method '%s'; will fail", method);
|
||||
|
||||
if ( ret != NM_ACT_STAGE_RETURN_FAILURE
|
||||
&& !nm_device_uses_assumed_connection (self)) {
|
||||
&& !nm_device_has_activation_type_assume_or_external (self)) {
|
||||
switch (ip6_privacy) {
|
||||
case NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN:
|
||||
case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED:
|
||||
|
|
@ -7628,7 +7628,7 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self)
|
|||
s_con = nm_connection_get_setting_connection (connection);
|
||||
|
||||
if (!priv->fw_ready) {
|
||||
if (nm_device_uses_generated_assumed_connection (self))
|
||||
if (nm_device_has_activation_type_external (self))
|
||||
priv->fw_ready = TRUE;
|
||||
else {
|
||||
if (!priv->fw_call) {
|
||||
|
|
@ -7930,7 +7930,7 @@ activate_stage5_ip4_config_commit (NMDevice *self)
|
|||
|
||||
/* Interface must be IFF_UP before IP config can be applied */
|
||||
ip_ifindex = nm_device_get_ip_ifindex (self);
|
||||
if (!nm_platform_link_is_up (NM_PLATFORM_GET, ip_ifindex) && !nm_device_uses_assumed_connection (self)) {
|
||||
if (!nm_platform_link_is_up (NM_PLATFORM_GET, ip_ifindex) && !nm_device_has_activation_type_assume_or_external (self)) {
|
||||
nm_platform_link_set_up (NM_PLATFORM_GET, ip_ifindex, NULL);
|
||||
if (!nm_platform_link_is_up (NM_PLATFORM_GET, ip_ifindex))
|
||||
_LOGW (LOGD_DEVICE, "interface %s not up for IP configuration", nm_device_get_ip_iface (self));
|
||||
|
|
@ -8079,7 +8079,7 @@ activate_stage5_ip6_config_commit (NMDevice *self)
|
|||
|
||||
/* Interface must be IFF_UP before IP config can be applied */
|
||||
ip_ifindex = nm_device_get_ip_ifindex (self);
|
||||
if (!nm_platform_link_is_up (NM_PLATFORM_GET, ip_ifindex) && !nm_device_uses_assumed_connection (self)) {
|
||||
if (!nm_platform_link_is_up (NM_PLATFORM_GET, ip_ifindex) && !nm_device_has_activation_type_assume_or_external (self)) {
|
||||
nm_platform_link_set_up (NM_PLATFORM_GET, ip_ifindex, NULL);
|
||||
if (!nm_platform_link_is_up (NM_PLATFORM_GET, ip_ifindex))
|
||||
_LOGW (LOGD_DEVICE, "interface %s not up for IP configuration", nm_device_get_ip_iface (self));
|
||||
|
|
@ -9307,7 +9307,7 @@ nm_device_set_ip4_config (NMDevice *self,
|
|||
|
||||
/* Always commit to nm-platform to update lifetimes */
|
||||
if (commit && new_config) {
|
||||
gboolean assumed = nm_device_uses_assumed_connection (self);
|
||||
gboolean assumed = nm_device_has_activation_type_assume_or_external (self);
|
||||
|
||||
_commit_mtu (self, new_config);
|
||||
/* For assumed devices we must not touch the kernel-routes, such as the device-route.
|
||||
|
|
@ -9358,7 +9358,7 @@ nm_device_set_ip4_config (NMDevice *self,
|
|||
if (old_config != priv->ip4_config)
|
||||
nm_exported_object_clear_and_unexport (&old_config);
|
||||
|
||||
if (nm_device_uses_generated_assumed_connection (self)) {
|
||||
if (nm_device_has_activation_type_external (self)) {
|
||||
NMConnection *settings_connection = NM_CONNECTION (nm_device_get_settings_connection (self));
|
||||
NMSetting *s_ip4;
|
||||
|
||||
|
|
@ -9512,7 +9512,7 @@ nm_device_set_ip6_config (NMDevice *self,
|
|||
if (old_config != priv->ip6_config)
|
||||
nm_exported_object_clear_and_unexport (&old_config);
|
||||
|
||||
if (nm_device_uses_generated_assumed_connection (self)) {
|
||||
if (nm_device_has_activation_type_external (self)) {
|
||||
NMConnection *settings_connection = NM_CONNECTION (nm_device_get_settings_connection (self));
|
||||
NMSetting *s_ip6;
|
||||
|
||||
|
|
@ -10991,7 +10991,7 @@ nm_device_update_firewall_zone (NMDevice *self)
|
|||
|
||||
s_con = nm_connection_get_setting_connection (applied_connection);
|
||||
if ( nm_device_get_state (self) == NM_DEVICE_STATE_ACTIVATED
|
||||
&& !nm_device_uses_generated_assumed_connection (self)) {
|
||||
&& !nm_device_has_activation_type_external (self)) {
|
||||
nm_firewall_manager_add_or_change_zone (nm_firewall_manager_get (),
|
||||
nm_device_get_ip_iface (self),
|
||||
nm_setting_connection_get_zone (s_con),
|
||||
|
|
@ -11492,7 +11492,7 @@ _cleanup_generic_pre (NMDevice *self, CleanupType cleanup_type)
|
|||
connection = nm_device_get_applied_connection (self);
|
||||
if ( cleanup_type == CLEANUP_TYPE_DECONFIGURE
|
||||
&& connection
|
||||
&& !nm_device_uses_generated_assumed_connection (self)) {
|
||||
&& !nm_device_has_activation_type_external (self)) {
|
||||
nm_firewall_manager_remove_from_zone (nm_firewall_manager_get (),
|
||||
nm_device_get_ip_iface (self),
|
||||
NULL,
|
||||
|
|
@ -12204,7 +12204,7 @@ _set_state_full (NMDevice *self,
|
|||
*/
|
||||
_cancel_activation (self);
|
||||
|
||||
if (nm_device_uses_assumed_connection (self)) {
|
||||
if (nm_device_has_activation_type_assume_or_external (self)) {
|
||||
/* Avoid tearing down assumed connection, assume it's connected */
|
||||
nm_device_queue_state (self,
|
||||
NM_DEVICE_STATE_ACTIVATED,
|
||||
|
|
@ -12242,7 +12242,7 @@ _set_state_full (NMDevice *self,
|
|||
|
||||
if ( applied_connection
|
||||
&& priv->ifindex != priv->ip_ifindex
|
||||
&& !nm_device_uses_generated_assumed_connection (self)) {
|
||||
&& !nm_device_has_activation_type_external (self)) {
|
||||
NMSettingConnection *s_con;
|
||||
const char *zone;
|
||||
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ gboolean nm_device_complete_connection (NMDevice *device,
|
|||
gboolean nm_device_check_connection_compatible (NMDevice *device, NMConnection *connection);
|
||||
gboolean nm_device_check_slave_connection_compatible (NMDevice *device, NMConnection *connection);
|
||||
|
||||
gboolean nm_device_uses_assumed_connection (NMDevice *device);
|
||||
gboolean nm_device_has_activation_type_assume_or_external (NMDevice *device);
|
||||
|
||||
gboolean nm_device_unmanage_on_quit (NMDevice *self);
|
||||
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ teamd_dbus_appeared (GDBusConnection *connection,
|
|||
success = teamd_read_config (device);
|
||||
if (success)
|
||||
nm_device_activate_schedule_stage2_device_config (device);
|
||||
else if (!nm_device_uses_assumed_connection (device))
|
||||
else if (!nm_device_has_activation_type_assume_or_external (device))
|
||||
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -722,7 +722,7 @@ nm_active_connection_get_activation_type (NMActiveConnection *self)
|
|||
}
|
||||
|
||||
gboolean
|
||||
nm_active_connection_get_assumed (NMActiveConnection *self)
|
||||
nm_active_connection_has_activation_type_assume_or_external (NMActiveConnection *self)
|
||||
{
|
||||
return nm_active_connection_get_activation_type (self) == NM_ACTIVATION_TYPE_ASSUME;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ void nm_active_connection_set_master (NMActiveConnection *self,
|
|||
void nm_active_connection_set_parent (NMActiveConnection *self,
|
||||
NMActiveConnection *parent);
|
||||
|
||||
gboolean nm_active_connection_get_assumed (NMActiveConnection *self);
|
||||
gboolean nm_active_connection_has_activation_type_assume_or_external (NMActiveConnection *self);
|
||||
|
||||
NMActivationType nm_active_connection_get_activation_type (NMActiveConnection *self);
|
||||
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ active_connection_remove (NMManager *self, NMActiveConnection *active)
|
|||
g_signal_handlers_disconnect_by_func (active, active_connection_default_changed, self);
|
||||
g_signal_handlers_disconnect_by_func (active, active_connection_parent_active, self);
|
||||
|
||||
if ( nm_active_connection_get_assumed (active)
|
||||
if ( nm_active_connection_has_activation_type_assume_or_external (active)
|
||||
&& (connection = nm_active_connection_get_settings_connection (active))
|
||||
&& nm_settings_connection_get_volatile (connection))
|
||||
g_object_ref (connection);
|
||||
|
|
@ -802,13 +802,13 @@ find_best_device_state (NMManager *manager, gboolean *force_connectivity_check)
|
|||
}
|
||||
break;
|
||||
case NM_ACTIVE_CONNECTION_STATE_ACTIVATING:
|
||||
if (!nm_active_connection_get_assumed (ac)) {
|
||||
if (!nm_active_connection_has_activation_type_assume_or_external (ac)) {
|
||||
if (best_state != NM_STATE_CONNECTED_GLOBAL)
|
||||
best_state = NM_STATE_CONNECTING;
|
||||
}
|
||||
break;
|
||||
case NM_ACTIVE_CONNECTION_STATE_DEACTIVATING:
|
||||
if (!nm_active_connection_get_assumed (ac)) {
|
||||
if (!nm_active_connection_has_activation_type_assume_or_external (ac)) {
|
||||
if (best_state < NM_STATE_DISCONNECTING)
|
||||
best_state = NM_STATE_DISCONNECTING;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue