Blob Blame History Raw
From b55e04fe76fac7e17c7f5cbc8f60435892f4c0c7 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 12 Mar 2021 17:05:42 +0100
Subject: [PATCH 1/2] shared: add nm_auto_unref_keyfile macro

(cherry picked from commit 4b58ecb592d5394fd426462eaa48a3e2ac26c774)
---
 shared/nm-glib-aux/nm-macros-internal.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h
index 57ddee0501e8..63ae67be1e48 100644
--- a/shared/nm-glib-aux/nm-macros-internal.h
+++ b/shared/nm-glib-aux/nm-macros-internal.h
@@ -253,6 +253,9 @@ static inline int nm_close (int fd);
 NM_AUTO_DEFINE_FCN_VOID0 (void *, _nm_auto_free_impl, free)
 #define nm_auto_free nm_auto(_nm_auto_free_impl)
 
+NM_AUTO_DEFINE_FCN0 (GKeyFile *, _nm_auto_unref_keyfile, g_key_file_unref);
+#define nm_auto_unref_keyfile nm_auto(_nm_auto_unref_keyfile)
+
 NM_AUTO_DEFINE_FCN0 (GVariantIter *, _nm_auto_free_variant_iter, g_variant_iter_free)
 #define nm_auto_free_variant_iter nm_auto(_nm_auto_free_variant_iter)
 
-- 
2.29.2


From c970c5c4809517334fcce99d567fcc71f5ba441a Mon Sep 17 00:00:00 2001
From: Adarsh J <adarshaj@gmail.com>
Date: Mon, 18 Jan 2021 03:15:14 +0900
Subject: [PATCH 2/2] initrd: add support for rd.net.timeout.carrier

Add support for `carrier-wait-timeout` setting from kernel cmdline.

This will create a new `15-carrier-timeout.conf` file in
/run/NetworkManager/conf.d with the parameter value as specified.

The setting also inserts `match-device` to `*`, matching all devices.

NB: The parameter on kernel cmdline is specified in seconds. This is
done to be backwards compatible with with network-legacy module. However
the generated setting will automatically multiply specified value by
1000 and store timeout value in ms.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/626

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/730
(cherry picked from commit e300138892ee0fc3824d38b527b60103a01758ab)
(cherry picked from commit f55eeff70a6639e5ec8abbde9b574d46e8f0b6f7)
(cherry picked from commit 7a91960989fc564e25e1a9be0fd5f7c4886b2c33)
---
 man/nm-initrd-generator.xml            |  15 ++
 src/initrd/nm-initrd-generator.c       |  68 +++++++--
 src/initrd/nm-initrd-generator.h       |   5 +-
 src/initrd/nmi-cmdline-reader.c        |  12 +-
 src/initrd/tests/test-cmdline-reader.c | 182 +++++++++++++++++++------
 5 files changed, 223 insertions(+), 59 deletions(-)

diff --git a/man/nm-initrd-generator.xml b/man/nm-initrd-generator.xml
index 37f5ffdf4b17..fcfb54fe50d9 100644
--- a/man/nm-initrd-generator.xml
+++ b/man/nm-initrd-generator.xml
@@ -102,6 +102,20 @@
         </listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term>
+          <group choice='plain'>
+            <arg choice='plain'><option>-r</option></arg>
+            <arg choice='plain'><option>--run-config-dir</option></arg>
+          </group>
+          <arg choice='plain'><replaceable>path</replaceable></arg>
+        </term>
+
+        <listitem>
+          <para>Output directory for config files.</para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term>
           <group choice='plain'>
@@ -133,6 +147,7 @@
             <member><option>rd.peerdns</option></member>
             <member><option>rd.bootif</option></member>
             <member><option>rd.net.timeout.dhcp</option></member>
+            <member><option>rd.net.timeout.carrier</option></member>
             <member><option>BOOTIF</option></member>
           </simplelist>
 
