Page MenuHome GnuPG

dirmngr: Watching /etc/resolv.conf does not work on Mac OS X
Closed, InvalidPublic


/etc/resolv.conf is a symlink to /private/var/run/resolv.conf on Mac OS X. Therefore stat("/etc/resolv.conf", &struct) monitors a file that's never modified, and changes to DNS are not discovered on Mac OS X.

I think you need to determine if /etc/resolv.conf is a symlink and then follow it before you try to stat() it.

Alternatively, you could use FSEvents on Mac to be proactively notified about changes to /etc/resolv.conf (see e.g. [1]).




Event Timeline

According to POSIX stat(2) follows a symlink and thus /etc/resolv.conf is the right name to use. (To stat /etc/resolv.conf itself lstat(2) would need to be used. ). I just checked the macOS man page and it says nothing to the contrary.

You're right, stat() works correctly. I created a small tool that implements the same logic. For some reason dirmngr is still not able to find the DNS server after suspend/resume in combination with changed locations. I still get "no route to host" errors.


debug dns
log-file whateveryouwant

to dirmngr.conf may give some more insights.

It looks like this was on my side. I can't reproduce it anymore; in other words dirmngr survives changes to DNS servers now.