NetworkManager r3586 - in trunk: . src



Author: dcbw
Date: Tue Apr 22 14:28:52 2008
New Revision: 3586
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3586&view=rev

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

	Patch from Charles R. Anderson (cra wpi edu)

	* src/NetworkManagerPolicy.c
		- (update_routing_and_dns): don't select devices without a gateway
			as having the default route (rh #437338)



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

Modified: trunk/src/NetworkManagerPolicy.c
==============================================================================
--- trunk/src/NetworkManagerPolicy.c	(original)
+++ trunk/src/NetworkManagerPolicy.c	Tue Apr 22 14:28:52 2008
@@ -138,10 +138,28 @@
 		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 && !strcmp (s_ip4->method, NM_SETTING_IP4_CONFIG_METHOD_AUTOIP))
-			continue;
+		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 (!have_gateway)
+				continue;
+		}
 
 		prio = get_device_priority (dev);
 		if (prio > best_prio) {



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