Pull request: dnsforward: imp ipset caching, logging, and eperm handling
Merge in DNS/adguard-home from ipset-fix to master Updates #2619. Squashed commit of the following: commit 6939c823598b1e74cb3d991aad1b928547fd26a9 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Feb 1 16:55:14 2021 +0300 dnsforward: imp code commit 99e3a7c30b79d7929ddd9b700d7dd3d2683ec6d2 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Feb 1 15:52:12 2021 +0300 dnsforward: imp ipset caching, logging, and eperm handling
This commit is contained in:
@@ -2,9 +2,11 @@
|
||||
package dnsforward
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -198,10 +200,16 @@ func (s *Server) Prepare(config *ServerConfig) error {
|
||||
// --
|
||||
err := s.ipset.init(s.conf.IPSETList)
|
||||
if err != nil {
|
||||
// ipset cannot be initialized in a Snap version (and maybe - without root)
|
||||
// this needs to be handled properly
|
||||
// TODO: Handle this properly
|
||||
log.Info("Cannot initialize ipset module due to %v", err)
|
||||
if !errors.Is(err, os.ErrPermission) {
|
||||
return fmt.Errorf("cannot initialize ipset: %w", err)
|
||||
}
|
||||
|
||||
// ipset cannot currently be initialized if the server was
|
||||
// installed from Snap or when the user or the binary doesn't
|
||||
// have the required permissions.
|
||||
//
|
||||
// Log and go on.
|
||||
log.Error("cannot initialize ipset: %s", err)
|
||||
}
|
||||
|
||||
// Prepare DNS servers settings
|
||||
|
||||
Reference in New Issue
Block a user