initrd: allow specifying the net mask in form of a prefix

This is not documented in dracut.cmdline(7), however it seems to have
worked and has users and Red Hat even seems to recommend this (thanks to
Dan Horak for the pointers):

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/chap-installer-booting-ipl-s390
https://bugzilla.redhat.com/show_bug.cgi?id=1725872
This commit is contained in:
Lubomir Rintel 2019-07-02 09:45:22 +02:00
parent 920e59016f
commit 390d79079e

View file

@ -270,11 +270,13 @@ parse_ip (GHashTable *connections, const char *sysfs_dir, char *argument)
if (netmask && *netmask) {
NMIPAddr addr;
if (nm_utils_parse_inaddr_bin (AF_INET, netmask, NULL, &addr)) {
if (nm_utils_parse_inaddr_bin (AF_INET, netmask, NULL, &addr))
client_ip_prefix = nm_utils_ip4_netmask_to_prefix (addr.addr4);
} else {
else
client_ip_prefix = _nm_utils_ascii_str_to_int64 (netmask, 10, 0, 32, -1);
if (client_ip_prefix == -1)
_LOGW (LOGD_CORE, "Invalid IP mask: %s", netmask);
}
}
/* Static IP configuration might be present. */