[PATCH] For NetworkManager to send the routes to VPN Daemons



Hi,

In case of Standard Gateways, IPSec VPNs push routes through setkey
mechanisms. NetworkManager does not pass routes to vpn daemons.

Attached patch makes NetworkManager to send routes to vpn daemons.

Appreciate any comments on this.

Thanks and Regards,
Vinay

 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/NetworkManager/ChangeLog,v
retrieving revision 1.815
diff -u -r1.815 ChangeLog
--- ChangeLog	7 Feb 2006 15:39:50 -0000	1.815
+++ ChangeLog	9 Feb 2006 10:51:10 -0000
@@ -1,3 +1,23 @@
+2006-02-09 Vinay A R <rvinay novell com>
+
+	* src/vpn-manager/nm-vpn-act-request.h 
+	* src/vpn-manager/nm-vpn-act-request.c : Added 'routes' and 'routes_count' to struct NMVPNActRequest 
+						 since IPSec VPNs require them for std gateway.
+		      (nm_vpn_act_request_new) : takes additional 2 arguments - 'routes' and 'routes_count'
+					       : New Function - 'nm_vpn_act_request_get_routes' , 
+						 gets routes from NMVPNActRequest object, returns char ** routes.
+
+	* src/vpn-manager/nm-vpn-manager.h :
+	* src/vpn-manager/nm-vpn-manager.c : 'nm_vpn_manager_activate_vpn_connection' takes additional 
+					     2 arguments - 'routes' and 'routes_count' since 'nm_vpn_act_request_new' requires them.
+	
+	* src/vpn-manager/nm-dbus-vpn.c : 
+		(nm_dbus_vpn_activate_connection) : gets 'routes' from 'nm_dbus_vpn_get_routes' 
+						    to pass to 'nm_vpn_manager_activate_vpn_connection'
+	
+	* src/vpn-manager/nm-vpn-service.c : gets routes from 'nm_vpn_act_request_get_routes' and
+					     and passes to vpn.
+	
 2006-02-07  Robert Love  <rml novell com>
 
 	Patch by Stefan Seyfried <seife suse de>:
Index: src/vpn-manager/nm-dbus-vpn.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/vpn-manager/nm-dbus-vpn.c,v
retrieving revision 1.14
diff -u -r1.14 nm-dbus-vpn.c
--- src/vpn-manager/nm-dbus-vpn.c	31 Dec 2005 08:21:24 -0000	1.14
+++ src/vpn-manager/nm-dbus-vpn.c	9 Feb 2006 10:51:10 -0000
@@ -701,14 +701,17 @@
 		{
 			int	item_count = -1;
 			char **items;
-
+			int routes_count = -1;
+			char **routes;
+			routes = nm_dbus_vpn_get_routes (connection, vpn, &routes_count);
 			if ((items = nm_dbus_vpn_get_vpn_data (connection, vpn, &item_count)))
 			{
 				char *	joined_string = g_strjoinv (" / ", items);
-
-				nm_info ("Will activate VPN connection '%s', service '%s', user_name '%s', vpn_data '%s'.",
-					name, nm_vpn_connection_get_service_name (vpn), nm_vpn_connection_get_user_name (vpn), joined_string);
-				nm_vpn_manager_activate_vpn_connection (data->data->vpn_manager, vpn, passwords, num_passwords, items, item_count);
+				char *  routes_string = g_strjoinv (" / ", routes);
+				nm_info ("Will activate VPN connection '%s', service '%s', user_name '%s', vpn_data '%s', route '%s'.",
+				name, nm_vpn_connection_get_service_name (vpn), nm_vpn_connection_get_user_name (vpn), joined_string, routes_string);
+				nm_vpn_manager_activate_vpn_connection (data->data->vpn_manager, vpn, passwords, num_passwords, items, item_count, 
+									routes, routes_count);
 
 				g_free (joined_string);
 				g_strfreev (items);
Index: src/vpn-manager/nm-vpn-act-request.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/vpn-manager/nm-vpn-act-request.c,v
retrieving revision 1.3
diff -u -r1.3 nm-vpn-act-request.c
--- src/vpn-manager/nm-vpn-act-request.c	31 Dec 2005 08:21:24 -0000	1.3
+++ src/vpn-manager/nm-vpn-act-request.c	9 Feb 2006 10:51:10 -0000
@@ -40,6 +40,8 @@
 	int				password_count;
 	char **			data_items;
 	int				data_count;
+	char **			routes;
+	int 			routes_count;
 
 	guint			daemon_wait_count;
 	guint			callback_id;
@@ -48,7 +50,8 @@
 
 
 NMVPNActRequest *nm_vpn_act_request_new (NMVPNManager *manager, NMVPNService *service, NMVPNConnection *vpn,
-								NMDevice *parent_dev, char **password_items, int password_count, char **data_items, int data_count)
+					NMDevice *parent_dev, char **password_items, int password_count, char **data_items, int data_count,
+					char **routes, int routes_count)
 {
 	NMVPNActRequest	*req;
 
@@ -75,6 +78,8 @@
 	req->password_count = password_count;
 	req->data_items = g_strdupv (data_items);
 	req->data_count = data_count;
+	req->routes = g_strdupv (routes);
+	req->routes_count = routes_count;
 
 	return req;
 }
@@ -192,6 +197,12 @@
 
 	*count = req->data_count;
 	return (const char **) (req->data_items);
+}
+
+const char ** nm_vpn_act_request_get_routes (NMVPNActRequest *req, guint *count)
+{
+	*count = req->routes_count;
+	return (const char **) (req->routes);
 }
 
 void nm_vpn_act_request_cancel (NMVPNActRequest *req)
