Skip to content

Commit

Permalink
all: fix initial rdns check
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed May 22, 2024
1 parent bcda80b commit 5eaa024
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions internal/dnsforward/upstreams.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,18 @@ func newPrivateConfig(
}
}

log.Debug("dnsforward: upstreams to resolve ptr for local addresses: %v", addrs)
log.Debug("dnsforward: private-use upstreams: %v", addrs)

uc, err = proxy.ParseUpstreamsConfig(addrs, opts)
if err != nil {
return uc, fmt.Errorf("preparing private upstreams: %w", err)
}

if !confNeedsFiltering {
return uc, nil
}

err = filterOutAddrs(uc, unwanted)
if err != nil {
return uc, fmt.Errorf("filtering private upstreams: %w", err)
if confNeedsFiltering {
err = filterOutAddrs(uc, unwanted)
if err != nil {
return uc, fmt.Errorf("filtering private upstreams: %w", err)
}
}

// Prevalidate the config to catch the exact error before creating proxy.
Expand Down
2 changes: 1 addition & 1 deletion internal/home/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func initDNSServer(
}

// Try to prepare the server with disabled private RDNS resolution if it
// failed to prepare as is. See TODO on [ErrBadPrivateRDNSUpstreams].
// failed to prepare as is. See TODO on [dnsforward.PrivateRDNSError].
err = Context.dnsServer.Prepare(dnsConf)
if privRDNSErr := (&dnsforward.PrivateRDNSError{}); errors.As(err, &privRDNSErr) {
log.Info("WARNING: %s; trying to disable private RDNS resolution", err)
Expand Down

0 comments on commit 5eaa024

Please sign in to comment.