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



Author: dcbw
Date: Fri Aug 22 17:24:55 2008
New Revision: 4001
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4001&view=rev

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

	* src/nm-openvpn-service-openvpn-helper.c
		- (main): grab tunnel MTU and push that through to NM



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	Fri Aug 22 17:24:55 2008
@@ -127,6 +127,21 @@
 }
 
 static GValue *
+uint_to_gvalue (guint32 num)
+{
+	GValue *val;
+
+	if (num == 0)
+		return NULL;
+
+	val = g_slice_new0 (GValue);
+	g_value_init (val, G_TYPE_UINT);
+	g_value_set_uint (val, num);
+
+	return val;
+}
+
+static GValue *
 addr_to_gvalue (const char *str)
 {
 	struct in_addr	temp_addr;
@@ -356,6 +371,21 @@
 	if (dns_domain)
 		g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_DOMAIN, dns_domain);
 
+	/* Tunnel MTU */
+	tmp = getenv ("tun_mtu");
+	if (tmp && strlen (tmp)) {
+		long int mtu;
+
+		errno = 0;
+		mtu = strtol (tmp, NULL, 10);
+		if (errno || mtu < 0 || mtu > 20000) {
+			nm_warning ("Ignoring invalid tunnel MTU '%s'", tmp);
+		} else {
+			val = uint_to_gvalue ((guint32) mtu);
+			g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_MTU, val);
+		}
+	}
+
 	/* Send the config info to nm-openvpn-service */
 	send_ip4_config (connection, config);
 



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