[PATCH] ifcfg-rh: Enable IPv6 by default and make IPv4 optional



This patch changes the default values of the IPV6INIT and
IPV4_FAILURE_FATAL ifcfg variables, which allows a Fedora/Red Hat host
to, with no manual configuration necessary, successfully connect to an
IPv6-only network, as well as learn DHCPv6-provided information (such as
DNS servers and IP addresses) when connecting to a dual-stacked network.

It also changes the semantics of an ifcfg file that has only IPv6 layer
3 configuration settings (no IPv4) slightly, in this case DHCPv4 will be
performed. Before, this configuration would lead to IPv4 being disabled.
In order for IPv4 to be disabled when IPv6 is explicitly enabled, the
BOOTPROTO variable must be set to NONE.

diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index cdf5889..9ff5af2 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -1204,9 +1204,8 @@ make_ip4_setting (shvarFile *ifcfg,
 		char *tmp_ip4_1, *tmp_prefix_1, *tmp_netmask_1;
 		char *tmp_ip4_2, *tmp_prefix_2, *tmp_netmask_2;
 
-		/* If there is no BOOTPROTO, no IPADDR, no PREFIX, no NETMASK, but
-		 * valid IPv6 configuration, assume that IPv4 is disabled.  Otherwise,
-		 * if there is no IPv6 configuration, assume DHCP is to be used.
+		/* If there is no BOOTPROTO, no IPADDR, no PREFIX, no NETMASK, assume
+		 * that DHCP is to be used.
 		 * Happens with minimal ifcfg files like the following that anaconda
 		 * sometimes used to write out:
 		 *
@@ -1230,11 +1229,7 @@ make_ip4_setting (shvarFile *ifcfg,
 		    && !tmp_ip4_0 && !tmp_prefix_0 && !tmp_netmask_0
 		    && !tmp_ip4_1 && !tmp_prefix_1 && !tmp_netmask_1
 		    && !tmp_ip4_2 && !tmp_prefix_2 && !tmp_netmask_2) {
-			if (valid_ip6_config)
-				/* Nope, no IPv4 */
-				method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
-			else
-				method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
+			method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
 		}
 		g_free (tmp_ip4);
 		g_free (tmp_prefix);
@@ -1255,7 +1250,7 @@ make_ip4_setting (shvarFile *ifcfg,
 	              NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE),
 	              NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE),
 	              NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default,
-	              NM_SETTING_IP4_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", TRUE),
+	              NM_SETTING_IP4_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", FALSE),
 	              NULL);
 
 	if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0)
@@ -1476,11 +1471,11 @@ make_ip6_setting (shvarFile *ifcfg,
 	/* Find out method property */
 	/* Is IPV6 enabled? Set method to "ignored", when not enabled */
 	str_value = svGetValue (ifcfg, "IPV6INIT", FALSE);
-	ipv6init = svTrueValue (ifcfg, "IPV6INIT", FALSE);
+	ipv6init = svTrueValue (ifcfg, "IPV6INIT", TRUE);
 	if (!str_value) {
 		network_ifcfg = svNewFile (network_file);
 		if (network_ifcfg) {
-			ipv6init = svTrueValue (network_ifcfg, "IPV6INIT", FALSE);
+			ipv6init = svTrueValue (network_ifcfg, "IPV6INIT", TRUE);
 			svCloseFile (network_ifcfg);
 		}
 	}

-- 
Tore Anderson


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]