summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-04-27 13:55:46 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-05-02 10:29:01 +0300
commit8b3a3c9bf51d3dd8a2605f1995da341b7caee185 (patch)
tree92b57315e6e7bfe9dc51e43749d071268a30a317
parent5b3c1583f2bad00bea37b0a261070dc1eb8e636a (diff)
downloadconnman-8b3a3c9bf51d3dd8a2605f1995da341b7caee185.tar.gz
connman-8b3a3c9bf51d3dd8a2605f1995da341b7caee185.tar.bz2
connman-8b3a3c9bf51d3dd8a2605f1995da341b7caee185.zip
connection: Set host route to VPN server
This is needed so that we can access hosts behind the VPN. The route might already be setup if VPN server is the same as nameserver or similar.
-rw-r--r--src/connection.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/connection.c b/src/connection.c
index bd64c955..f4abd574 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -832,15 +832,31 @@ int __connman_connection_gateway_add(struct connman_service *service,
}
if (service_type == CONNMAN_SERVICE_TYPE_VPN) {
- if (type == CONNMAN_IPCONFIG_TYPE_IPV4 &&
- new_gateway->ipv4_gateway != NULL)
- set_vpn_routes(new_gateway->ipv4_gateway,
- service, gateway, type, peer);
- else if (type == CONNMAN_IPCONFIG_TYPE_IPV6 &&
- new_gateway->ipv6_gateway != NULL)
- set_vpn_routes(new_gateway->ipv6_gateway,
- service, gateway, type, peer);
+ if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
+ if (new_gateway->ipv4_gateway != NULL)
+ set_vpn_routes(new_gateway->ipv4_gateway,
+ service, gateway, type, peer);
+
+ /*
+ * Special route to VPN server via gateway. This
+ * is needed so that we can access hosts behind
+ * the VPN. The route might already exist depending
+ * on network topology.
+ */
+ connman_inet_add_host_route(active_gateway->index,
+ gateway,
+ active_gateway->ipv4_gateway->gateway);
+
+ } else if (type == CONNMAN_IPCONFIG_TYPE_IPV6) {
+ if (new_gateway->ipv6_gateway != NULL)
+ set_vpn_routes(new_gateway->ipv6_gateway,
+ service, gateway, type, peer);
+
+ connman_inet_add_ipv6_host_route(active_gateway->index,
+ gateway,
+ active_gateway->ipv6_gateway->gateway);
+ }
} else {
if (type == CONNMAN_IPCONFIG_TYPE_IPV4 &&