diff --git a/src/initrd/nm-initrd-generator.c b/src/initrd/nm-initrd-generator.c
index 5a93480bf2bc..5b92763cb320 100644
--- a/src/initrd/nm-initrd-generator.c
+++ b/src/initrd/nm-initrd-generator.c
@@ -9,6 +9,7 @@
 #include "nm-keyfile/nm-keyfile-internal.h"
 #include "nm-initrd-generator.h"
 #include "nm-glib-aux/nm-io-utils.h"
+#include "nm-config.h"
 
 /*****************************************************************************/
 
@@ -65,6 +66,7 @@ err_out:
 
 #define DEFAULT_SYSFS_DIR        "/sys"
 #define DEFAULT_INITRD_DATA_DIR  NMRUNDIR "/initrd"
+#define DEFAULT_RUN_CONFIG_DIR   NMRUNDIR "/conf.d"
 
 int
 main (int argc, char *argv[])
@@ -73,12 +75,14 @@ main (int argc, char *argv[])
 	gs_free char *connections_dir = NULL;
 	gs_free char *initrd_dir = NULL;
 	gs_free char *sysfs_dir = NULL;
+	gs_free char *run_config_dir = NULL;
 	gboolean dump_to_stdout = FALSE;
 	gs_strfreev char **remaining = NULL;
 	GOptionEntry option_entries[] = {
 		{ "connections-dir",  'c',  0, G_OPTION_ARG_FILENAME,     &connections_dir, "Output connection directory",         NM_KEYFILE_PATH_NAME_RUN },
 		{ "initrd-data-dir",  'i',  0, G_OPTION_ARG_FILENAME,     &initrd_dir,      "Output initrd data directory",        DEFAULT_INITRD_DATA_DIR },
 		{ "sysfs-dir",        'd',  0, G_OPTION_ARG_FILENAME,     &sysfs_dir,       "The sysfs mount point",               DEFAULT_SYSFS_DIR },
+		{ "run-config-dir",   'r',  0, G_OPTION_ARG_FILENAME,     &run_config_dir,  "Output config directory",             DEFAULT_RUN_CONFIG_DIR },
 		{ "stdout",           's',  0, G_OPTION_ARG_NONE,         &dump_to_stdout,  "Dump connections to standard output", NULL },
 		{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &remaining,       NULL,                                  NULL },
 		{ NULL }
@@ -87,9 +91,11 @@ main (int argc, char *argv[])
 	gs_free_error GError *error = NULL;
 	gs_free char *hostname = NULL;
 	int errsv;
+	gint64 carrier_timeout_sec = 0;
 
 	option_context = g_option_context_new ("-- [ip=...] [rd.route=...] [bridge=...] [bond=...] [team=...] [vlan=...] "
-	                                       "[bootdev=...] [nameserver=...] [rd.peerdns=...] [rd.bootif=...] [BOOTIF=...] [rd.znet=...] ... ");
+	                                       "[bootdev=...] [nameserver=...] [rd.peerdns=...] [rd.bootif=...] [BOOTIF=...] "
+	                                       "[rd.znet=...] [rd.net.timeout.carrier=...] ... ");
 
 	g_option_context_set_summary (option_context, "Generate early NetworkManager configuration.");
 	g_option_context_set_description (option_context,
@@ -114,31 +120,40 @@ main (int argc, char *argv[])
 		sysfs_dir = g_strdup (DEFAULT_SYSFS_DIR);
 	if (!initrd_dir)
 		initrd_dir = g_strdup (DEFAULT_INITRD_DATA_DIR);
-	if (dump_to_stdout)
-		nm_clear_g_free (&connections_dir);
-
-	if (connections_dir && g_mkdir_with_parents (connections_dir, 0755) != 0) {
-		errsv = errno;
-		_LOGW (LOGD_CORE, "%s: %s", connections_dir, nm_strerror_native (errsv));
-		return 1;
-	}
+	if (!run_config_dir)
+		run_config_dir = g_strdup (DEFAULT_RUN_CONFIG_DIR);
 
 	connections = nmi_cmdline_reader_parse (sysfs_dir,
-	                                        (const char *const*) remaining,
-	                                        &hostname);
-
-	g_hash_table_foreach (connections, output_conn, connections_dir);
-	g_hash_table_destroy (connections);
+	                                        (const char *const *) remaining,
+	                                        &hostname,
+	                                        &carrier_timeout_sec);
 
 	if (dump_to_stdout) {
+		nm_clear_g_free (&connections_dir);
+		nm_clear_g_free (&initrd_dir);
+		nm_clear_g_free (&run_config_dir);
 		if (hostname)
 			g_print ("\n*** Hostname '%s' ***\n", hostname);
+		if (carrier_timeout_sec != 0) {
+			g_print ("\n*** Carrier Wait Timeout %" G_GINT64_FORMAT " sec ***\n",
+			        carrier_timeout_sec);
+		}
 	} else {
+		if (g_mkdir_with_parents (connections_dir, 0755) != 0) {
+			errsv = errno;
+			_LOGW (LOGD_CORE, "%s: %s", connections_dir, nm_strerror_native (errsv));
+			return 1;
+		}
 		if (g_mkdir_with_parents (initrd_dir, 0755) != 0) {
 			errsv = errno;
 			_LOGW (LOGD_CORE, "%s: %s", initrd_dir, nm_strerror_native (errsv));
 			return 1;
 		}
+		if (g_mkdir_with_parents (run_config_dir, 0755) != 0) {
+			errsv = errno;
+			_LOGW (LOGD_CORE, "%s: %s", run_config_dir, nm_strerror_native (errsv));
+			return 1;
+		}
 
 		if (hostname) {
 			gs_free char *hostname_file = NULL;
@@ -152,7 +167,32 @@ main (int argc, char *argv[])
 				return 1;
 			}
 		}
+		if (carrier_timeout_sec != 0) {
+			nm_auto_unref_keyfile GKeyFile *keyfile  = NULL;
+			gs_free char *filename = NULL;
+
+			keyfile = g_key_file_new ();
+			g_key_file_set_list_separator (keyfile, NM_CONFIG_KEYFILE_LIST_SEPARATOR);
+			filename = g_strdup_printf ("%s/15-carrier-timeout.conf", run_config_dir);
+
+			g_key_file_set_value (keyfile,
+			                     NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE "-15-carrier-timeout",
+			                     NM_CONFIG_KEYFILE_KEY_MATCH_DEVICE,
+			                     "*");
+			g_key_file_set_int64 (keyfile,
+			                     NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE "-15-carrier-timeout",
+			                     NM_CONFIG_KEYFILE_KEY_DEVICE_CARRIER_WAIT_TIMEOUT,
+			                     carrier_timeout_sec * 1000);
+
+			if (!g_key_file_save_to_file (keyfile, filename, &error)) {
+				_LOGW (LOGD_CORE, "%s: %s", filename, error->message);
+				return 1;
+			}
+		}
 	}
 
+	g_hash_table_foreach (connections, output_conn, connections_dir);
+	g_hash_table_destroy (connections);
+
 	return 0;
 }
diff --git a/src/initrd/nm-initrd-generator.h b/src/initrd/nm-initrd-generator.h
index e7647edd7fab..9a2068b16228 100644
--- a/src/initrd/nm-initrd-generator.h
+++ b/src/initrd/nm-initrd-generator.h
@@ -36,6 +36,9 @@ gboolean nmi_ibft_update_connection_from_nic (NMConnection *connection, GHashTab
 
 NMConnection *nmi_dt_reader_parse (const char *sysfs_dir);
 
-GHashTable *nmi_cmdline_reader_parse (const char *sysfs_dir, const char *const*argv, char **hostname);
+GHashTable *nmi_cmdline_reader_parse (const char *sysfs_dir,
+                                      const char *const *argv,
+                                      char **hostname,
+                                      gint64 *carrier_timeout_sec);
 
 #endif  /* __NM_INITRD_GENERATOR_H__ */
diff --git a/src/initrd/nmi-cmdline-reader.c b/src/initrd/nmi-cmdline-reader.c
index 17e0ce5d4a05..b114079381b7 100644
--- a/src/initrd/nmi-cmdline-reader.c
+++ b/src/initrd/nmi-cmdline-reader.c
@@ -31,6 +31,8 @@ typedef struct {
 	gboolean ignore_auto_dns;
 	int dhcp_timeout;
 	char *dhcp4_vci;
+
+	gint64 carrier_timeout_sec;
 } Reader;
 
 static Reader *
@@ -970,7 +972,10 @@ connection_set_needed_cb (gpointer key, gpointer value, gpointer user_data)
 }
 
 GHashTable *
