NetworkManager r3908 - in trunk: . src/dhcp-manager



Author: dcbw
Date: Thu Aug  7 17:59:16 2008
New Revision: 3908
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3908&view=rev

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

	* src/dhcp-manager/nm-dhcp-manager.c
		- (nm_dhcp_manager_get_ip4_config): fix regression which caused
			mis-handling of DHCP responses that returned more than one router
			(found by Grant Williamson)



Modified:
   trunk/ChangeLog
   trunk/src/dhcp-manager/nm-dhcp-manager.c

Modified: trunk/src/dhcp-manager/nm-dhcp-manager.c
==============================================================================
--- trunk/src/dhcp-manager/nm-dhcp-manager.c	(original)
+++ trunk/src/dhcp-manager/nm-dhcp-manager.c	Thu Aug  7 17:59:16 2008
@@ -747,9 +747,20 @@
 	}
 
 	str = g_hash_table_lookup (device->options, "new_routers");
-	if (str && (inet_pton (AF_INET, str, &tmp_addr) > 0)) {
-		addr->gateway = tmp_addr.s_addr;
-		nm_info("  gateway %s", str);
+	if (str) {
+		char **routers = g_strsplit (str, " ", 0);
+		char **s;
+
+		for (s = routers; *s; s++) {
+			/* FIXME: how to handle multiple routers? */
+			if (inet_pton (AF_INET, *s, &tmp_addr) > 0) {
+				addr->gateway = tmp_addr.s_addr;
+				nm_info ("  gateway %s", *s);
+				break;
+			} else
+				nm_warning ("Ignoring invalid gateway '%s'", *s);
+		}
+		g_strfreev (routers);
 	}
 
 	nm_ip4_config_take_address (ip4_config, addr);



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