VPN services dont have network, so we need to make sure not
to use service->network while in vpn services.
---
 src/service.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/service.c b/src/service.c
index 1cb292f..4ad46ec 100644
--- a/src/service.c
+++ b/src/service.c
@@ -407,7 +407,10 @@ void __connman_service_nameserver_add_routes(struct 
connman_service *service,
        if (service == NULL)
                return;
 
-       index = connman_network_get_index(service->network);
+       if (service->type == CONNMAN_SERVICE_TYPE_VPN)
+               index = connman_ipconfig_get_index(service->ipconfig);
+       else
+               index = connman_network_get_index(service->network);
 
        if (service->nameservers != NULL) {
                int i;
@@ -442,7 +445,10 @@ void __connman_service_nameserver_del_routes(struct 
connman_service *service)
        if (service == NULL)
                return;
 
-       index = connman_network_get_index(service->network);
+       if (service->type == CONNMAN_SERVICE_TYPE_VPN)
+               index = connman_ipconfig_get_index(service->ipconfig);
+       else
+               index = connman_network_get_index(service->network);
 
        if (service->nameservers != NULL) {
                int i;
@@ -1893,7 +1899,11 @@ static DBusMessage *set_property(DBusConnection *conn,
                if (str == NULL)
                        return __connman_error_invalid_arguments(msg);
 
-               index = connman_network_get_index(service->network);
+               if (service->type == CONNMAN_SERVICE_TYPE_VPN)
+                       index = connman_ipconfig_get_index(service->ipconfig);
+               else
+                       index = connman_network_get_index(service->network);
+
                gw = __connman_ipconfig_get_gateway(index);
 
                if (gw && strlen(gw))
-- 
1.7.2.3

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to