home: fix empty svcs

This commit is contained in:
Eugene Burkov 2022-10-03 17:30:03 +03:00
parent 5e626306d1
commit 27032ef79e
2 changed files with 9 additions and 7 deletions

View File

@ -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)

View File

@ -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