mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-21 20:45:33 +03:00
Pull request 2223: 7013 Initial RDNS
Updates #7013.
Squashed commit of the following:
commit 68a53ec702ea4ba6c1e077eeea43a14cb93e76ff
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Wed May 22 15:55:31 2024 +0300
all: imp chlog
commit a02b8e1165e05fbe96aea73dd238760e2b2fcce2
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Wed May 22 14:21:27 2024 +0300
all: log changes, imp docs
commit f9ec0efe6dc8a257da8177b2e9bc41ed44b18bb7
Merge: ee7202a7b 1be34ab96
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Wed May 22 14:16:30 2024 +0300
Merge branch 'master' into 7013-initial-rdns
commit ee7202a7b4a16eb8936ecaa81a27b3b81b982008
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Wed May 22 13:11:58 2024 +0300
dnsforward: fix http rdns check
commit 5eaa024b1148dabd92064a7ec8bc9e7d544af522
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Wed May 22 12:40:30 2024 +0300
all: fix initial rdns check
This commit is contained in:
parent
1be34ab963
commit
a030dd45d8
4 changed files with 22 additions and 10 deletions
|
@ -23,6 +23,13 @@ See also the [v0.107.50 GitHub milestone][ms-v0.107.50].
|
|||
NOTE: Add new changes BELOW THIS COMMENT.
|
||||
-->
|
||||
|
||||
### Fixed
|
||||
|
||||
- Broken private reverse DNS upstream servers validation causing update failures
|
||||
([#7013]).
|
||||
|
||||
[#7013]: https://github.com/AdguardTeam/AdGuardHome/issues/7013
|
||||
|
||||
<!--
|
||||
NOTE: Add new changes ABOVE THIS COMMENT.
|
||||
-->
|
||||
|
|
|
@ -333,6 +333,13 @@ func (req *jsonDNSConfig) checkBootstrap() (err error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
// containsPrivateRDNS returns true if req contains private RDNS settings and
|
||||
// should be validated.
|
||||
func (req *jsonDNSConfig) containsPrivateRDNS() (ok bool) {
|
||||
return (req.UsePrivateRDNS != nil && *req.UsePrivateRDNS) ||
|
||||
(req.LocalPTRUpstreams != nil && len(*req.LocalPTRUpstreams) > 0)
|
||||
}
|
||||
|
||||
// checkPrivateRDNS returns an error if the configuration of the private RDNS is
|
||||
// not valid.
|
||||
func (req *jsonDNSConfig) checkPrivateRDNS(
|
||||
|
@ -340,7 +347,7 @@ func (req *jsonDNSConfig) checkPrivateRDNS(
|
|||
sysResolvers SystemResolvers,
|
||||
privateNets netutil.SubnetSet,
|
||||
) (err error) {
|
||||
if (req.UsePrivateRDNS == nil || !*req.UsePrivateRDNS) && req.LocalPTRUpstreams == nil {
|
||||
if !req.containsPrivateRDNS() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -103,21 +103,19 @@ 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
|
||||
}
|
||||
|
||||
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.
|
||||
// See TODO on [PrivateRDNSError].
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue