From 187b759fc6c629157c972fc52c9f918af3778fc4 Mon Sep 17 00:00:00 2001 From: Stanislav Chzhen Date: Wed, 7 May 2025 16:34:46 +0300 Subject: [PATCH] Pull request 2404: 7801-fix-cmd-update Closes #7801. Squashed commit of the following: commit f6e924e939eb9487e2c7743f04bb217e758ef253 Merge: 9caa54933 8c8323ae6 Author: Stanislav Chzhen Date: Wed May 7 16:22:09 2025 +0300 Merge branch 'master' into 7801-fix-cmd-update commit 9caa5493302af11b8d522feb2cf6e6f0facaec53 Author: Stanislav Chzhen Date: Tue Apr 29 20:52:09 2025 +0300 home: imp code commit 765ea0023972e326c54f0c17ba79f3feca8ff803 Author: Stanislav Chzhen Date: Tue Apr 29 20:16:55 2025 +0300 all: fix cmd update --- CHANGELOG.md | 4 ++++ internal/home/dns.go | 10 ++++------ internal/home/home.go | 2 +- internal/home/tls.go | 5 ++++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99b793f7..6ac5c4d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,10 +20,14 @@ NOTE: Add new changes BELOW THIS COMMENT. ### Fixed +- Command line option `--update` when the `dns.serve_plain_dns` configuration property was disabled ([7801]). + - DNS cache not working for custom upstream configurations. - Validation process for the DNS-over-TLS, DNS-over-QUIC, and HTTPS ports on the *Encryption Settings* page. +[#7801]: https://github.com/AdguardTeam/AdGuardHome/issues/7801 + diff --git a/internal/home/dns.go b/internal/home/dns.go index eff257d1..9afc6263 100644 --- a/internal/home/dns.go +++ b/internal/home/dns.go @@ -119,16 +119,15 @@ func initDNS( globalContext.dhcpServer, anonymizer, httpRegister, - tlsMgr.config(), tlsMgr, baseLogger, ) } // initDNSServer initializes the [context.dnsServer]. To only use the internal -// proxy, none of the arguments are required, but tlsConf, tlsMgr and l still -// must not be nil, in other cases all the arguments also must not be nil. It -// also must not be called unless [config] and [globalContext] are initialized. +// proxy, none of the arguments are required, but tlsMgr and l still must not be +// nil, in other cases all the arguments also must not be nil. It also must not +// be called unless [config] and [globalContext] are initialized. // // TODO(e.burkov): Use [dnsforward.DNSCreateParams] as a parameter. func initDNSServer( @@ -138,7 +137,6 @@ func initDNSServer( dhcpSrv dnsforward.DHCP, anonymizer *aghnet.IPMut, httpReg aghhttp.RegisterFunc, - tlsConf *tlsConfigSettings, tlsMgr *tlsManager, l *slog.Logger, ) (err error) { @@ -167,7 +165,7 @@ func initDNSServer( dnsConf, err := newServerConfig( &config.DNS, config.Clients.Sources, - tlsConf, + tlsMgr.config(), tlsMgr, httpReg, globalContext.clients.storage, diff --git a/internal/home/home.go b/internal/home/home.go index dc5055d5..a4e847bf 100644 --- a/internal/home/home.go +++ b/internal/home/home.go @@ -1078,7 +1078,7 @@ func cmdlineUpdate( // // TODO(e.burkov): We could probably initialize the internal resolver // separately. - err := initDNSServer(nil, nil, nil, nil, nil, nil, &tlsConfigSettings{}, tlsMgr, l) + err := initDNSServer(nil, nil, nil, nil, nil, nil, tlsMgr, l) fatalOnError(err) l.InfoContext(ctx, "performing update via cli") diff --git a/internal/home/tls.go b/internal/home/tls.go index cb52403a..058a4ba0 100644 --- a/internal/home/tls.go +++ b/internal/home/tls.go @@ -193,7 +193,10 @@ func (m *tlsManager) start(_ context.Context) { m.web.tlsConfigChanged(context.Background(), m.conf) } -// reload updates the configuration and restarts the TLS manager. +// reload updates the configuration and restarts the TLS manager. It logs any +// encountered errors. +// +// TODO(s.chzhen): Consider returning an error. func (m *tlsManager) reload(ctx context.Context) { m.mu.Lock() defer m.mu.Unlock()