Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only warn user of --local-addr is provided explicitly by user #489

Merged
merged 7 commits into from
Dec 22, 2024
8 changes: 7 additions & 1 deletion src/zdns/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,13 @@ func (r *Resolver) getConnectionInfo(nameServer *NameServer) (*ConnectionInfo, e
}
}
if localAddr != nil {
log.Warnf("none of the user-supplied local addresses could connect to name server %s, using local address %s", nameServer.String(), localAddr.String())
if (len(r.userPreferredIPv4LocalAddrs) > 0 && localAddr.To4() != nil) || (len(r.userPreferredIPv6LocalAddrs) > 0 && util.IsIPv6(localAddr)) {
// the user provided a local addr. explicitly that won't work, error
log.Fatalf("none of the user-supplied local addresses (%v) could connect to name server %s", userIPs, nameServer.String())
} else {
// user didn't explicitly provide a local addr, this is just a default. Info level so as not to alarm the user
log.Infof("none of the default local addresses could connect to name server %s, using local address %s", nameServer.String(), localAddr.String())
}
}
}
if localAddr == nil {
Expand Down
Loading