mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00: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:
committed by
Cuong Manh Le
parent
4d810261a4
commit
5145729ab1
@@ -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