Blame SOURCES/1025-initrd-timeout-carrier-rh1917773.patch

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