diff options
author | Thomas Haller <thaller@redhat.com> | 2019-10-09 12:43:14 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-10-10 11:04:12 +0200 |
commit | 55a91bae785b5482b3e9897c6eedd4943ce85800 (patch) | |
tree | 38d3cce092602f259833b04522deda7bd9889658 | |
parent | 724113c14408a71774c1ec3526d5f275af99cc07 (diff) | |
download | NetworkManager-th/device-no-pending-action-for-dhcp.tar.gz |
device: don't delay startup complete for pending-actions "autoconf", "dhcp4" and "dhcp6"th/device-no-pending-action-for-dhcp
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 extensivley configurable (e.g. to exclude devices). However,
the intent is to wait that all devices are "settled". That means among
others, the timeouts waiting for carrier and Wi-Fi scan results passed,
devices either don't have a connection profile to autoactivate, or
that autoactivating profiles reach a state of activated.
A major point here is that the device is considered ready, once it
reaches the state "activate". 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
devic. So, it is wrong to have distrinct pending actions for these operations.
Remove them.
This fixes that we wrongly would wait too long before declaring startup
complete.
-rw-r--r-- | src/devices/nm-device.c | 26 | ||||
-rw-r--r-- | src/devices/nm-device.h | 3 |
2 files changed, 1 insertions, 28 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 1fe74b55e3..53dd934424 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... */ @@ -9793,9 +9778,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 */ @@ -9816,8 +9798,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); @@ -10818,8 +10798,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); @@ -10981,8 +10959,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 df8777b720..1bfbccaefa 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" |