From 5d52e68d264b77dd27ac53616027e6a26637c6e8 Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Wed, 27 Apr 2022 14:06:10 +0300 Subject: [PATCH] Pull request: home: imp client finding logging Updates #4526. Squashed commit of the following: commit 970476ea238cbab797912e1c50eca35e3f74a52f Merge: 3e2dde81 c4ff80fd Author: Ainar Garipov Date: Wed Apr 27 14:01:17 2022 +0300 Merge branch 'master' into 4526-add-client-logs commit 3e2dde81d7325b75c257f333e2c4e417f4ae203d Author: Ainar Garipov Date: Wed Apr 27 13:59:19 2022 +0300 home: imp logs commit 094bfe34770b4bdc504b5ae97dd2d3842b2f73cf Author: Ainar Garipov Date: Tue Apr 26 21:11:18 2022 +0300 home: imp client finding logging --- internal/home/dns.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/home/dns.go b/internal/home/dns.go index e28193ee..1c04c6c3 100644 --- a/internal/home/dns.go +++ b/internal/home/dns.go @@ -330,24 +330,28 @@ func getDNSEncryption() (de dnsEncryption) { // applyAdditionalFiltering adds additional client information and settings if // the client has them. -func applyAdditionalFiltering(clientAddr net.IP, clientID string, setts *filtering.Settings) { +func applyAdditionalFiltering(clientIP net.IP, clientID string, setts *filtering.Settings) { Context.dnsFilter.ApplyBlockedServices(setts, nil, true) - if clientAddr == nil { + log.Debug("looking up settings for client with ip %s and clientid %q", clientIP, clientID) + + if clientIP == nil { return } - setts.ClientIP = clientAddr + setts.ClientIP = clientIP c, ok := Context.clients.Find(clientID) if !ok { - c, ok = Context.clients.Find(clientAddr.String()) + c, ok = Context.clients.Find(clientIP.String()) if !ok { + log.Debug("client with ip %s and clientid %q not found", clientIP, clientID) + return } } - log.Debug("using settings for client %s with ip %s and clientid %q", c.Name, clientAddr, clientID) + log.Debug("using settings for client %q with ip %s and clientid %q", c.Name, clientIP, clientID) if c.UseOwnBlockedServices { Context.dnsFilter.ApplyBlockedServices(setts, c.BlockedServices, false)