diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-05-27 11:24:45 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-05-28 11:22:16 +0200 |
commit | a9f71b48cd4e0e48accd00fdbaa696e556ff5fca (patch) | |
tree | a9c70abdb2e4c6c92e82a87a888cc0a9fa73cefc | |
parent | e1b824b871b40d7f033ebd2fcbe80331b0b14e4c (diff) | |
download | NetworkManager-lr/rd-neednet.tar.gz |
initrd/cmdline: add support for rd.neednet optionlr/rd-neednet
This is used to indicate the network dracut module should fall back to
configure network automatically (as with ip=dhcp was specified) if
there's no other network configuration present on the command line.
The option is documented in dracut.cmdline(7).
-rw-r--r-- | src/initrd/nmi-cmdline-reader.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/initrd/nmi-cmdline-reader.c b/src/initrd/nmi-cmdline-reader.c index b9c75c1ba2..65a2530149 100644 --- a/src/initrd/nmi-cmdline-reader.c +++ b/src/initrd/nmi-cmdline-reader.c @@ -678,6 +678,7 @@ nmi_cmdline_reader_parse (const char *sysfs_dir, char **argv) const char *tag; char *argument; gboolean ignore_bootif = FALSE; + gboolean neednet = FALSE; char *bootif = NULL; int i; @@ -706,6 +707,8 @@ nmi_cmdline_reader_parse (const char *sysfs_dir, char **argv) parse_rd_peerdns (connections, argument); else if (strcmp (tag, "rd.bootif") == 0) ignore_bootif = !_nm_utils_ascii_str_to_bool (argument, TRUE); + else if (strcmp (tag, "rd.neednet") == 0) + neednet = _nm_utils_ascii_str_to_bool (argument, TRUE); else if (strcasecmp (tag, "BOOTIF") == 0) bootif = argument; } @@ -723,6 +726,10 @@ nmi_cmdline_reader_parse (const char *sysfs_dir, char **argv) NM_SETTING_WIRED_MAC_ADDRESS, bootif, NULL); } + if (neednet && g_hash_table_size (connections) == 0) { + /* Make sure there's some connection. */ + get_conn (connections, NULL, NM_SETTING_WIRED_SETTING_NAME); + } g_hash_table_foreach (connections, _normalize_conn, NULL); |