Skip to content

Windows: Reload config on manual DNS changes#785

Merged
bradh352 merged 4 commits intoc-ares:mainfrom
bradh352:windnsnotify
Jun 14, 2024
Merged

Windows: Reload config on manual DNS changes#785
bradh352 merged 4 commits intoc-ares:mainfrom
bradh352:windnsnotify

Conversation

@bradh352
Copy link
Copy Markdown
Member

@bradh352 bradh352 commented Jun 14, 2024

The NotifyIpInterfaceChange() method only notifies of automatic changes, such as via DHCP or interfaces going up or down. However, someone editing the DNS settings manually would not trigger a notification.

Use RegNotifyChangeKeyValue() to monitor HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\Interfaces and HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces to pick up these changes.

This new check also works when using the OpenWatcom compiler as the symbols are available, so they have been enabled (though NotifyIpInterfaceChange() method is disabled for OpenWatcom still due to the linker libraries missing this symbol).

NOTE: it does appear that about 5 events get triggered for some reason, it doesn't seem to hurt anything, but it will actually cause it to re-read the configuration multiple times.

Fixes Issue: #761
Fix By: Brad House (@bradh352)

@bradh352 bradh352 merged commit 266599a into c-ares:main Jun 14, 2024
@bradh352 bradh352 deleted the windnsnotify branch June 14, 2024 23:29
@dg0yt
Copy link
Copy Markdown
Contributor

dg0yt commented Aug 1, 2024

These changes seem to have broken UWP builds. Is this intentional?
Observed in vcpkg (microsoft/vcpkg#40213) and triggering downstream changes there. (I think I also saw existin packages avoiding c-ares for UWP.)

@bradh352
Copy link
Copy Markdown
Member Author

bradh352 commented Aug 1, 2024

definitely not intentional. We had added an AppVeyor CI build for that, but then there was some later breakage due to an MSVC bug ( https://developercommunity.visualstudio.com/t/clexe-compiler-error-C1007-when-compili/10486219 ) so we had to disable it until AppVeyor upgraded the MSVC version, so UWP hasn't been tested in a while.

I'll see if we can switch to GitHub Actions for the UWP build to see if we can fix things there.

@bradh352
Copy link
Copy Markdown
Member Author

bradh352 commented Aug 1, 2024

fixed in 3fd5925

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants