diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-07-02 09:45:22 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-07-02 13:42:19 +0200 |
commit | 390d79079eeabe6879f19ee9afee7ca8e1c6b778 (patch) | |
tree | 77d27301eb802ab91ea2b935ebdb7afb0aca617b | |
parent | 920e59016f8827ee006b168a7e189730116ea784 (diff) | |
download | NetworkManager-390d79079eeabe6879f19ee9afee7ca8e1c6b778.tar.gz |
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
-rw-r--r-- | src/initrd/nmi-cmdline-reader.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/initrd/nmi-cmdline-reader.c b/src/initrd/nmi-cmdline-reader.c index 5bc1f4bdef..a7fffd19b3 100644 --- a/src/initrd/nmi-cmdline-reader.c +++ b/src/initrd/nmi-cmdline-reader.c @@ -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. */ |