Pull request: dnsforward: add a crutch against einval for ipset

Merge in DNS/adguard-home from fix-ipset to master

Squashed commit of the following:

commit 18538b0276a0896ad7d99bd0edd1604af80e790f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 1 20:30:13 2021 +0300

    dnsforward: add a crutch against einval for ipset
This commit is contained in:
Ainar Garipov 2021-02-01 20:44:15 +03:00
parent 8fdd021ed7
commit 39f6689b39

View File

@ -200,15 +200,19 @@ func (s *Server) Prepare(config *ServerConfig) error {
// --
err := s.ipset.init(s.conf.IPSETList)
if err != nil {
if !errors.Is(err, os.ErrPermission) {
if !errors.Is(err, os.ErrInvalid) && !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.
// have the required permissions, or when the kernel doesn't
// support netfilter.
//
// Log and go on.
//
// TODO(a.garipov): The Snap problem can probably be solved if
// we add the netlink-coinnector interface plug.
log.Error("cannot initialize ipset: %s", err)
}