Index: src/vpn-manager/nm-vpn-act-request.h
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/vpn-manager/nm-vpn-act-request.h,v
retrieving revision 1.1
diff -u -r1.1 nm-vpn-act-request.h
--- src/vpn-manager/nm-vpn-act-request.h	7 Sep 2005 19:12:51 -0000	1.1
+++ src/vpn-manager/nm-vpn-act-request.h	9 Feb 2006 10:51:10 -0000
@@ -29,7 +29,8 @@
 
 
 NMVPNActRequest *	nm_vpn_act_request_new			(NMVPNManager *manager, NMVPNService *service, NMVPNConnection *vpn,
-											NMDevice *parent_dev, char **password_items, int password_count, char **data_items, int data_count);
+						NMDevice *parent_dev, char **password_items, int password_count, char **data_items, int data_count,
+						char **routes, int routes_count);
 void				nm_vpn_act_request_ref			(NMVPNActRequest *req);
 void				nm_vpn_act_request_unref			(NMVPNActRequest *req);
 
@@ -43,6 +44,7 @@
 
 const char **		nm_vpn_act_request_get_password_items	(NMVPNActRequest *req, guint *count);
 const char **		nm_vpn_act_request_get_data_items	(NMVPNActRequest *req, guint *count);
+const char **		nm_vpn_act_request_get_routes		(NMVPNActRequest *req, guint *count);
 
 void				nm_vpn_act_request_cancel		(NMVPNActRequest *req);
 gboolean			nm_vpn_act_request_should_cancel	(NMVPNActRequest *req);
Index: src/vpn-manager/nm-vpn-manager.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/vpn-manager/nm-vpn-manager.c,v
retrieving revision 1.16
diff -u -r1.16 nm-vpn-manager.c
--- src/vpn-manager/nm-vpn-manager.c	11 Jan 2006 21:07:28 -0000	1.16
+++ src/vpn-manager/nm-vpn-manager.c	9 Feb 2006 10:51:11 -0000
@@ -335,7 +335,7 @@
  *
  */
 void nm_vpn_manager_activate_vpn_connection (NMVPNManager *manager, NMVPNConnection *vpn,
-				char **password_items, int password_count, char **data_items, int data_count)
+				char **password_items, int password_count, char **data_items, int data_count, char **routes, int routes_count)
 {
 	NMDevice *		parent_dev;
 	NMVPNActRequest *	req;
@@ -360,7 +360,8 @@
 		return;
 	}
 
-	req = nm_vpn_act_request_new (manager, service, vpn, parent_dev, password_items, password_count, data_items, data_count);
+	req = nm_vpn_act_request_new (manager, service, vpn, parent_dev, password_items, password_count, data_items, data_count,
+					 routes, routes_count);
 	manager->act_req = req;
 
 	nm_vpn_service_start_connection (service, req);
Index: src/vpn-manager/nm-vpn-manager.h
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/vpn-manager/nm-vpn-manager.h,v
retrieving revision 1.6
diff -u -r1.6 nm-vpn-manager.h
--- src/vpn-manager/nm-vpn-manager.h	7 Oct 2005 17:19:28 -0000	1.6
+++ src/vpn-manager/nm-vpn-manager.h	9 Feb 2006 10:51:11 -0000
@@ -37,7 +37,8 @@
 GSList *			nm_vpn_manager_vpn_connection_list_copy		(NMVPNManager *manager);
 
 void				nm_vpn_manager_activate_vpn_connection		(NMVPNManager *manager, NMVPNConnection *vpn, char **password_items,
-														int password_count, char **data_items, int data_count);
+										int password_count, char **data_items, int data_count,
+										char **routes, int routes_count );
 void				nm_vpn_manager_deactivate_vpn_connection	(NMVPNManager *manager, NMDevice *dev);
 
 NMVPNConnection *	nm_vpn_manager_find_connection_by_name		(NMVPNManager *manager, const char *con_name);
Index: src/vpn-manager/nm-vpn-service.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/vpn-manager/nm-vpn-service.c,v
retrieving revision 1.9
diff -u -r1.9 nm-vpn-service.c
--- src/vpn-manager/nm-vpn-service.c	16 Jan 2006 22:58:12 -0000	1.9
+++ src/vpn-manager/nm-vpn-service.c	9 Feb 2006 10:51:11 -0000
@@ -484,6 +484,8 @@
 	dbus_uint32_t		password_count;
 	char **			data_items;
 	dbus_uint32_t		data_count;
+	char **			routes;
+	dbus_uint32_t		routes_count;
 	DBusMessage *		message;
 	DBusPendingCall *	pcall = NULL;
 
@@ -512,10 +514,12 @@
 	user_name = nm_vpn_connection_get_user_name (vpn);
 	password_items = (char **) nm_vpn_act_request_get_password_items (req, &password_count);
 	data_items = (char **) nm_vpn_act_request_get_data_items (req, &data_count);
+	routes = (char **) nm_vpn_act_request_get_routes(req, &routes_count);
 	dbus_message_append_args (message, DBUS_TYPE_STRING, &name,
 				  DBUS_TYPE_STRING, &user_name,
 				  DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &password_items, password_count,
 				  DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &data_items, data_count,
+				  DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &routes, routes_count,
 				  DBUS_TYPE_INVALID);
 
 	dbus_connection_send_with_reply (service->app_data->dbus_connection, message, &pcall, -1);


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