mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-10-12 01:58:46 +02:00
Harden DNS64, VPN routing and DNS recovery ownership
This commit is contained in:
1 parent
44a638d158
commit
462f912495
23 files changed
+1021
-86
No files matched your search
+9
-2
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user