From 2c055fea1199bbd0414a826bc18ed6296a40a5c2 Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Thu, 1 Feb 2024 13:46:28 +0300 Subject: [PATCH] Pull request 2139: fix-invalid-addr Squashed commit of the following: commit 12e9e53ec20685989425411801bd836cbdefe9aa Author: Ainar Garipov Date: Wed Jan 31 19:34:40 2024 +0300 all: fix chlog commit 6a8d872dcf49ff685454297e36b888309e058fcf Author: Ainar Garipov Date: Wed Jan 31 19:33:18 2024 +0300 all: doc commit 12cd89634f9ae97876d8dd79e30de704b57ef47d Author: Ainar Garipov Date: Wed Jan 31 19:20:27 2024 +0300 dnsforward: fix http private ptrs --- CHANGELOG.md | 2 ++ internal/dnsforward/dnsforward.go | 4 +++- internal/dnsforward/http.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d14cfee1..6054e0ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,8 @@ In this release, the schema version has changed from 27 to 28. ### Fixed +- “Invalid AddrPort” in the *Private reverse DNS servers* section on the + *Settings → DNS settings* page. - Panic on using `--no-etc-hosts` flag ([#6644]). - Schedule display in the client settings after creating or updating. - Zero value in `querylog.size_memory` disables logging ([#6570]). diff --git a/internal/dnsforward/dnsforward.go b/internal/dnsforward/dnsforward.go index 2da21391..9c0097b9 100644 --- a/internal/dnsforward/dnsforward.go +++ b/internal/dnsforward/dnsforward.go @@ -83,7 +83,9 @@ type DHCP interface { // SystemResolvers is an interface for accessing the OS-provided resolvers. type SystemResolvers interface { - // Addrs returns the list of system resolvers' addresses. + // Addrs returns the list of system resolvers' addresses. Callers must + // clone the returned slice before modifying it. Implementations of Addrs + // must be safe for concurrent use. Addrs() (addrs []netip.AddrPort) } diff --git a/internal/dnsforward/http.go b/internal/dnsforward/http.go index d3d352df..2c222d07 100644 --- a/internal/dnsforward/http.go +++ b/internal/dnsforward/http.go @@ -218,7 +218,7 @@ func (s *Server) defaultLocalPTRUpstreams() (ups []string, err error) { return nil, err } - sysResolvers := slices.DeleteFunc(s.sysResolvers.Addrs(), matcher.Has) + sysResolvers := slices.DeleteFunc(slices.Clone(s.sysResolvers.Addrs()), matcher.Has) ups = make([]string, 0, len(sysResolvers)) for _, r := range sysResolvers { ups = append(ups, r.String())