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



commit be42aae7a7cd0c48ef0fa39d69df3e92e8cc73df
Author: David Woodhouse <dwmw2 infradead org>
Date:   Fri Aug 13 00:00:30 2010 -0500

    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)"

 src/nm-openconnect-service-openconnect-helper.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/nm-openconnect-service-openconnect-helper.c b/src/nm-openconnect-service-openconnect-helper.c
index 2df4e76..c195d46 100644
--- a/src/nm-openconnect-service-openconnect-helper.c
+++ b/src/nm-openconnect-service-openconnect-helper.c
@@ -15,10 +15,10 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- *   Copyright © 2008 - 2009 Intel Corporation.
+ *   Copyright © 2008 - 2010 Intel Corporation.
  *
  * Based on nm-openconnect-vpnc.c:
- *   Copyright © 2005 - 2008 Red Hat, Inc.
+ *   Copyright © 2005 - 2010 Red Hat, Inc.
  *   Copyright © 2007 - 2008 Novell, Inc.
  */
 
@@ -136,6 +136,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;
@@ -362,9 +373,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]