From 27ec6cd59e6c6b9b2088bbf2ebfcfa29e4480f41 Mon Sep 17 00:00:00 2001 From: Stanislav Chzhen Date: Thu, 31 Aug 2023 13:43:17 +0300 Subject: [PATCH] Pull request 1987: 6158-fix-dns-filter Updates #6158. Squashed commit of the following: commit 763292f9cf5796574b4b79fc32874fb9acefb500 Author: Stanislav Chzhen Date: Thu Aug 31 12:54:08 2023 +0300 dnsforward: fix dns filter --- internal/dnsforward/dnsforward.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/internal/dnsforward/dnsforward.go b/internal/dnsforward/dnsforward.go index 941721bd..1af4c20a 100644 --- a/internal/dnsforward/dnsforward.go +++ b/internal/dnsforward/dnsforward.go @@ -542,13 +542,16 @@ func (s *Server) setupLocalResolvers() (err error) { func (s *Server) Prepare(conf *ServerConfig) (err error) { s.conf = *conf - err = validateBlockingMode( - s.dnsFilter.BlockingMode, - s.dnsFilter.BlockingIPv4, - s.dnsFilter.BlockingIPv6, - ) - if err != nil { - return fmt.Errorf("checking blocking mode: %w", err) + // dnsFilter can be nil during application update. + if s.dnsFilter != nil { + err = validateBlockingMode( + s.dnsFilter.BlockingMode, + s.dnsFilter.BlockingIPv4, + s.dnsFilter.BlockingIPv6, + ) + if err != nil { + return fmt.Errorf("checking blocking mode: %w", err) + } } s.initDefaultSettings()