summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2017-04-26 19:53:37 +0200
committerLubomir Rintel <lkundrak@v3.sk>2017-04-27 17:24:23 +0200
commit38fbcdf0e5fd0b8d765aebe06e452ca0a7df4a84 (patch)
tree610ea90fd16a49bbf42a3827b02c4cf3a5014c8a
parent67fab76bf3621b26b8666332048ef0713ed139a1 (diff)
downloadNetworkManager-38fbcdf0e5fd0b8d765aebe06e452ca0a7df4a84.tar.gz
ifcfg-rh: preserve the archaic BOOTPROTO=static form
py-kickstart writes this out. Okay -- we don't care on read and it makes sense when there actually are addresses. https://bugzilla.redhat.com/show_bug.cgi?id=1445414
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
index ecccad64ff..a670ba5d1e 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
@@ -2071,11 +2071,17 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
return TRUE;
}
+ num = nm_setting_ip_config_get_num_addresses (s_ip4);
+
if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO))
svSetValueStr (ifcfg, "BOOTPROTO", "dhcp");
- else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
- svSetValueStr (ifcfg, "BOOTPROTO", "none");
- else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL))
+ else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
+ /* Preserve the archaic form of "static" if there actually
+ * is static configuration. */
+ if (g_strcmp0 (svGetValue (ifcfg, "BOOTPROTO", &tmp), "static") || !num)
+ svSetValueStr (ifcfg, "BOOTPROTO", "none");
+ g_free (tmp);
+ } else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL))
svSetValueStr (ifcfg, "BOOTPROTO", "autoip");
else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED))
svSetValueStr (ifcfg, "BOOTPROTO", "shared");
@@ -2094,7 +2100,6 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
/* Write out IPADDR<n>, PREFIX<n>, GATEWAY<n> for current IP addresses
* without labels. Unset obsolete NETMASK<n>.
*/
- num = nm_setting_ip_config_get_num_addresses (s_ip4);
for (i = n = 0; i < num; i++) {
NMIPAddress *addr;