mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 22:20:19 +01: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
This commit is contained in:
parent
38fbcdf0e5
commit
9e668595fe
1 changed files with 12 additions and 2 deletions
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue