Pull request 2404: 7801-fix-cmd-update

Closes #7801.

Squashed commit of the following:

commit f6e924e939eb9487e2c7743f04bb217e758ef253
Merge: 9caa54933 8c8323ae6
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Wed May 7 16:22:09 2025 +0300

    Merge branch 'master' into 7801-fix-cmd-update

commit 9caa5493302af11b8d522feb2cf6e6f0facaec53
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Apr 29 20:52:09 2025 +0300

    home: imp code

commit 765ea0023972e326c54f0c17ba79f3feca8ff803
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Apr 29 20:16:55 2025 +0300

    all: fix cmd update
This commit is contained in:
Stanislav Chzhen
2025-05-07 16:34:46 +03:00
parent 8c8323ae68
commit 187b759fc6
4 changed files with 13 additions and 8 deletions

View File

@@ -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
<!--
NOTE: Add new changes ABOVE THIS COMMENT.
-->

View File

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

View File

@@ -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")

View File

@@ -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()