connection: Remove original default route only when needed
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Thu, 5 Apr 2012 09:00:53 +0000 (12:00 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 5 Apr 2012 11:18:46 +0000 (14:18 +0300)
If the new VPN gateway has split routing set, then do not
clear original default route because VPN will not set the
default route. Without this check we would not get any
proper default route set.

src/connection.c

index a679619..11e42c9 100644 (file)
@@ -820,14 +820,20 @@ int __connman_connection_gateway_add(struct connman_service *service,
        if (type == CONNMAN_IPCONFIG_TYPE_IPV4 &&
                                new_gateway->ipv4_gateway != NULL &&
                                new_gateway->ipv4_gateway->vpn == TRUE) {
-               connman_inet_clear_gateway_address(active_gateway->index,
+               if (__connman_service_is_split_routing(new_gateway->service) ==
+                                                                       FALSE)
+                       connman_inet_clear_gateway_address(
+                                       active_gateway->index,
                                        active_gateway->ipv4_gateway->gateway);
        }
 
        if (type == CONNMAN_IPCONFIG_TYPE_IPV6 &&
                                new_gateway->ipv6_gateway != NULL &&
                                new_gateway->ipv6_gateway->vpn == TRUE) {
-               connman_inet_clear_ipv6_gateway_address(active_gateway->index,
+               if (__connman_service_is_split_routing(new_gateway->service) ==
+                                                                       FALSE)
+                       connman_inet_clear_ipv6_gateway_address(
+                                       active_gateway->index,
                                        active_gateway->ipv6_gateway->gateway);
        }