mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 07:58:00 +02:00
ifcfg-rh: preserve the archaic NETMASK key
py-kickstart writes this out and there apparently are users using this. Let them have one less problem. Co-Authored-By: Thomas Haller <thaller@redhat.com> https://bugzilla.redhat.com/show_bug.cgi?id=1445414 (cherry picked from commit dbe0659ba419a77ad5ff2340bfc93c71a1bec61a)
This commit is contained in:
parent
40b39844fa
commit
d21b21eba1
1 changed files with 11 additions and 2 deletions
|
|
@ -2127,6 +2127,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
*/
|
||||
for (i = n = 0; i < num; i++) {
|
||||
NMIPAddress *addr;
|
||||
guint prefix;
|
||||
|
||||
addr = nm_setting_ip_config_get_address (s_ip4, i);
|
||||
|
||||
|
|
@ -2157,11 +2158,19 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
|
||||
svSetValueStr (ifcfg, addr_key, nm_ip_address_get_address (addr));
|
||||
|
||||
tmp = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr));
|
||||
prefix = nm_ip_address_get_prefix (addr);
|
||||
tmp = g_strdup_printf ("%u", prefix);
|
||||
svSetValueStr (ifcfg, prefix_key, tmp);
|
||||
g_free (tmp);
|
||||
|
||||
svUnsetValue (ifcfg, netmask_key);
|
||||
/* If the legacy "NETMASK" is present, keep it. */
|
||||
if (svGetValue (ifcfg, netmask_key, &tmp)) {
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
|
||||
g_free (tmp);
|
||||
svSetValueStr (ifcfg, netmask_key, nm_utils_inet4_ntop (prefix, buf));
|
||||
}
|
||||
|
||||
svUnsetValue (ifcfg, gw_key);
|
||||
n++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue