NetworkManager r3589 - in trunk: . src



Author: dcbw
Date: Wed Apr 23 01:46:36 2008
New Revision: 3589
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3589&view=rev

Log:
2008-04-22  Dan Williams  <dcbw redhat com>

	* src/NetworkManagerPolicy.c
		- (update_routing_and_dns): when checking for a gateway, look at the
			composite IP4 config, not the connection's ip4-config setting, which
			doesn't include DHCP-returned information



Modified:
   trunk/ChangeLog
   trunk/src/NetworkManagerPolicy.c

Modified: trunk/src/NetworkManagerPolicy.c
==============================================================================
--- trunk/src/NetworkManagerPolicy.c	(original)
+++ trunk/src/NetworkManagerPolicy.c	Wed Apr 23 01:46:36 2008
@@ -126,11 +126,15 @@
 		NMDevice *dev = NM_DEVICE (iter->data);
 		NMActRequest *req;
 		NMConnection *connection;
+		NMIP4Config *ip4_config;
 		NMSettingIP4Config *s_ip4;
 		guint32 prio;
 		
-		if (   (nm_device_get_state (dev) != NM_DEVICE_STATE_ACTIVATED)
-		    || !nm_device_get_ip4_config (dev))
+		if (nm_device_get_state (dev) != NM_DEVICE_STATE_ACTIVATED)
+			continue;
+
+		ip4_config = nm_device_get_ip4_config (dev);
+		if (!ip4_config)
 			continue;
 
 		req = nm_device_get_act_request (dev);
@@ -138,28 +142,14 @@
 		connection = nm_act_request_get_connection (req);
 		g_assert (connection);
 
+		/* Never set the default route through an IPv4LL-addressed device */
 		s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
-		if (s_ip4) {
-			GSList *addr_iter;
-			gboolean have_gateway = FALSE;
-
-			/* Never set the default route through an IPv4LL-addressed device */
-			if (!strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_AUTOIP))
-				continue;
-
-			/* Never set the default route through a device that doesn't have a gateway */
-			for (addr_iter = s_ip4->addresses; addr_iter; addr_iter = g_slist_next (addr_iter)) {
-				NMSettingIP4Address *addr = (NMSettingIP4Address *) addr_iter->data;
-
-				if (addr->gateway) {
-					have_gateway = TRUE;
-					break;
-				}
-			}
+		if (s_ip4 && !strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_AUTOIP))
+			continue;
 
-			if (!have_gateway)
-				continue;
-		}
+		/* FIXME: handle more than one IP address */
+		if (!nm_ip4_config_get_gateway (ip4_config))
+			continue;
 
 		prio = get_device_priority (dev);
 		if (prio > best_prio) {



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