Pull request 2199: 5812-query-log-client-id

Updates #5812.

Squashed commit of the following:

commit 43aa147fe125f85af4767f413c3c73cea5a4db6c
Merge: 97ab71284 36986a8be
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Mon Apr 15 15:00:36 2024 +0300

    Merge branch 'master' into 5812-query-log-client-id

commit 97ab71284e6e215d0e8e9c4dd9d2ba97ef791ad3
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Apr 11 14:22:58 2024 +0300

    all: upd chlog

commit 525ac91977cfb36dc8f862fb36df11071f77c29d
Merge: 5d4db3f2e ff7c715c5
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Apr 11 14:15:28 2024 +0300

    Merge branch 'master' into 5812-query-log-client-id

commit 5d4db3f2ec42a8533e41dc9547bf061cd96451f2
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Wed Apr 10 16:19:11 2024 +0300

    dnsforward: client id priority
This commit is contained in:
Stanislav Chzhen 2024-04-15 15:07:58 +03:00
parent 36986a8beb
commit df7f19eb8c
2 changed files with 9 additions and 1 deletions

View File

@ -29,6 +29,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
### Fixed ### Fixed
- Ignoring query log for clients with ClientID set ([#5812]).
- Subdomains of `in-addr.arpa` and `ip6.arpa` containing zero-length prefix - Subdomains of `in-addr.arpa` and `ip6.arpa` containing zero-length prefix
incorrectly considered invalid when specified for private RDNS upstream incorrectly considered invalid when specified for private RDNS upstream
servers ([#6854]). servers ([#6854]).
@ -36,6 +37,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
([#6875]). ([#6875]).
[#5345]: https://github.com/AdguardTeam/AdGuardHome/issues/5345 [#5345]: https://github.com/AdguardTeam/AdGuardHome/issues/5345
[#5812]: https://github.com/AdguardTeam/AdGuardHome/issues/5812
[#6854]: https://github.com/AdguardTeam/AdGuardHome/issues/6854 [#6854]: https://github.com/AdguardTeam/AdGuardHome/issues/6854
[#6875]: https://github.com/AdguardTeam/AdGuardHome/issues/6875 [#6875]: https://github.com/AdguardTeam/AdGuardHome/issues/6875

View File

@ -29,7 +29,13 @@ func (s *Server) processQueryLogsAndStats(dctx *dnsContext) (rc resultCode) {
log.Debug("dnsforward: client ip for stats and querylog: %s", ipStr) log.Debug("dnsforward: client ip for stats and querylog: %s", ipStr)
ids := []string{ipStr, dctx.clientID} ids := []string{ipStr}
if dctx.clientID != "" {
// Use the ClientID first because it has a higher priority. Filters
// have the same priority, see applyAdditionalFiltering.
ids = []string{dctx.clientID, ipStr}
}
qt, cl := q.Qtype, q.Qclass qt, cl := q.Qtype, q.Qclass
// Synchronize access to s.queryLog and s.stats so they won't be suddenly // Synchronize access to s.queryLog and s.stats so they won't be suddenly