mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 15:00:25 +01:00
ifupdown: Allow netmask to be CIDR-style prefix length (bgo #679123)
This commit is contained in:
parent
4fdca493ad
commit
43d4d16b5b
1 changed files with 10 additions and 2 deletions
|
|
@ -498,12 +498,20 @@ update_ip4_setting_from_if_block(NMConnection *connection,
|
|||
/* mask/prefix */
|
||||
netmask_v = ifparser_getkey (block, "netmask");
|
||||
if (netmask_v) {
|
||||
if (!inet_pton (AF_INET, netmask_v, &tmp_mask)) {
|
||||
if (strlen (netmask_v) < 7) {
|
||||
netmask_int = atoi (netmask_v);
|
||||
if (netmask_int > 32) {
|
||||
g_set_error (error, eni_plugin_error_quark (), 0,
|
||||
"Invalid IPv4 netmask '%s'", netmask_v);
|
||||
goto error;
|
||||
}
|
||||
} else if (!inet_pton (AF_INET, netmask_v, &tmp_mask)) {
|
||||
g_set_error (error, eni_plugin_error_quark (), 0,
|
||||
"Invalid IPv4 netmask '%s'", netmask_v);
|
||||
goto error;
|
||||
} else {
|
||||
netmask_int = nm_utils_ip4_netmask_to_prefix (tmp_mask.s_addr);
|
||||
}
|
||||
netmask_int = nm_utils_ip4_netmask_to_prefix (tmp_mask.s_addr);
|
||||
}
|
||||
|
||||
/* gateway */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue