[PATCH 12/13] connection: Remove unnecessary VPN gateway route

Jukka Rissanen jukka.rissanen at linux.intel.com
Thu Feb 2 04:54:28 PST 2012


The route is created automatically but it is not needed in VPN.
---
 src/connection.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index c4c8643..0dea508 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -41,6 +41,7 @@ struct gateway_config {
 	char *vpn_ip;
 	int vpn_phy_index;
 	char *vpn_phy_ip;
+	char *vpn_phy_gateway;
 };
 
 struct gateway_data {
@@ -160,7 +161,9 @@ static void set_vpn_routes(struct gateway_config *config,
 		config->vpn_phy_index = data->index;
 	}
 
-	DBG("vpn %s phy %s index %d", config->vpn_ip,
+	config->vpn_phy_gateway = g_strdup(gateway);
+
+	DBG("vpn %s gw %s phy %sindex %d", config->vpn_ip, gateway,
 		config->vpn_phy_ip, config->vpn_phy_index);
 }
 
@@ -347,12 +350,15 @@ static void set_default_gateway(struct gateway_data *data,
 					data->ipv4_gateway->vpn == TRUE) {
 		connman_inet_set_gateway_address(data->index,
 						data->ipv4_gateway->vpn_ip);
+		connman_inet_del_network_route(data->index,
+					data->ipv4_gateway->vpn_phy_gateway);
 		data->ipv4_gateway->active = TRUE;
 
-		DBG("set %p index %d vpn %s index %d phy %s",
+		DBG("set %p index %d vpn %s index %d phy %s gw %s",
 			data, data->index, data->ipv4_gateway->vpn_ip,
 			data->ipv4_gateway->vpn_phy_index,
-			data->ipv4_gateway->vpn_phy_ip);
+			data->ipv4_gateway->vpn_phy_ip,
+			data->ipv4_gateway->vpn_phy_gateway);
 
 		__connman_service_indicate_default(data->service);
 
@@ -363,12 +369,15 @@ static void set_default_gateway(struct gateway_data *data,
 					data->ipv6_gateway->vpn == TRUE) {
 		connman_inet_set_ipv6_gateway_address(data->index,
 						data->ipv6_gateway->vpn_ip);
+		connman_inet_del_ipv6_host_route(data->index,
+					data->ipv6_gateway->vpn_phy_gateway);
 		data->ipv6_gateway->active = TRUE;
 
-		DBG("set %p index %d vpn %s index %d phy %s",
+		DBG("set %p index %d vpn %s index %d phy %s gw %s",
 			data, data->index, data->ipv6_gateway->vpn_ip,
 			data->ipv6_gateway->vpn_phy_index,
-			data->ipv6_gateway->vpn_phy_ip);
+			data->ipv6_gateway->vpn_phy_ip,
+			data->ipv6_gateway->vpn_phy_gateway);
 
 		__connman_service_indicate_default(data->service);
 
@@ -514,6 +523,7 @@ static void remove_gateway(gpointer user_data)
 		g_free(data->ipv4_gateway->gateway);
 		g_free(data->ipv4_gateway->vpn_ip);
 		g_free(data->ipv4_gateway->vpn_phy_ip);
+		g_free(data->ipv4_gateway->vpn_phy_gateway);
 		g_free(data->ipv4_gateway);
 	}
 
@@ -521,6 +531,7 @@ static void remove_gateway(gpointer user_data)
 		g_free(data->ipv6_gateway->gateway);
 		g_free(data->ipv6_gateway->vpn_ip);
 		g_free(data->ipv6_gateway->vpn_phy_ip);
+		g_free(data->ipv6_gateway->vpn_phy_gateway);
 		g_free(data->ipv6_gateway);
 	}
 
-- 
1.7.1




More information about the connman mailing list