From c966fd54bfe3d421299d3aec7d5f3d2329230012 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 29 Nov 2016 15:03:39 +0100 Subject: [PATCH 1/2] dns: tell dnsmasq to clear cache on servers reload A new DNS may have different data for us. So tell dnsmasq to automatically clear the cache when servers change. Signed-off-by: Christian Hesse --- src/dns/nm-dns-dnsmasq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dns/nm-dns-dnsmasq.c b/src/dns/nm-dns-dnsmasq.c index 9ef7972fe..2db168059 100644 --- a/src/dns/nm-dns-dnsmasq.c +++ b/src/dns/nm-dns-dnsmasq.c @@ -537,6 +537,7 @@ start_dnsmasq (NMDnsDnsmasq *self) argv[idx++] = "--pid-file=" PIDFILE; argv[idx++] = "--listen-address=127.0.0.1"; /* Should work for both 4 and 6 */ argv[idx++] = "--cache-size=400"; + argv[idx++] = "--clear-on-reload"; /* clear cache when dns server changes */ argv[idx++] = "--conf-file=/dev/null"; /* avoid loading /etc/dnsmasq.conf */ argv[idx++] = "--proxy-dnssec"; /* Allow DNSSEC to pass through */ argv[idx++] = "--enable-dbus=" DNSMASQ_DBUS_SERVICE; From 6546b70c98a3fba1b6430496b41b2868476323af Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 29 Nov 2016 22:54:19 +0100 Subject: [PATCH 2/2] Revert "dns: clear dnsmasq cache after an update" We now pass the --clear-on-reload option to dnsmasq, so the manual clear is no longer needed. This reverts commit 4feb58b50b9fd6caceda83bab907ad107ad8ed01. --- src/dns/nm-dns-dnsmasq.c | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/dns/nm-dns-dnsmasq.c b/src/dns/nm-dns-dnsmasq.c index 2db168059..5223638e6 100644 --- a/src/dns/nm-dns-dnsmasq.c +++ b/src/dns/nm-dns-dnsmasq.c @@ -367,25 +367,6 @@ add_ip_config_data (NMDnsDnsmasq *self, GVariantBuilder *servers, const NMDnsIPC g_return_val_if_reached (FALSE); } -static void -dnsmasq_clear_cache_done (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) -{ - NMDnsDnsmasq *self; - gs_free_error GError *error = NULL; - gs_unref_variant GVariant *response = NULL; - - response = g_dbus_proxy_call_finish (proxy, res, &error); - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = NM_DNS_DNSMASQ (user_data); - - if (!response) - _LOGW ("dnsmasq cache clear failed: %s", error->message); - else - _LOGD ("dnsmasq update successful, cache cleared"); -} - static void dnsmasq_update_done (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { @@ -403,16 +384,8 @@ dnsmasq_update_done (GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) if (!response) _LOGW ("dnsmasq update failed: %s", error->message); - else { - g_dbus_proxy_call (priv->dnsmasq, - "ClearCache", - NULL, - G_DBUS_CALL_FLAGS_NONE, - -1, - priv->update_cancellable, - (GAsyncReadyCallback) dnsmasq_clear_cache_done, - self); - } + else + _LOGD ("dnsmasq update successful"); } static void