mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-10 13:20:33 +02:00
cmd/cli: always set/reset DNS regardless of interfaces state
The interface may be down during ctrld uninstall, so the previous set DNS won't be restored, causing bad state when interface is up again.
This commit is contained in:
+2
-6
@@ -682,12 +682,8 @@ func canBeLocalUpstream(addr string) bool {
|
||||
// log message when error happens.
|
||||
func withEachPhysicalInterfaces(excludeIfaceName, context string, f func(i *net.Interface) error) {
|
||||
interfaces.ForeachInterface(func(i interfaces.Interface, prefixes []netip.Prefix) {
|
||||
// Skip not-running/local/virtual interface.
|
||||
if !i.IsUp() || i.IsLoopback() || len(i.HardwareAddr) == 0 {
|
||||
return
|
||||
}
|
||||
// Skip non-configured interfaces.
|
||||
if addrs, _ := i.Addrs(); len(addrs) == 0 {
|
||||
// Skip loopback/virtual interface.
|
||||
if i.IsLoopback() || len(i.HardwareAddr) == 0 {
|
||||
return
|
||||
}
|
||||
// Skip invalid interface.
|
||||
|
||||
Reference in New Issue
Block a user