From eaed590348003ded0bf27e38a827f1b6502ac5e1 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 28 Nov 2009 17:39:19 +0100 Subject: [PATCH] Follow changes to the default service and use its DNS servers --- plugins/dnsproxy.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/plugins/dnsproxy.c b/plugins/dnsproxy.c index 77fcdeb..b2553d6 100644 --- a/plugins/dnsproxy.c +++ b/plugins/dnsproxy.c @@ -337,6 +337,32 @@ static struct connman_resolver dnsproxy_resolver = { .remove = dnsproxy_remove, }; +static void dnsproxy_default_changed(struct connman_service *service) +{ + GSList *list; + char *interface; + + DBG("service %p", service); + + if (service == NULL) + return; + + interface = connman_service_get_interface(service); + if (interface == NULL) + return; + + for (list = server_list; list; list = list->next) { + struct server_data *data = list->data; + + if (g_strcmp0(data->interface, interface) == 0) + data->enabled = TRUE; + else + data->enabled = FALSE; + } + + g_free(interface); +} + static void dnsproxy_offline_mode(connman_bool_t enabled) { GSList *list; @@ -352,6 +378,7 @@ static void dnsproxy_offline_mode(connman_bool_t enabled) static struct connman_notifier dnsproxy_notifier = { .name = "dnsproxy", + .default_changed = dnsproxy_default_changed, .offline_mode = dnsproxy_offline_mode, }; -- 2.7.4