From: Andreas Hartmetz <[email protected]>

- Make sure to insert them with the enabled flag set. No need to
  touch the flag afterwards. When they are not supposed to be used,
  they are removed entirely anyway.
- Insert the fallbacks also when taking some service offline.
  As I understand it, the fallbacks are for all cases where there is
  no other nameserver, including with everything ConnMan knows about
  disconnected. It may or may not have originally been meant that way,
  in any case it's what we need in our current project.
---
Hi,

sending this to ml on behalf of Andreas so that the patch is not lost.

Cheers,
Jukka

 src/dnsproxy.c | 5 +++++
 src/service.c  | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 741cd45..ba1bd1e 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -2603,6 +2603,7 @@ static struct server_data *create_server(int index,
 
        if (protocol == IPPROTO_UDP) {
                if (__connman_service_index_is_default(data->index) ||
+                               data->index < 0 ||
                                __connman_service_index_is_split_routing(
                                                                data->index)) {
                        data->enabled = true;
@@ -2788,6 +2789,10 @@ static void dnsproxy_offline_mode(bool enabled)
        for (list = server_list; list; list = list->next) {
                struct server_data *data = list->data;
 
+               /* fallback nameservers (index < 0) are always enabled if 
present */
+               if (data->index < 0)
+                       continue;
+
                if (!enabled) {
                        DBG("Enabling DNS server %s", data->server);
                        data->enabled = true;
diff --git a/src/service.c b/src/service.c
index e284e92..1e2218b 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1048,6 +1048,7 @@ static void update_nameservers(struct connman_service 
*service)
        case CONNMAN_SERVICE_STATE_FAILURE:
        case CONNMAN_SERVICE_STATE_DISCONNECT:
                connman_resolver_remove_all(index);
+               connman_resolver_flush();
                return;
        case CONNMAN_SERVICE_STATE_READY:
        case CONNMAN_SERVICE_STATE_ONLINE:
-- 
1.8.3.1

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

Reply via email to