summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-10-09 12:43:14 +0200
committerThomas Haller <thaller@redhat.com>2019-10-14 11:35:40 +0200
commit1e5206414af83ede1e4e1ff6f525161b83519845 (patch)
treebe21db9b1542868243d59617143995ccac9cca68
parent95d0d5caa957291fb77d88d910e9801b2062bc02 (diff)
downloadNetworkManager-1e5206414af83ede1e4e1ff6f525161b83519845.tar.gz
device: don't delay startup complete for pending-actions "autoconf", "dhcp4" and "dhcp6"
These "pending-actions" only have one purpose: to mark the device as busy and thereby delay "startup complete" to be reached. That in turn delays "NetworkManager-wait-online" service. Of course, "NetworkManager-wait-online" waits for some form of readiness and is not extensively configurable (e.g. you cannot exclude devices from being waited). However, the intent is to wait that all devices are "settled". That means among others, that the timeouts waiting for carrier and Wi-Fi scan results passed, and devices either don't have a connection profile to autoactivate, or they autoactivated profiles and are in state "connected". A major point here is that the device is considered ready, once it reaches the state "connected". Note that if you configure both IPv4 and IPv6 addressing modes, than "ipv4.may-fail=yes" and "ipv6.may-fail=yes" means, that the device is considered fully activated once one address family completes. Again, this is not very configurable, but by setting "ipv6.may-fail=no", you can require that the device has indeed IPv6 addressing completed. Now, the determining factor for declaring "startup complete" is whether the device is in state "connected". That may or may not mean that DHCPv4, autoconf or DHCPv6 completed, as it depends on a overall state of the device. So, it is wrong to have distinct pending actions for these operations. Remove them. This fixes that we wrongly would wait too long before declaring startup complete. But it is also a change in behavior.
-rw-r--r--NEWS6
-rw-r--r--src/devices/nm-device.c26
-rw-r--r--src/devices/nm-device.h3
3 files changed, 7 insertions, 28 deletions
diff --git a/NEWS b/NEWS
index d08ce92f9c..c839e18e98 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,12 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
* Drop support for BlueZ 4. BlueZ 5 was released in 2012 and should
nowadays be available everywhere.
+* core: declare "startup complete" when device reaches "connected"
+ state, even if IP addressing methods did not yet fully complete.
+ This changes behavior for unblocking "NetworkManager-wait-online.service",
+ and "network-online.target" earlier. If this causes issues in your
+ setup, you may need to configure "ipv4.may-fail=no" or "ipv6.may-fail=no",
+ which delays reaching "connected" state for the address family accordingly.
* Various bug fixes and improvements.
=============================================
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 57de04d4db..a632ce3b29 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -7438,8 +7438,6 @@ dhcp4_cleanup (NMDevice *self, CleanupType cleanup_type, gboolean release)
/* Stop any ongoing DHCP transaction on this device */
nm_clear_g_signal_handler (priv->dhcp4.client, &priv->dhcp4.state_sigid);
- nm_device_remove_pending_action (self, NM_PENDING_ACTION_DHCP4, FALSE);
-
if ( cleanup_type == CLEANUP_TYPE_DECONFIGURE
|| cleanup_type == CLEANUP_TYPE_REMOVED)
nm_dhcp_client_stop (priv->dhcp4.client, release);
@@ -7693,8 +7691,6 @@ dhcp4_lease_change (NMDevice *self, NMIP4Config *config)
NULL,
NULL, NULL, NULL);
- nm_device_remove_pending_action (self, NM_PENDING_ACTION_DHCP4, FALSE);
-
return TRUE;
}
@@ -8100,8 +8096,6 @@ dhcp4_start (NMDevice *self)
G_CALLBACK (dhcp4_state_changed),
self);
- nm_device_add_pending_action (self, NM_PENDING_ACTION_DHCP4, TRUE);
-
if (nm_device_sys_iface_state_is_external_or_assume (self))
priv->dhcp4.was_active = TRUE;
@@ -8306,8 +8300,6 @@ dhcp6_cleanup (NMDevice *self, CleanupType cleanup_type, gboolean release)
g_clear_object (&priv->dhcp6.client);
}
- nm_device_remove_pending_action (self, NM_PENDING_ACTION_DHCP6, FALSE);
-
if (priv->dhcp6.config) {
nm_dbus_object_clear_and_unexport (&priv->dhcp6.config);
_notify (self, PROP_DHCP6_CONFIG);
@@ -8341,8 +8333,6 @@ dhcp6_lease_change (NMDevice *self)
NULL,
NULL, NULL, NULL);
- nm_device_remove_pending_action (self, NM_PENDING_ACTION_DHCP6, FALSE);
-
return TRUE;
}
@@ -8936,7 +8926,6 @@ dhcp6_start (NMDevice *self, gboolean wait_for_ll)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
NMConnection *connection;
- NMSettingIPConfig *s_ip6;
nm_dbus_object_clear_and_unexport (&priv->dhcp6.config);
priv->dhcp6.config = nm_dhcp6_config_new ();
@@ -8946,11 +8935,7 @@ dhcp6_start (NMDevice *self, gboolean wait_for_ll)
g_clear_pointer (&priv->dhcp6.event_id, g_free);
connection = nm_device_get_applied_connection (self);
- g_assert (connection);
- s_ip6 = nm_connection_get_setting_ip6_config (connection);
- if (!nm_setting_ip_config_get_may_fail (s_ip6) ||
- !strcmp (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_DHCP))
- nm_device_add_pending_action (self, NM_PENDING_ACTION_DHCP6, TRUE);
+ g_return_val_if_fail (connection, FALSE);
if (wait_for_ll) {
/* ensure link local is ready... */
@@ -9860,9 +9845,6 @@ addrconf6_start (NMDevice *self, NMSettingIP6ConfigPrivacy use_tempaddr)
"IPv6 private addresses. This feature is not available");
}
- if (!nm_setting_ip_config_get_may_fail (nm_connection_get_setting_ip6_config (connection)))
- nm_device_add_pending_action (self, NM_PENDING_ACTION_AUTOCONF6, TRUE);
-
/* ensure link local is ready... */
if (!linklocal6_start (self)) {
/* wait for the LL address to show up */
@@ -9883,8 +9865,6 @@ addrconf6_cleanup (NMDevice *self)
nm_clear_g_signal_handler (priv->ndisc, &priv->ndisc_changed_id);
nm_clear_g_signal_handler (priv->ndisc, &priv->ndisc_timeout_id);
- nm_device_remove_pending_action (self, NM_PENDING_ACTION_AUTOCONF6, FALSE);
-
applied_config_clear (&priv->ac_ip6_config);
g_clear_pointer (&priv->rt6_temporary_not_available, g_hash_table_unref);
nm_clear_g_source (&priv->rt6_temporary_not_available_id);
@@ -10885,8 +10865,6 @@ activate_stage5_ip_config_result_4 (NMDevice *self)
if (do_announce)
nm_device_arp_announce (self);
- nm_device_remove_pending_action (self, NM_PENDING_ACTION_DHCP4, FALSE);
-
/* Enter the IP_CHECK state if this is the first method to complete */
_set_ip_state (self, AF_INET, NM_DEVICE_IP_STATE_DONE);
check_ip_state (self, FALSE, TRUE);
@@ -11048,8 +11026,6 @@ activate_stage5_ip_config_result_6 (NMDevice *self)
return;
}
}
- nm_device_remove_pending_action (self, NM_PENDING_ACTION_DHCP6, FALSE);
- nm_device_remove_pending_action (self, NM_PENDING_ACTION_AUTOCONF6, FALSE);
/* Start IPv6 forwarding if we need it */
method = nm_device_get_effective_ip_config_method (self, AF_INET6);
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h
index aa2de5a4de..bd29938fa5 100644
--- a/src/devices/nm-device.h
+++ b/src/devices/nm-device.h
@@ -53,9 +53,6 @@ nm_device_state_reason_check (NMDeviceStateReason reason)
}
#define NM_PENDING_ACTION_AUTOACTIVATE "autoactivate"
-#define NM_PENDING_ACTION_DHCP4 "dhcp4"
-#define NM_PENDING_ACTION_DHCP6 "dhcp6"
-#define NM_PENDING_ACTION_AUTOCONF6 "autoconf6"
#define NM_PENDING_ACTION_RECHECK_AVAILABLE "recheck-available"
#define NM_PENDING_ACTION_CARRIER_WAIT "carrier-wait"
#define NM_PENDING_ACTION_WAITING_FOR_SUPPLICANT "waiting-for-supplicant"