Pull request 1987: 6158-fix-dns-filter

Updates #6158.

Squashed commit of the following:

commit 763292f9cf5796574b4b79fc32874fb9acefb500
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Aug 31 12:54:08 2023 +0300

    dnsforward: fix dns filter
This commit is contained in:
Stanislav Chzhen 2023-08-31 13:43:17 +03:00
parent 18d15be4e8
commit 27ec6cd59e
1 changed files with 10 additions and 7 deletions

View File

@ -542,6 +542,8 @@ func (s *Server) setupLocalResolvers() (err error) {
func (s *Server) Prepare(conf *ServerConfig) (err error) { func (s *Server) Prepare(conf *ServerConfig) (err error) {
s.conf = *conf s.conf = *conf
// dnsFilter can be nil during application update.
if s.dnsFilter != nil {
err = validateBlockingMode( err = validateBlockingMode(
s.dnsFilter.BlockingMode, s.dnsFilter.BlockingMode,
s.dnsFilter.BlockingIPv4, s.dnsFilter.BlockingIPv4,
@ -550,6 +552,7 @@ func (s *Server) Prepare(conf *ServerConfig) (err error) {
if err != nil { if err != nil {
return fmt.Errorf("checking blocking mode: %w", err) return fmt.Errorf("checking blocking mode: %w", err)
} }
}
s.initDefaultSettings() s.initDefaultSettings()