If VPN is not the default service i.e., default route is not via
VPN service then we need to add the VPN specified DNS server to
the proxy because some of the DNS queries might be to the VPN domain.

Reported-by: Yevhen Kyriukha <[email protected]>
---
 src/connman.h  |  1 +
 src/dnsproxy.c |  4 +++-
 src/service.c  | 14 ++++++++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/connman.h b/src/connman.h
index f5ed995..a02c84d 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -738,6 +738,7 @@ void __connman_service_set_pac(struct connman_service 
*service,
                                        const char *pac);
 bool __connman_service_is_hidden(struct connman_service *service);
 bool __connman_service_is_split_routing(struct connman_service *service);
+bool __connman_service_index_is_split_routing(int index);
 int __connman_service_get_index(struct connman_service *service);
 void __connman_service_set_hidden(struct connman_service *service);
 void __connman_service_set_hostname(struct connman_service *service,
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index a5d6841..6f73d32 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -2289,7 +2289,9 @@ static struct server_data *create_server(int index,
        }
 
        if (protocol == IPPROTO_UDP) {
-               if (__connman_service_index_is_default(data->index)) {
+               if (__connman_service_index_is_default(data->index) ||
+                               __connman_service_index_is_split_routing(
+                                                               data->index)) {
                        data->enabled = true;
                        DBG("Adding DNS server %s", data->server);
                }
diff --git a/src/service.c b/src/service.c
index 9229ba8..273883f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2393,6 +2393,20 @@ __connman_service_is_split_routing(struct 
connman_service *service)
        return service->do_split_routing;
 }
 
+bool __connman_service_index_is_split_routing(int index)
+{
+       struct connman_service *service;
+
+       if (index < 0)
+               return false;
+
+       service = __connman_service_lookup_from_index(index);
+       if (!service)
+               return false;
+
+       return __connman_service_is_split_routing(service);
+}
+
 int __connman_service_get_index(struct connman_service *service)
 {
        if (!service)
-- 
1.8.3.1

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to