NetworkManager r3813 - in trunk/vpn-daemons/openvpn: . src



Author: dcbw
Date: Mon Jul  7 18:58:42 2008
New Revision: 3813
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3813&view=rev

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

	* src/nm-openvpn-service-openvpn-helper.c
		- Use IPv4 address prefixes rather than netmasks (requires svn3812)



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

Modified: trunk/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c
==============================================================================
--- trunk/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c	(original)
+++ trunk/vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c	Mon Jul  7 18:58:42 2008
@@ -197,6 +197,7 @@
 		struct in_addr network;
 		struct in_addr netmask;
 		struct in_addr gateway = { 0, };
+		guint32 prefix;
 
 		snprintf (buf, BUFLEN, "route_network_%d", i);
 		tmp = getenv (buf);
@@ -224,7 +225,8 @@
 
 		array = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3);
 		g_array_append_val (array, network.s_addr);
-		g_array_append_val (array, netmask.s_addr);
+		prefix = nm_utils_ip4_netmask_to_prefix (netmask.s_addr);
+		g_array_append_val (array, prefix);
 		g_array_append_val (array, gateway.s_addr);
 		g_ptr_array_add (routes, array);
 	}
@@ -251,6 +253,7 @@
 	GValue *dns_list = NULL;
 	GValue *nbns_list = NULL;
 	GValue *dns_domain = NULL;
+	struct in_addr temp_addr;
 
 	g_type_init ();
 
@@ -289,9 +292,16 @@
 		g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_PTP, val);
 
 	/* Netmask */
-	val = addr_to_gvalue (getenv ("route_netmask_1"));
-	if (val)
-		g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_NETMASK, val);
+	tmp = getenv ("route_netmask_1");
+	if (tmp && inet_pton (AF_INET, tmp, &temp_addr) > 0) {
+		GValue *val;
+
+		val = g_slice_new0 (GValue);
+		g_value_init (val, G_TYPE_UINT);
+		g_value_set_uint (val, nm_utils_ip4_netmask_to_prefix (temp_addr.s_addr));
+
+		g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX, val);
+	}
 
 	val = get_routes ();
 	if (val)



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