NetworkManager r3900 - in trunk/vpn-daemons/vpnc: . properties src



Author: dcbw
Date: Wed Aug  6 22:27:16 2008
New Revision: 3900
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3900&view=rev

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

	* src/nm-vpnc-service-vpnc-helper.c
		- (get_routes): fixup for NM route metric changes

	* properties/nm-vpnc.c
		- (get_routes, export): fixup for NM route metric changes



Modified:
   trunk/vpn-daemons/vpnc/ChangeLog
   trunk/vpn-daemons/vpnc/properties/nm-vpnc.c
   trunk/vpn-daemons/vpnc/src/nm-vpnc-service-vpnc-helper.c

Modified: trunk/vpn-daemons/vpnc/properties/nm-vpnc.c
==============================================================================
--- trunk/vpn-daemons/vpnc/properties/nm-vpnc.c	(original)
+++ trunk/vpn-daemons/vpnc/properties/nm-vpnc.c	Wed Aug  6 22:27:16 2008
@@ -547,39 +547,38 @@
 	substrs = g_strsplit (routelist, " ", 0);
 	for (i = 0; substrs[i] != NULL; i++) {
 		struct in_addr tmp;
-		char *p, *route;
+		char *p, *str_route;
 		long int prefix = 32;
 
-		route = g_strdup (substrs[i]);
-		p = strchr (route, '/');
+		str_route = g_strdup (substrs[i]);
+		p = strchr (str_route, '/');
 		if (!p || !(*(p + 1))) {
-			g_warning ("Ignoring invalid route '%s'", route);
+			g_warning ("Ignoring invalid route '%s'", str_route);
 			goto next;
 		}
 
 		errno = 0;
 		prefix = strtol (p + 1, NULL, 10);
 		if (errno || prefix <= 0 || prefix > 32) {
-			g_warning ("Ignoring invalid route '%s'", route);
+			g_warning ("Ignoring invalid route '%s'", str_route);
 			goto next;
 		}
 
 		/* don't pass the prefix to inet_pton() */
 		*p = '\0';
-		if (inet_pton (AF_INET, route, &tmp) > 0) {
-			NMSettingIP4Address *addr;
+		if (inet_pton (AF_INET, str_route, &tmp) > 0) {
+			NMSettingIP4Route *route;
 
-			addr = g_new0 (NMSettingIP4Address, 1);
-			addr->address = tmp.s_addr;
-			addr->prefix = (guint32) prefix;
-			addr->gateway = 0;
+			route = g_new0 (NMSettingIP4Route, 1);
+			route->address = tmp.s_addr;
+			route->prefix = (guint32) prefix;
 
-			routes = g_slist_append (routes, addr);
+			routes = g_slist_append (routes, route);
 		} else
-			g_warning ("Ignoring invalid route '%s'", route);
+			g_warning ("Ignoring invalid route '%s'", str_route);
 
 next:
-		g_free (route);
+		g_free (str_route);
 	}
 
 	g_strfreev (substrs);
@@ -788,16 +787,16 @@
 		GSList *iter;
 
 		for (iter = s_ip4->routes; iter; iter = g_slist_next (iter)) {
-			NMSettingIP4Address *addr = (NMSettingIP4Address *) iter->data;
+			NMSettingIP4Route *route = (NMSettingIP4Route *) iter->data;
 			char str_addr[INET_ADDRSTRLEN + 1];
 			struct in_addr num_addr;
 
 			if (routes->len)
 				g_string_append_c (routes, ' ');
 
-			num_addr.s_addr = addr->address;
+			num_addr.s_addr = route->address;
 			if (inet_ntop (AF_INET, &num_addr, &str_addr[0], INET_ADDRSTRLEN + 1))
-				g_string_append_printf (routes, "%s/%d", str_addr, addr->prefix);
+				g_string_append_printf (routes, "%s/%d", str_addr, route->prefix);
 		}
 	}
 

Modified: trunk/vpn-daemons/vpnc/src/nm-vpnc-service-vpnc-helper.c
==============================================================================
--- trunk/vpn-daemons/vpnc/src/nm-vpnc-service-vpnc-helper.c	(original)
+++ trunk/vpn-daemons/vpnc/src/nm-vpnc-service-vpnc-helper.c	Wed Aug  6 22:27:16 2008
@@ -211,8 +211,8 @@
 		GArray *array;
 		char buf[BUFLEN];
 		struct in_addr network;
-		guint32 gateway = 0; /* no gateway */
-		guint32 prefix;
+		guint32 next_hop = 0; /* no next hop */
+		guint32 prefix, metric = 0;
 
 		snprintf (buf, BUFLEN, "CISCO_SPLIT_INC_%d_ADDR", i);
 		tmp = getenv (buf);
@@ -245,10 +245,11 @@
 			prefix = nm_utils_ip4_netmask_to_prefix (netmask.s_addr);
 		}
 
-		array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3);
+		array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 4);
 		g_array_append_val (array, network.s_addr);
 		g_array_append_val (array, prefix);
-		g_array_append_val (array, gateway);
+		g_array_append_val (array, next_hop);
+		g_array_append_val (array, metric);
 		g_ptr_array_add (routes, array);
 	}
 



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