[network-manager-vpnc/NM_0_8] core: don't claim default route when explicit routes are passed (bgo #621698)



commit 780ebe1279c740ad57da1620a22efb2660a45810
Author: David Woodhouse <David Woodhouse intel com>
Date:   Sat May 14 00:11:55 2011 +0100

    core: don't claim default route when explicit routes are passed (bgo #621698)
    
    Requires the following NM commit:
    "vpn: let plugins forbid VPN connections from getting the default route (bgo #621698)"
    (cherry picked from commit 8d382a5f68cec8b7c606e5dce3fe1168c501404b)

 src/nm-vpnc-service-vpnc-helper.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/nm-vpnc-service-vpnc-helper.c b/src/nm-vpnc-service-vpnc-helper.c
index 1b67811..0f4f359 100644
--- a/src/nm-vpnc-service-vpnc-helper.c
+++ b/src/nm-vpnc-service-vpnc-helper.c
@@ -134,6 +134,17 @@ uint_to_gvalue (guint32 num)
 }
 
 static GValue *
+bool_to_gvalue (gboolean b)
+{
+	GValue *val;
+
+	val = g_slice_new0 (GValue);
+	g_value_init (val, G_TYPE_BOOLEAN);
+	g_value_set_boolean (val, b);
+	return val;
+}
+
+static GValue *
 addr_to_gvalue (const char *str)
 {
 	struct in_addr	temp_addr;
@@ -361,9 +372,12 @@ main (int argc, char *argv[])
 
 	/* Routes */
 	val = get_routes ();
-	if (val)
+	if (val) {
 		g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_ROUTES, val);
-
+		/* If routes-to-include were provided, that means no default route */
+		g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_NEVER_DEFAULT,
+		                     bool_to_gvalue (TRUE));
+	}
 	/* Banner */
 	val = str_to_gvalue (getenv ("CISCO_BANNER"), TRUE);
 	if (val)



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