From f5c47b6193bfb5c8d288ce04098435a927673a30 Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Tue, 2 Feb 2021 13:35:23 +0300 Subject: [PATCH] Pull request: dnsforward: fix infinite loop Merge in DNS/adguard-home from 2619-infinite-loop to master Updates #2619. Squashed commit of the following: commit 425fde3f476349571036b9b95c9d0a33703270ee Author: Ainar Garipov Date: Tue Feb 2 13:08:52 2021 +0300 dnsforward: fix infinite loop --- internal/dnsforward/dnsforward.go | 2 +- internal/dnsforward/ipset_linux.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/dnsforward/dnsforward.go b/internal/dnsforward/dnsforward.go index 3384f6cb..58ea3b72 100644 --- a/internal/dnsforward/dnsforward.go +++ b/internal/dnsforward/dnsforward.go @@ -212,7 +212,7 @@ func (s *Server) Prepare(config *ServerConfig) error { // Log and go on. // // TODO(a.garipov): The Snap problem can probably be solved if - // we add the netlink-coinnector interface plug. + // we add the netlink-connector interface plug. log.Error("cannot initialize ipset: %s", err) } diff --git a/internal/dnsforward/ipset_linux.go b/internal/dnsforward/ipset_linux.go index e88c3986..f74f5503 100644 --- a/internal/dnsforward/ipset_linux.go +++ b/internal/dnsforward/ipset_linux.go @@ -242,6 +242,9 @@ func (c *ipsetCtx) lookupHost(host string) (sets []ipsetProps) { } i = strings.Index(host, ".") + if i == -1 { + break + } } // Check the root catch-all one.