-nmi_cmdline_reader_parse (const char *sysfs_dir, const char *const*argv, char **hostname)
+nmi_cmdline_reader_parse (const char *sysfs_dir,
+                          const char *const*argv,
+                          char **hostname,
+                          gint64 *carrier_timeout_sec)
 {
 	Reader *reader;
 	const char *tag;
@@ -1005,6 +1010,9 @@ nmi_cmdline_reader_parse (const char *sysfs_dir, const char *const*argv, char **
 		} else if (nm_streq (tag, "rd.net.dhcp.vendor-class")) {
 			if (nm_utils_validate_dhcp4_vendor_class_id (argument, NULL))
 				nm_utils_strdup_reset (&reader->dhcp4_vci, argument);
+		} else if (nm_streq (tag, "rd.net.timeout.carrier")) {
+			reader->carrier_timeout_sec = _nm_utils_ascii_str_to_int64 (argument,
+			                                                            10, 0, G_MAXINT32, 0);
 		}
 	}
 
@@ -1159,5 +1167,7 @@ nmi_cmdline_reader_parse (const char *sysfs_dir, const char *const*argv, char **
 
 	NM_SET_OUT (hostname, g_steal_pointer (&reader->hostname));
 
+	NM_SET_OUT (carrier_timeout_sec, reader->carrier_timeout_sec);
+
 	return reader_destroy (reader, FALSE);
 }
diff --git a/src/initrd/tests/test-cmdline-reader.c b/src/initrd/tests/test-cmdline-reader.c
index c4c5c7483ab6..259b1c4476a3 100644
--- a/src/initrd/tests/test-cmdline-reader.c
+++ b/src/initrd/tests/test-cmdline-reader.c
@@ -31,11 +31,13 @@ test_auto (void)
 	NMSettingIPConfig *s_ip4;
 	NMSettingIPConfig *s_ip6;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "default_connection");
 	g_assert (connection);
@@ -86,11 +88,13 @@ test_dhcp_with_hostname (void)
 	NMSettingIPConfig *s_ip4;
 	NMSettingIPConfig *s_ip6;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, "host1");
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "default_connection");
 	g_assert (connection);
@@ -138,11 +142,13 @@ test_dhcp_with_mtu (void)
 		NMSettingIPConfig *s_ip4;
 		NMSettingIPConfig *s_ip6;
 		gs_free char *hostname = NULL;
+		gint64 carrier_timeout_sec = 0;
 
-		connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV[i], &hostname);
+		connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV[i], &hostname, &carrier_timeout_sec);
 		g_assert (connections);
 		g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 		g_assert_cmpstr (hostname, ==, NULL);
+		g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 		connection = g_hash_table_lookup (connections, "default_connection");
 		g_assert (connection);
@@ -182,11 +188,13 @@ test_if_auto_with_mtu (void)
 	NMSettingIPConfig *s_ip4;
 	NMSettingIPConfig *s_ip6;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth0");
 	g_assert (connection);
@@ -217,11 +225,13 @@ test_if_dhcp6 (void)
 	NMSettingIPConfig *s_ip4;
 	NMSettingIPConfig *s_ip6;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth1");
 	g_assert (connection);
@@ -250,11 +260,13 @@ test_if_auto_with_mtu_and_mac (void)
 	NMSettingIPConfig *s_ip4;
 	NMSettingIPConfig *s_ip6;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth2");
 	g_assert (connection);
