NetworkManager r3858 - in trunk: . system-settings/plugins/ifcfg-fedora



Author: dcbw
Date: Sun Jul 27 20:00:13 2008
New Revision: 3858
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3858&view=rev

Log:
2008-07-27  Dan Williams  <dcbw redhat com>

	* system-settings/plugins/ifcfg-fedora/reader.c
		- (make_ip4_setting): fix parsing automatic configs



Modified:
   trunk/ChangeLog
   trunk/system-settings/plugins/ifcfg-fedora/reader.c

Modified: trunk/system-settings/plugins/ifcfg-fedora/reader.c
==============================================================================
--- trunk/system-settings/plugins/ifcfg-fedora/reader.c	(original)
+++ trunk/system-settings/plugins/ifcfg-fedora/reader.c	Sun Jul 27 20:00:13 2008
@@ -179,56 +179,59 @@
 
 	g_free (value);
 
-	get_one_ip4_addr (ifcfg, "IPADDR", &tmp.address, error);
-	if (*error)
-		goto error;
+	/* Handle manual settings */
+	if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
+		get_one_ip4_addr (ifcfg, "IPADDR", &tmp.address, error);
+		if (*error)
+			goto error;
 
-	get_one_ip4_addr (ifcfg, "GATEWAY", &tmp.gateway, error);
-	if (*error)
-		goto error;
+		get_one_ip4_addr (ifcfg, "GATEWAY", &tmp.gateway, error);
+		if (*error)
+			goto error;
 
-	/* If no gateway in the ifcfg, try /etc/sysconfig/network instead */
-	if (!tmp.gateway) {
-		shvarFile *network;
-
-		network = svNewFile ("/etc/sysconfig/network");
-		if (network) {
-			get_one_ip4_addr (network, "GATEWAY", &tmp.gateway, error);
-			svCloseFile (network);
-			if (*error)
+		/* If no gateway in the ifcfg, try /etc/sysconfig/network instead */
+		if (!tmp.gateway) {
+			shvarFile *network;
+
+			network = svNewFile ("/etc/sysconfig/network");
+			if (network) {
+				get_one_ip4_addr (network, "GATEWAY", &tmp.gateway, error);
+				svCloseFile (network);
+				if (*error)
+					goto error;
+			}
+		}
+
+		value = svGetValue (ifcfg, "PREFIX");
+		if (value) {
+			long int prefix;
+
+			errno = 0;
+			prefix = strtol (value, NULL, 10);
+			if (errno || prefix <= 0 || prefix > 32) {
+				g_set_error (error, ifcfg_plugin_error_quark (), 0,
+				             "Invalid IP4 prefix '%s'", value);
+				g_free (value);
 				goto error;
+			}
+			tmp.prefix = (guint32) prefix;
+			g_free (value);
 		}
-	}
 
-	value = svGetValue (ifcfg, "PREFIX");
-	if (value) {
-		long int prefix;
+		/* Fall back to NETMASK if no PREFIX was specified */
+		if (!tmp.prefix) {
+			get_one_ip4_addr (ifcfg, "NETMASK", &netmask, error);
+			if (*error)
+				goto error;
+			tmp.prefix = nm_utils_ip4_netmask_to_prefix (netmask);
+		}
 
-		errno = 0;
-		prefix = strtol (value, NULL, 10);
-		if (errno || prefix <= 0 || prefix > 32) {
+		/* Validate the prefix */
+		if (!tmp.prefix || tmp.prefix > 32) {
 			g_set_error (error, ifcfg_plugin_error_quark (), 0,
-			             "Invalid IP4 prefix '%s'", value);
-			g_free (value);
+			             "Invalid IP4 prefix '%d'", tmp.prefix);
 			goto error;
 		}
-		tmp.prefix = (guint32) prefix;
-		g_free (value);
-	}
-
-	/* Fall back to NETMASK if no PREFIX was specified */
-	if (!tmp.prefix) {
-		get_one_ip4_addr (ifcfg, "NETMASK", &netmask, error);
-		if (*error)
-			goto error;
-		tmp.prefix = nm_utils_ip4_netmask_to_prefix (netmask);
-	}
-
-	/* Validate the prefix */
-	if (!tmp.prefix || tmp.prefix > 32) {
-		g_set_error (error, ifcfg_plugin_error_quark (), 0,
-		             "Invalid IP4 prefix '%d'", tmp.prefix);
-		goto error;
 	}
 
 	/* Yay, let's make an IP4 config */



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