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
This commit is contained in:
Lubomir Rintel 2017-04-26 20:26:07 +02:00
parent 38fbcdf0e5
commit 9e668595fe

View file

@ -2102,6 +2102,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);
@ -2131,9 +2132,18 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
}
svSetValueStr (ifcfg, addr_key, nm_ip_address_get_address (addr));
svSetValueInt64 (ifcfg, prefix_key, nm_ip_address_get_prefix (addr));
svUnsetValue (ifcfg, netmask_key);
prefix = nm_ip_address_get_prefix (addr);
svSetValueInt64 (ifcfg, prefix_key, prefix);
/* 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++;
}