diff --git a/man/NetworkManager.conf.xml b/man/NetworkManager.conf.xml
index f0c3c5c85..446540aa1 100644
--- a/man/NetworkManager.conf.xml
+++ b/man/NetworkManager.conf.xml
@@ -856,6 +856,24 @@ managed=1
+
+ carrier-wait-timeout
+
+
+ Specify the timeout for waiting for carrier in milliseconds.
+ When the device loses carrier, NetworkManager does not react
+ immediately. Instead, it waits for this timeout before considering
+ the link lost. Also, on startup, NetworkManager considers the
+ device as busy for this time, as long as the device has no carrier.
+ This delays startup-complete signal and NetworkManager-wait-online.
+ Configuring this too high means to block NetworkManager-wait-online
+ longer then necessary. Configuring it too low, means that NetworkManager
+ will declare startup-complete, although carrier is about to come
+ and auto-activation to kick in.
+ The default is 5000 milliseconds.
+
+
+
ignore-carrier
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index f1643ea77..012db82cf 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -328,7 +328,7 @@ typedef struct _NMDevicePrivate {
guint32 v4_route_table;
guint32 v6_route_table;
- /* when carrier goes away, we give a grace period of CARRIER_WAIT_TIME_MS
+ /* when carrier goes away, we give a grace period of _get_carrier_wait_ms()
* until taking action.
*
* When changing MTU, the device might take longer then that. So, whenever
@@ -10698,6 +10698,18 @@ nm_device_is_up (NMDevice *self)
return ifindex > 0 ? nm_platform_link_is_up (nm_device_get_platform (self), ifindex) : TRUE;
}
+static gint64
+_get_carrier_wait_ms (NMDevice *self)
+{
+ gs_free char *value = NULL;
+
+ value = nm_config_data_get_device_config (NM_CONFIG_GET_DATA,
+ NM_CONFIG_KEYFILE_KEY_DEVICE_CARRIER_WAIT_TIMEOUT,
+ self,
+ NULL);
+ return _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXINT32, CARRIER_WAIT_TIME_MS);
+}
+
gboolean
nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
{
@@ -10772,7 +10784,7 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
nm_device_add_pending_action (self, NM_PENDING_ACTION_CARRIER_WAIT, FALSE);
now_ms = nm_utils_get_monotonic_timestamp_ms ();
- until_ms = NM_MAX (now_ms + CARRIER_WAIT_TIME_MS, priv->carrier_wait_until_ms);
+ until_ms = NM_MAX (now_ms + _get_carrier_wait_ms (self), priv->carrier_wait_until_ms);
priv->carrier_wait_id = g_timeout_add (until_ms - now_ms, carrier_wait_timeout, self);
}
diff --git a/src/nm-config.h b/src/nm-config.h
index 17912185f..8bdd5002d 100644
--- a/src/nm-config.h
+++ b/src/nm-config.h
@@ -79,6 +79,7 @@
#define NM_CONFIG_KEYFILE_KEY_DEVICE_MANAGED "managed"
#define NM_CONFIG_KEYFILE_KEY_DEVICE_IGNORE_CARRIER "ignore-carrier"
#define NM_CONFIG_KEYFILE_KEY_DEVICE_SRIOV_NUM_VFS "sriov-num-vfs"
+#define NM_CONFIG_KEYFILE_KEY_DEVICE_CARRIER_WAIT_TIMEOUT "carrier-wait-timeout"
#define NM_CONFIG_KEYFILE_KEYPREFIX_WAS ".was."
#define NM_CONFIG_KEYFILE_KEYPREFIX_SET ".set."