Fix address filter matching for inverted legacy DNS rules

Inverted rules whose address filter conditions come from rule sets or
logical rules were rejected during pre-lookup matching, so the lookup was
never sent and the rules never matched; for plain ip rule sets this was a
regression from the rule-set invert fix in 1.12.22. Pre-lookup matching
now tracks whether the result depends on deferred address filter
conditions and defers such rules to the response phase, while results
already determined by evaluated conditions are still decided during
pre-lookup.
This commit is contained in:
世界
2026-08-30 17:41:46 +08:00
parent aea28ca6dc
commit 08986ad405
5 changed files with 460 additions and 57 deletions
+2 -2
View File
@@ -108,7 +108,7 @@ type InboundContext struct {
SourcePortMatch bool
DestinationAddressMatch bool
DestinationPortMatch bool
DidMatch bool
DeferredIPCIDRMatchGroups uint8
IgnoreDestinationIPCIDRMatch bool
}
@@ -123,7 +123,7 @@ func (c *InboundContext) ResetRuleMatchCache() {
c.SourcePortMatch = false
c.DestinationAddressMatch = false
c.DestinationPortMatch = false
c.DidMatch = false
c.DeferredIPCIDRMatchGroups = 0
}
func (c *InboundContext) DNSResponseAddressesForMatch() []netip.Addr {