Pull request 2384: 7734-fix-dhcp-client-filtering

Updates #7734.

Squashed commit of the following:

commit 11e091895bdebc1717bee47827322af56edea3a7
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Mon Apr 7 15:24:07 2025 +0300

    client: fix querylog search

commit 028cf11c480e9831f3925e600d1876ae719d5800
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Apr 4 15:45:19 2025 +0300

    all: upd chlog

commit ee1a70c160d3d7eca5c363708f57916d6df98146
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Fri Apr 4 15:33:34 2025 +0300

    client: fix dhcp client filtering
This commit is contained in:
Stanislav Chzhen
2025-04-07 19:03:30 +03:00
parent 295b2fefb1
commit 106785aab0
2 changed files with 20 additions and 2 deletions

View File

@@ -25,10 +25,18 @@ NOTE: Add new changes BELOW THIS COMMENT.
**NOTE:** `npm` may be replaced with a different tool, such as `pnpm` or
`yarn`, in a future release.
### Fixed
- Filtering for DHCP clients ([#7734]).
- Validation process for the HTTPS port on the *Encryption Settings* page.
### Removed
- Node 18 support.
[#7734]: https://github.com/AdguardTeam/AdGuardHome/issues/7734
<!--
NOTE: Add new changes ABOVE THIS COMMENT.
-->
@@ -64,8 +72,6 @@ See also the [v0.107.58 GitHub milestone][ms-v0.107.58].
### Fixed
- Validation process for the HTTPS port on the *Encryption Settings* page.
- Clearing the DNS cache on the *DNS settings* page now includes both global cache and custom client cache.
- Invalid ICMPv6 Router Advertisement messages ([#7547]).

View File

@@ -496,6 +496,11 @@ func (s *Storage) FindLoose(ip netip.Addr, id string) (p *Persistent, ok bool) {
return p.ShallowClone(), ok
}
foundMAC := s.dhcp.MACByIP(ip)
if foundMAC != nil {
return s.FindByMAC(foundMAC)
}
p = s.index.findByIPWithoutZone(ip)
if p != nil {
return p.ShallowClone(), true
@@ -682,6 +687,13 @@ func (s *Storage) ApplyClientFiltering(id string, addr netip.Addr, setts *filter
c, ok = s.index.findByIP(addr)
}
if !ok {
foundMAC := s.dhcp.MACByIP(addr)
if foundMAC != nil {
c, ok = s.FindByMAC(foundMAC)
}
}
if !ok {
s.logger.Debug("no client filtering settings found", "clientid", id, "addr", addr)