initrd: honor "ip=single-dhcp" option as alias for "dhcp"

This mode was added to network-legacy in [1]. NetworkManager anyway always
does DHCP in parallel, so this is basically an alias for "dhcp".
Note that network-legacy's "single-dhcp" will stop waiting for DHCP
once the first device gets an address. NetworkManager currently cannot
do that. While it runs DHCP in parallel, all devices need to settle
and there is no concept where completing one device makes the overall
"startup complete" process finish early. That could however be added.

Anyway, while not being exactly the same, it's still more useful to do
something similar instead of not working at all.

See-also: https://github.com/dracutdevs/dracut/pull/853
See-also: https://github.com/dracutdevs/dracut/pull/961
See-also: https://github.com/dracutdevs/dracut/pull/1048

[1] 4026cd3b01
This commit is contained in:
Thomas Haller 2021-07-23 10:53:45 +02:00
parent cf1b726157
commit bf7530ccc1
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -604,7 +604,7 @@ reader_parse_ip(Reader *reader, const char *sysfs_dir, char *argument)
NM_SETTING_IP4_CONFIG_METHOD_DISABLED,
NULL);
}
} else if (nm_streq0(kind, "dhcp")) {
} else if (NM_IN_STRSET(kind, "dhcp", "single-dhcp")) {
g_object_set(s_ip4,
NM_SETTING_IP_CONFIG_METHOD,
NM_SETTING_IP4_CONFIG_METHOD_AUTO,