device: refactor the ip cleanup
Split it up and move upwards. It will be useful for runtime reconfig of IPv4 configuration.
This commit is contained in:
@@ -6528,7 +6528,7 @@ activate_stage5_ip4_config_commit (NMDevice *self)
|
||||
}
|
||||
|
||||
static void
|
||||
nm_device_queued_ip_config_change_clear (NMDevice *self)
|
||||
queued_ip4_config_change_clear (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
@@ -6537,6 +6537,13 @@ nm_device_queued_ip_config_change_clear (NMDevice *self)
|
||||
g_source_remove (priv->queued_ip4_config_id);
|
||||
priv->queued_ip4_config_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
queued_ip6_config_change_clear (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
if (priv->queued_ip6_config_id) {
|
||||
_LOGD (LOGD_DEVICE, "clearing queued IP6 config change");
|
||||
g_source_remove (priv->queued_ip6_config_id);
|
||||
@@ -6556,7 +6563,7 @@ nm_device_activate_schedule_ip4_config_result (NMDevice *self, NMIP4Config *conf
|
||||
if (config)
|
||||
priv->dev_ip4_config = g_object_ref (config);
|
||||
|
||||
nm_device_queued_ip_config_change_clear (self);
|
||||
queued_ip4_config_change_clear (self);
|
||||
activation_source_schedule (self, activate_stage5_ip4_config_commit, AF_INET);
|
||||
}
|
||||
|
||||
@@ -6795,6 +6802,33 @@ delete_on_deactivate_check_and_schedule (NMDevice *self, int ifindex)
|
||||
ifindex, data->idle_add_id);
|
||||
}
|
||||
|
||||
static void
|
||||
_cleanup_ip4_pre (NMDevice *self, CleanupType cleanup_type)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
priv->ip4_state = IP_NONE;
|
||||
queued_ip4_config_change_clear (self);
|
||||
|
||||
dhcp4_cleanup (self, cleanup_type, FALSE);
|
||||
arp_cleanup (self);
|
||||
dnsmasq_cleanup (self);
|
||||
ipv4ll_cleanup (self);
|
||||
}
|
||||
|
||||
static void
|
||||
_cleanup_ip6_pre (NMDevice *self, CleanupType cleanup_type)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
priv->ip6_state = IP_NONE;
|
||||
queued_ip6_config_change_clear (self);
|
||||
|
||||
dhcp6_cleanup (self, cleanup_type, FALSE);
|
||||
linklocal6_cleanup (self);
|
||||
addrconf6_cleanup (self);
|
||||
}
|
||||
|
||||
static void
|
||||
disconnect_cb (NMDevice *self,
|
||||
GDBusMethodInvocation *context,
|
||||
@@ -8939,23 +8973,6 @@ nm_device_has_pending_action (NMDevice *self)
|
||||
|
||||
/***********************************************************/
|
||||
|
||||
static void
|
||||
_cleanup_ip_pre (NMDevice *self, CleanupType cleanup_type)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
priv->ip4_state = priv->ip6_state = IP_NONE;
|
||||
nm_device_queued_ip_config_change_clear (self);
|
||||
|
||||
dhcp4_cleanup (self, cleanup_type, FALSE);
|
||||
arp_cleanup (self);
|
||||
dhcp6_cleanup (self, cleanup_type, FALSE);
|
||||
linklocal6_cleanup (self);
|
||||
addrconf6_cleanup (self);
|
||||
dnsmasq_cleanup (self);
|
||||
ipv4ll_cleanup (self);
|
||||
}
|
||||
|
||||
static void
|
||||
_cancel_activation (NMDevice *self)
|
||||
{
|
||||
@@ -8997,7 +9014,8 @@ _cleanup_generic_pre (NMDevice *self, CleanupType cleanup_type)
|
||||
/* Clear any queued transitions */
|
||||
nm_device_queued_state_clear (self);
|
||||
|
||||
_cleanup_ip_pre (self, cleanup_type);
|
||||
_cleanup_ip4_pre (self, cleanup_type);
|
||||
_cleanup_ip6_pre (self, cleanup_type);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -9536,7 +9554,8 @@ _set_state_full (NMDevice *self,
|
||||
/* Clean up any half-done IP operations if the device's layer2
|
||||
* finds out it needs authentication during IP config.
|
||||
*/
|
||||
_cleanup_ip_pre (self, CLEANUP_TYPE_DECONFIGURE);
|
||||
_cleanup_ip4_pre (self, CLEANUP_TYPE_DECONFIGURE);
|
||||
_cleanup_ip6_pre (self, CLEANUP_TYPE_DECONFIGURE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user