all: upd chlog

This commit is contained in:
Stanislav Chzhen 2024-04-11 17:06:54 +03:00
parent c8184bef8f
commit decb768d3b
2 changed files with 8 additions and 4 deletions

View File

@ -25,6 +25,8 @@ NOTE: Add new changes BELOW THIS COMMENT.
### Added ### Added
- Support for link-local subnets, i.e. `fe80::/16`, in the access settings
([#6192]).
- Support for comments in the ipset file ([#5345]). - Support for comments in the ipset file ([#5345]).
### Fixed ### Fixed
@ -36,6 +38,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
[#6192]: https://github.com/AdguardTeam/AdGuardHome/issues/6192
[#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

@ -47,7 +47,7 @@ func processAccessClients(
var ip netip.Addr var ip netip.Addr
var ipnet netip.Prefix var ipnet netip.Prefix
if ip, err = netip.ParseAddr(s); err == nil { if ip, err = netip.ParseAddr(s); err == nil {
ips.Add(ip.WithZone("")) ips.Add(ip)
} else if ipnet, err = netip.ParsePrefix(s); err == nil { } else if ipnet, err = netip.ParsePrefix(s); err == nil {
*nets = append(*nets, ipnet) *nets = append(*nets, ipnet)
} else { } else {
@ -140,8 +140,6 @@ func (a *accessManager) isBlockedHost(host string, qt rules.RRType) (ok bool) {
// isBlockedIP returns the status of the IP address blocking as well as the rule // isBlockedIP returns the status of the IP address blocking as well as the rule
// that blocked it. // that blocked it.
func (a *accessManager) isBlockedIP(ip netip.Addr) (blocked bool, rule string) { func (a *accessManager) isBlockedIP(ip netip.Addr) (blocked bool, rule string) {
ip = ip.WithZone("")
blocked = true blocked = true
ips := a.blockedIPs ips := a.blockedIPs
ipnets := a.blockedNets ipnets := a.blockedNets
@ -158,7 +156,10 @@ func (a *accessManager) isBlockedIP(ip netip.Addr) (blocked bool, rule string) {
} }
for _, ipnet := range ipnets { for _, ipnet := range ipnets {
if ipnet.Contains(ip) { // Remove zone before checking because prefixes stip zones.
//
// TODO(d.kolyshev): Cover with tests.
if ipnet.Contains(ip.WithZone("")) {
return blocked, ipnet.String() return blocked, ipnet.String()
} }
} }