summaryrefslogtreecommitdiff
path: root/src/connection.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-05-07 17:31:03 +0200
committerMarcel Holtmann <marcel@holtmann.org>2012-05-08 07:47:18 -0700
commitad0a13c86d3ff5538236746c0c527c93d1d285e2 (patch)
tree9bcee6da590f06e5e853c344cf5e5e1160cb8410 /src/connection.c
parentd22ad18e9c5541ab3ed2ae2b7392af1da214977d (diff)
downloadconnman-ad0a13c86d3ff5538236746c0c527c93d1d285e2.tar.gz
connman-ad0a13c86d3ff5538236746c0c527c93d1d285e2.tar.bz2
connman-ad0a13c86d3ff5538236746c0c527c93d1d285e2.zip
connection: Fix host route to VPN server
The kernel will ignore host routes which are bogus. In case of a PtP connection such as PPP for cellular the gateway address should not be used.
Diffstat (limited to 'src/connection.c')
-rw-r--r--src/connection.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/connection.c b/src/connection.c
index f4abd574..712a4bec 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -832,6 +832,7 @@ int __connman_connection_gateway_add(struct connman_service *service,
}
if (service_type == CONNMAN_SERVICE_TYPE_VPN) {
+ char *dest;
if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
if (new_gateway->ipv4_gateway != NULL)
@@ -844,18 +845,28 @@ int __connman_connection_gateway_add(struct connman_service *service,
* the VPN. The route might already exist depending
* on network topology.
*/
+ if (g_strcmp0(active_gateway->ipv4_gateway->gateway, "0.0.0.0") != 0)
+ dest = active_gateway->ipv4_gateway->gateway;
+ else
+ dest = NULL;
+
connman_inet_add_host_route(active_gateway->index,
gateway,
- active_gateway->ipv4_gateway->gateway);
+ dest);
} else if (type == CONNMAN_IPCONFIG_TYPE_IPV6) {
if (new_gateway->ipv6_gateway != NULL)
set_vpn_routes(new_gateway->ipv6_gateway,
service, gateway, type, peer);
+ if (g_strcmp0(active_gateway->ipv6_gateway->gateway, "::") != 0)
+ dest = active_gateway->ipv6_gateway->gateway;
+ else
+ dest = NULL;
+
connman_inet_add_ipv6_host_route(active_gateway->index,
gateway,
- active_gateway->ipv6_gateway->gateway);
+ dest);
}
} else {