diff --git a/internal/home/clients.go b/internal/home/clients.go index 61802831..7396e8c6 100644 --- a/internal/home/clients.go +++ b/internal/home/clients.go @@ -244,10 +244,6 @@ func (clients *clientsContainer) addFromConfig(objects []*clientObject) { } } - if cli.BlockedServices == nil && cli.UseOwnBlockedServices { - cli.BlockedServices = []string{} - } - for _, t := range o.Tags { if clients.allTags.Has(t) { cli.Tags = append(cli.Tags, t) diff --git a/internal/home/dns.go b/internal/home/dns.go index c533807e..79901c27 100644 --- a/internal/home/dns.go +++ b/internal/home/dns.go @@ -335,6 +335,8 @@ func applyAdditionalFiltering(clientIP net.IP, clientID string, setts *filtering // pref is a prefix for logging messages around the scope. const pref = "applying filters" + Context.filters.ApplyBlockedServices(setts, nil) + log.Debug("%s: looking for client with ip %s and clientid %q", pref, clientIP, clientID) if clientIP == nil { @@ -356,9 +358,13 @@ func applyAdditionalFiltering(clientIP net.IP, clientID string, setts *filtering log.Debug("%s: using settings for client %q (%s; %q)", pref, c.Name, clientIP, clientID) if c.UseOwnBlockedServices { - Context.filters.ApplyBlockedServices(setts, c.BlockedServices) - } else { - Context.filters.ApplyBlockedServices(setts, nil) + // TODO(e.burkov): Get rid of this crutch. + svcs := c.BlockedServices + if svcs == nil { + svcs = []string{} + } + Context.filters.ApplyBlockedServices(setts, svcs) + log.Debug("services set: %v", setts.ServicesRules) } setts.ClientName = c.Name