mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 17:40:08 +01:00
device: simplify handling of IP config changes while initializing link
This simplifies commit31ca7962f8. We don't need the boolean flags like "queued_ip4_config_pending" to track whether we received any platform signals while being not yet initialized in platform (udev, NM_UNMANAGED_PLATFORM_INIT). In general, as long as the device is NM_UNMANAGED_PLATFORM_INIT, all platform signals are ignored. And when the device becomes managed, we schedule anyway an initial config-change. (cherry picked from commit18ecc4b4f1)
This commit is contained in:
parent
5ccd7f7fd7
commit
3ce80c8d65
1 changed files with 18 additions and 38 deletions
|
|
@ -280,11 +280,6 @@ typedef struct _NMDevicePrivate {
|
|||
|
||||
bool real:1;
|
||||
|
||||
/* there was a IP config change, but no idle action was scheduled because device
|
||||
* is still not platform-init */
|
||||
bool queued_ip4_config_pending:1;
|
||||
bool queued_ip6_config_pending:1;
|
||||
|
||||
bool update_ip_config_completed_v4:1;
|
||||
bool update_ip_config_completed_v6:1;
|
||||
|
||||
|
|
@ -4070,9 +4065,6 @@ realize_start_setup (NMDevice *self,
|
|||
_notify (self, PROP_UDI);
|
||||
}
|
||||
|
||||
priv->queued_ip4_config_pending = TRUE;
|
||||
priv->queued_ip6_config_pending = TRUE;
|
||||
|
||||
nm_device_update_hw_address (self);
|
||||
nm_device_update_initial_hw_address (self);
|
||||
nm_device_update_permanent_hw_address (self, FALSE);
|
||||
|
|
@ -10229,13 +10221,11 @@ _cleanup_ip_pre (NMDevice *self, int addr_family, CleanupType cleanup_type)
|
|||
}
|
||||
|
||||
if (IS_IPv4) {
|
||||
priv->queued_ip4_config_pending = FALSE;
|
||||
dhcp4_cleanup (self, cleanup_type, FALSE);
|
||||
arp_cleanup (self);
|
||||
dnsmasq_cleanup (self);
|
||||
ipv4ll_cleanup (self);
|
||||
} else {
|
||||
priv->queued_ip6_config_pending = FALSE;
|
||||
g_clear_object (&priv->dad6_ip6_config);
|
||||
dhcp6_cleanup (self, cleanup_type, FALSE);
|
||||
nm_clear_g_source (&priv->linklocal6_timeout_id);
|
||||
|
|
@ -12244,8 +12234,6 @@ queued_ip_config_change (NMDevice *self, int addr_family)
|
|||
|
||||
priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
nm_assert (IS_IPv4 ? !priv->queued_ip4_config_pending : !priv->queued_ip6_config_pending);
|
||||
|
||||
/* Wait for any queued state changes */
|
||||
if (priv->queued_state.id)
|
||||
return G_SOURCE_CONTINUE;
|
||||
|
|
@ -12261,13 +12249,10 @@ queued_ip_config_change (NMDevice *self, int addr_family)
|
|||
? activate_stage5_ip4_config_result
|
||||
: activate_stage5_ip6_config_commit,
|
||||
addr_family)) {
|
||||
if (IS_IPv4) {
|
||||
priv->queued_ip4_config_pending = FALSE;
|
||||
if (IS_IPv4)
|
||||
priv->queued_ip_config_id_4 = g_idle_add (queued_ip4_config_change, self);
|
||||
} else {
|
||||
priv->queued_ip6_config_pending = FALSE;
|
||||
else
|
||||
priv->queued_ip_config_id_6 = g_idle_add (queued_ip6_config_change, self);
|
||||
}
|
||||
_LOGT (LOGD_DEVICE, "IP%c update was postponed",
|
||||
nm_utils_addr_family_to_char (addr_family));
|
||||
} else {
|
||||
|
|
@ -12378,16 +12363,20 @@ device_ipx_changed (NMPlatform *platform,
|
|||
if (nm_device_get_ip_ifindex (self) != ifindex)
|
||||
return;
|
||||
|
||||
if (!nm_device_is_real (self))
|
||||
return;
|
||||
|
||||
if (nm_device_get_unmanaged_flags (self, NM_UNMANAGED_PLATFORM_INIT)) {
|
||||
/* ignore all platform signals until the link is initialized in platform. */
|
||||
return;
|
||||
}
|
||||
|
||||
priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
switch (obj_type) {
|
||||
case NMP_OBJECT_TYPE_IP4_ADDRESS:
|
||||
case NMP_OBJECT_TYPE_IP4_ROUTE:
|
||||
if (nm_device_get_unmanaged_flags (self, NM_UNMANAGED_PLATFORM_INIT)) {
|
||||
priv->queued_ip4_config_pending = TRUE;
|
||||
nm_assert_se (!nm_clear_g_source (&priv->queued_ip_config_id_4));
|
||||
} else if (!priv->queued_ip_config_id_4) {
|
||||
priv->queued_ip4_config_pending = FALSE;
|
||||
if (!priv->queued_ip_config_id_4) {
|
||||
priv->queued_ip_config_id_4 = g_idle_add (queued_ip4_config_change, self);
|
||||
_LOGD (LOGD_DEVICE, "queued IP4 config change");
|
||||
}
|
||||
|
|
@ -12401,13 +12390,10 @@ device_ipx_changed (NMPlatform *platform,
|
|||
priv->dad6_failed_addrs = g_slist_prepend (priv->dad6_failed_addrs,
|
||||
(gpointer) nmp_object_ref (NMP_OBJECT_UP_CAST (addr)));
|
||||
}
|
||||
|
||||
/* fall through */
|
||||
case NMP_OBJECT_TYPE_IP6_ROUTE:
|
||||
if (nm_device_get_unmanaged_flags (self, NM_UNMANAGED_PLATFORM_INIT)) {
|
||||
priv->queued_ip6_config_pending = TRUE;
|
||||
nm_assert_se (!nm_clear_g_source (&priv->queued_ip_config_id_6));
|
||||
} else if (!priv->queued_ip_config_id_6) {
|
||||
priv->queued_ip6_config_pending = FALSE;
|
||||
if (!priv->queued_ip_config_id_6) {
|
||||
priv->queued_ip_config_id_6 = g_idle_add (queued_ip6_config_change, self);
|
||||
_LOGD (LOGD_DEVICE, "queued IP6 config change");
|
||||
}
|
||||
|
|
@ -12674,17 +12660,11 @@ _set_unmanaged_flags (NMDevice *self,
|
|||
!!unmanaged);
|
||||
}
|
||||
|
||||
if (priv->queued_ip4_config_pending) {
|
||||
priv->queued_ip4_config_pending = FALSE;
|
||||
nm_assert_se (!nm_clear_g_source (&priv->queued_ip_config_id_4));
|
||||
priv->queued_ip_config_id_4 = g_idle_add (queued_ip4_config_change, self);
|
||||
}
|
||||
|
||||
if (priv->queued_ip6_config_pending) {
|
||||
priv->queued_ip6_config_pending = FALSE;
|
||||
nm_assert_se (!nm_clear_g_source (&priv->queued_ip_config_id_6));
|
||||
priv->queued_ip_config_id_6 = g_idle_add (queued_ip6_config_change, self);
|
||||
}
|
||||
/* trigger an initial update of IP configuration. */
|
||||
nm_assert_se (!nm_clear_g_source (&priv->queued_ip_config_id_4));
|
||||
nm_assert_se (!nm_clear_g_source (&priv->queued_ip_config_id_6));
|
||||
priv->queued_ip_config_id_4 = g_idle_add (queued_ip4_config_change, self);
|
||||
priv->queued_ip_config_id_6 = g_idle_add (queued_ip6_config_change, self);
|
||||
|
||||
if (!priv->pending_actions) {
|
||||
do_notify_has_pending_actions = TRUE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue