openresolv-discuss

Re: Clear cache for dnsmasq when DBus is used

Roy Marples

Fri Aug 30 00:09:15 2019

Hi Daniel

On 29/08/2019 12:44, Daniel Letkiewicz wrote:
Hi guys,

I'm sorry if this is the well-known issue but it seems that resolvconf doesn't clear dnsmasq cache via DBus when the configuration is changed. I use OpenVPN + resolvconf + dnsmasq (with DBus) to manage DNS server / domain via VPN tunnel. Everything works fine for me but I had to modify https://github.com/rsmarples/openresolv/blob/master/dnsmasq.in#L206 to clear dnsmasq cache.
I've just added the following command before line 206.
         dbus-send --system --dest=uk.org.thekelleys.dnsmasq \
                 /uk/org/thekelleys/dnsmasq uk.org.thekelleys.ClearCache

Otherwise, when my VPN tunnel is down all record received from DNS server exposed via the tunnel stay in dnsmasq cache what is incorrect.

Is there any better way to do that ?

I would argue that it's a regression in DNSMasq.
See line 196: # Send even if empty so old servers are cleared
This imples that old servers are cleared, and thus any cache would be as well. Maybe ask upstream if this is a designed change or a regression.

If it's a designed change, then the clear cache needs to happen after setting servers, not before.

Roy

Follow-Ups:
Re: Clear cache for dnsmasq when DBus is usedDaniel Letkiewicz
References:
Clear cache for dnsmasq when DBus is usedDaniel Letkiewicz
Archive administrator: postmaster@marples.name