@@ -292,11 +304,13 @@ test_if_ip4_manual (void)
 	NMSettingIPConfig *s_ip6;
 	NMIPAddress *ip_addr;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 	g_assert_cmpstr (hostname, ==, "hostname1.example.com");
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth3");
 	g_assert (connection);
@@ -362,11 +376,13 @@ test_if_ip6_manual (void)
 	NMSettingIPConfig *s_ip6;
 	NMIPAddress *ip_addr;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, "hostname0.example.com");
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth4");
 	g_assert (connection);
@@ -400,11 +416,13 @@ test_if_mac_ifname (void)
 	NMSettingWired *s_wired;
 	NMIPAddress *ip_addr;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, "hostname0");
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "00:11:22:33:44:55");
 	g_assert (connection);
@@ -445,11 +463,13 @@ test_multiple_merge (void)
 	NMSettingIPConfig *s_ip6;
 	NMIPAddress *ip_addr;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth0");
 	g_assert (connection);
@@ -497,11 +517,13 @@ test_multiple_bootdev (void)
 	NMSettingIPConfig *s_ip4;
 	NMSettingIPConfig *s_ip6;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth3");
 	g_assert (connection);
@@ -532,11 +554,13 @@ test_bootdev (void)
 	NMConnection *connection;
 	NMSettingConnection *s_con;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 3);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "ens3");
 	g_assert (connection);
@@ -587,11 +611,13 @@ test_some_more (void)
 	NMSettingIPConfig *s_ip6;
 	NMIPRoute *ip_route;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth1");
 	g_assert (connection);
@@ -671,11 +697,13 @@ test_bond (void)
 	NMIPRoute *ip_route;
 	const char *master_uuid;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 3);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "bong0");
 	g_assert (connection);
@@ -756,11 +784,13 @@ test_bond_ip (void)
 	NMIPAddress *ip_addr;
 	const char *master_uuid;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 3);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "bond0");
 	g_assert (connection);
@@ -840,11 +870,13 @@ test_bond_default (void)
 	NMSettingBond *s_bond;
 	const char *master_uuid;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "bond0");
 
@@ -905,11 +937,13 @@ test_bridge (void)
 	NMIPRoute *ip_route;
 	const char *master_uuid;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 3);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "bridge0");
 	g_assert (connection);
@@ -987,11 +1021,13 @@ test_bridge_default (void)
 	NMSettingBridge *s_bridge;
 	const char *master_uuid;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "br0");
 
@@ -1050,11 +1086,13 @@ test_bridge_ip (void)
 	const char *master_uuid;
 	gs_free char *hostname = NULL;
 	guint i;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 11);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "bridge123");
 	g_assert (connection);
@@ -1112,11 +1150,13 @@ test_team (void)
 	NMSettingTeam *s_team;
 	const char *master_uuid;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 3);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "team0");
 	g_assert (connection);
@@ -1187,11 +1227,13 @@ test_vlan (void)
 		NMSettingIPConfig *s_ip6;
 		NMSettingVlan *s_vlan;
 		gs_free char *hostname = NULL;
+		gint64 carrier_timeout_sec = 0;
 
-		connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV[i], &hostname);
+		connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV[i], &hostname, &carrier_timeout_sec);
 		g_assert (connections);
 		g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 		g_assert_cmpstr (hostname, ==, NULL);
+		g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 		/* VLAN eth0.100 */
 		connection = g_hash_table_lookup (connections, "eth0.100");
@@ -1257,11 +1299,13 @@ test_vlan_with_dhcp_on_parent (void)
 		NMSettingIPConfig *s_ip6;
 		NMSettingVlan *s_vlan;
 		gs_free char *hostname = NULL;
+		gint64 carrier_timeout_sec = 0;
 
-		connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV[i], &hostname);
+		connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV[i], &hostname, &carrier_timeout_sec);
 		g_assert (connections);
 		g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 		g_assert_cmpstr (hostname, ==, NULL);
+		g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 		/* VLAN eth0.100 */
 		connection = g_hash_table_lookup (connections, "eth0.100");
