Harden DNS64, VPN routing and DNS recovery ownership

This commit is contained in:
Dev Scribe authored and Cuong Manh Le committed 2026-09-28 16:56:04 +07:00
1 parent 44a638d158
commit 462f912495
23 files changed
+1021 -86

No files matched your search

+9 -2
View File
@@ -1482,12 +1482,19 @@ func uninstall(p *prog, s service.Service) {
}
}
var restoreSavedStaticDNSInterfacesFn = withEachPhysicalInterfaces
var restoreSavedStaticDNSRestoreFn = restoreDNS
// restoreSavedStaticDNS restores DNS from saved static config files on physical interfaces.
func restoreSavedStaticDNS(excludeIfaceName string, removeSaved bool) {
withEachPhysicalInterfaces(excludeIfaceName, "restore static DNS", func(i *net.Interface) error {
restoreSavedStaticDNSInterfacesFn(excludeIfaceName, "restore static DNS", func(i *net.Interface) error {
if !interceptTargetAllowsStaticRestore(i.Name) {
mainLog.Load().Debug().Msgf("Saved static DNS restore skipped on interface %s: intercept target cleanup is pending or ownership is unreadable", i.Name)
return nil
}
file := savedStaticDnsSettingsFilePath(i)
if _, err := os.Stat(file); err == nil {
if err := restoreDNS(i); err != nil {
if err := restoreSavedStaticDNSRestoreFn(i); err != nil {
mainLog.Load().Error().Err(err).Msgf("Could not restore static DNS on interface %s", i.Name)
} else {
mainLog.Load().Debug().Msgf("Restored static DNS on interface %s successfully", i.Name)