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:
Eugene Burkov
2024-05-22 16:40:28 +03:00
parent 1be34ab963
commit a030dd45d8
4 changed files with 22 additions and 10 deletions

View File

@@ -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
}