@@ -1334,11 +1378,13 @@ test_vlan_over_bond (void)
 		NMSettingIPConfig *s_ip6;
 		NMSettingVlan *s_vlan;
 		gs_free char *hostname = NULL;
+		gint64 carrier_timeout_sec = 0;
 
-		connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV[i], &hostname);
+		connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV[i], &hostname, &carrier_timeout_sec);
 		g_assert (connections);
 		g_assert_cmpint (g_hash_table_size (connections), ==, 4);
 		g_assert_cmpstr (hostname, ==, NULL);
+		g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 		/* VLAN vlan1 */
 		connection = g_hash_table_lookup (connections, "vlan1");
@@ -1402,11 +1448,13 @@ test_ibft_ip_dev (void)
 	NMSettingConnection *s_con;
 	NMConnection *connection;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth0");
 	g_assert (connection);
@@ -1425,11 +1473,13 @@ test_ibft_ip_dev_mac (void)
 	NMSettingConnection *s_con;
 	NMConnection *connection;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "00:53:06:66:AB:01");
 	g_assert (connection);
@@ -1446,11 +1496,13 @@ _test_ibft_ip (const char *const*ARGV)
 	gs_unref_hashtable GHashTable *connections = NULL;
 	NMConnection *connection;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "ibft0");
 	g_assert (connection);
@@ -1487,11 +1539,13 @@ test_ignore_extra (void)
 	gs_unref_hashtable GHashTable *connections = NULL;
 	const char *const*ARGV = NM_MAKE_STRV ("blabla", "extra", "lalala");
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 0);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 }
 
 static void
@@ -1512,11 +1566,13 @@ test_rd_znet (void)
 	};
 	int i_s390_options_keys;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 	g_assert_cmpstr (hostname, ==, "foo.example.com");
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "enc800");
 	g_assert (NM_IS_CONNECTION (connection));
@@ -1592,11 +1648,13 @@ test_rd_znet_legacy (void)
 	NMConnection *connection;
 	NMSettingConnection *s_con;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 	g_assert_cmpstr (hostname, ==, "foo.example.com");
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth0");
 	g_assert (NM_IS_CONNECTION (connection));
@@ -1627,11 +1685,13 @@ test_rd_znet_no_ip (void)
 	gs_unref_hashtable GHashTable *connections = NULL;
 	const char *const*const ARGV = NM_MAKE_STRV ("rd.znet=qeth,0.0.0800,0.0.0801,0.0.0802,layer2=0,portno=1");
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 0);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 }
 
 static void
@@ -1645,11 +1705,13 @@ test_bootif_ip (void)
 	NMSettingIPConfig *s_ip4;
 	NMSettingIPConfig *s_ip6;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "default_connection");
 	g_assert (connection);
@@ -1683,11 +1745,13 @@ test_neednet (void)
 	NMConnection *connection;
 	NMSettingConnection *s_con;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 4);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eno1");
 	g_assert (connection);
@@ -1732,11 +1796,13 @@ test_bootif_no_ip (void)
 	NMSettingIPConfig *s_ip4;
 	NMSettingIPConfig *s_ip6;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "default_connection");
 	g_assert (connection);
@@ -1769,11 +1835,13 @@ test_bootif_hwtype (void)
 	NMSettingIPConfig *s_ip4;
 	NMSettingIPConfig *s_ip6;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 2);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth0");
 	g_assert (connection);
@@ -1834,11 +1902,13 @@ test_nameserver (void)
 	NMConnection *connection;
 	NMSettingIPConfig *s_ip;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 3);
 	g_assert_cmpstr (hostname, ==, "foo.example.com");
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eth0");
 	g_assert (connection);
@@ -1876,11 +1946,13 @@ test_bootif_off (void)
 	gs_unref_hashtable GHashTable *connections = NULL;
 	const char *const*ARGV = NM_MAKE_STRV ("BOOTIF=01-00-53-AB-cd-02-03", "rd.bootif=0");
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 0);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 }
 
 static void
@@ -1894,11 +1966,13 @@ test_dhcp_vendor_class_id (void)
 	gs_free char *hostname = NULL;
 	gs_free char *vci_long = NULL;
 	char vci_arg_long[512] = {0};
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "eno1");
 	g_assert (connection);
@@ -1910,12 +1984,13 @@ test_dhcp_vendor_class_id (void)
 
 	ARGV = NM_MAKE_STRV ("rd.net.dhcp.vendor-class",
 	                     "ip=eno1:dhcp");
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	connection = g_hash_table_lookup (connections, "eno1");
 	g_assert (connection);
 	nmtst_assert_connection_verifies_without_normalization (connection);
 	s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting_ip4_config (connection));
 	g_assert (nm_setting_ip4_config_get_dhcp_vendor_class_identifier (s_ip4) == NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	nm_clear_pointer (&connections, g_hash_table_unref);
 
@@ -1923,12 +1998,13 @@ test_dhcp_vendor_class_id (void)
 	vci_long = g_strdup_printf ("rd.net.dhcp.vendor-class=%s", vci_arg_long);
 	ARGV = NM_MAKE_STRV (vci_long,
 	                     "ip=eno1:dhcp");
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	connection = g_hash_table_lookup (connections, "eno1");
 	g_assert (connection);
 	nmtst_assert_connection_verifies_without_normalization (connection);
 	s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting_ip4_config (connection));
 	g_assert (nm_setting_ip4_config_get_dhcp_vendor_class_identifier (s_ip4) == NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 }
 
 static void
@@ -1939,11 +2015,13 @@ test_infiniband_iface (void)
 	NMConnection *connection;
 	NMSettingInfiniband *s_ib;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "ib1");
 	g_assert (connection);
@@ -1963,11 +2041,13 @@ test_infiniband_mac (void)
 	NMConnection *connection;
 	NMSettingInfiniband *s_ib;
 	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
 
-	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname);
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
 	g_assert (connections);
 	g_assert_cmpint (g_hash_table_size (connections), ==, 1);
 	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 0);
 
 	connection = g_hash_table_lookup (connections, "00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33");
 	g_assert (connection);
@@ -1983,6 +2063,21 @@ test_infiniband_mac (void)
 	                 "00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33");
 }
 
+static void
+test_carrier_timeout (void)
+{
+	gs_unref_hashtable GHashTable *connections = NULL;
+	const char *const *ARGV = NM_MAKE_STRV ("rd.net.timeout.carrier=20");
+	gs_free char *hostname = NULL;
+	gint64 carrier_timeout_sec = 0;
+
+	connections = nmi_cmdline_reader_parse (TEST_INITRD_DIR "/sysfs", ARGV, &hostname, &carrier_timeout_sec);
+	g_assert (connections);
+	g_assert_cmpint (g_hash_table_size (connections), ==, 0);
+	g_assert_cmpstr (hostname, ==, NULL);
+	g_assert_cmpint (carrier_timeout_sec, ==, 20);
+}
+
 NMTST_DEFINE ();
 
 int main (int argc, char **argv)
@@ -2027,8 +2122,9 @@ int main (int argc, char **argv)
 	g_test_add_func ("/initrd/cmdline/bootif/off", test_bootif_off);
 	g_test_add_func ("/initrd/cmdline/neednet", test_neednet);
 	g_test_add_func ("/initrd/cmdline/dhcp/vendor_class_id", test_dhcp_vendor_class_id);
-	g_test_add_func("/initrd/cmdline/infiniband/iface", test_infiniband_iface);
-	g_test_add_func("/initrd/cmdline/infiniband/mac", test_infiniband_mac);
+	g_test_add_func ("/initrd/cmdline/infiniband/iface", test_infiniband_iface);
+	g_test_add_func ("/initrd/cmdline/infiniband/mac", test_infiniband_mac);
+	g_test_add_func ("/initrd/cmdline/carrier_timeout", test_carrier_timeout);
 
 	return g_test_run ();
 }
-- 
2.29.2