diff --git a/cmd/cli/dns_proxy.go b/cmd/cli/dns_proxy.go index 5396642..d7eb28a 100644 --- a/cmd/cli/dns_proxy.go +++ b/cmd/cli/dns_proxy.go @@ -1251,6 +1251,7 @@ func (p *prog) reinitializeOSResolver() { mainLog.Load().Debug().Msg("setting DNS configuration") p.setDNS() mainLog.Load().Debug().Msg("DNS configuration set successfully") + p.logInterfacesState() } } diff --git a/cmd/cli/prog.go b/cmd/cli/prog.go index 46d4d18..331f42a 100644 --- a/cmd/cli/prog.go +++ b/cmd/cli/prog.go @@ -273,6 +273,7 @@ func (p *prog) postRun() { p.setDNS() p.csSetDnsDone <- struct{}{} close(p.csSetDnsDone) + p.logInterfacesState() } } @@ -815,6 +816,28 @@ func (p *prog) resetDNS() { } } +func (p *prog) logInterfacesState() { + withEachPhysicalInterfaces("", "", func(i *net.Interface) error { + addrs, err := i.Addrs() + if err != nil { + mainLog.Load().Warn().Str("interface", i.Name).Err(err).Msg("failed to get addresses") + } + nss, err := currentStaticDNS(i) + if err != nil { + mainLog.Load().Warn().Str("interface", i.Name).Err(err).Msg("failed to get DNS") + } + if len(nss) == 0 { + nss = currentDNS(i) + } + mainLog.Load().Debug(). + Any("addrs", addrs). + Strs("nameservers", nss). + Int("index", i.Index). + Msgf("interface state: %s", i.Name) + return nil + }) +} + // findWorkingInterface looks for a network interface with a valid IP configuration func findWorkingInterface(currentIface string) string { // Helper to check if IP is valid (not link-local)