[Dnsmasq-discuss] /etc/resolv.conf polling limitation
Simon Kelley
simon at thekelleys.org.uk
Tue Mar 22 09:00:32 UTC 2022
On 22/03/2022 01:42, Preston Crow wrote:
> I just ran into an interesting issue:
>
> In my config, I set: resolv-file=/etc/resolv.conf.upstream
>
> If I edit that file, I instantly see dnsmasq reload things as expected
> with various log messages. That's good.
>
> However, in my case, /etc/resolv.conf.upstream is a symlink. If I
> change the symlink to point to a different file, dnsmasq doesn't
> notice. I suspect it's using inotify to have the kernel tell it if the
> file is changed, and it isn't checking for a symlink that also needs to
> be watched.
Looking at the code, dnsmasq actually sets an inotify on the _directory_
containing the file. It is aware of symlinks, so if
/etc/resolv.conf.upstream is a symlink to /conf/resolv.conf then it will
watch the contents of /conf
However, all this is set up at startup time, so if you
1) start dnsmasq
2) change the link to /conf2/resolv.conf
then the inotify on /conf2 will not be in place until the next time
dnsmasq starts.
If you'd moved the link to another file in /conf, it would have worked.
Similar, but subtly different.
Simon.
> >
> I'm not sure if this qualifies as a bug. If this is to be defined as
> the expected behavior, then I would suggest adding a note to the
> documentation on the polling pointing out that changes to symlinks won't
> be noticed.
>
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
More information about the Dnsmasq-discuss
mailing list