From d9f6fa7aee4c963d9599ade925e9138f6559c981 Mon Sep 17 00:00:00 2001 From: mzz <2017@duck.com> Date: Sat, 27 May 2023 13:51:19 +0800 Subject: [PATCH] fix: dns mismatched qname matching (#99) --- common/consts/dns.go | 2 +- component/dns/request_routing.go | 2 +- component/dns/response_routing.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/consts/dns.go b/common/consts/dns.go index e5e4a70..42e597b 100644 --- a/common/consts/dns.go +++ b/common/consts/dns.go @@ -19,7 +19,7 @@ const ( DnsRequestOutboundIndex_LogicalAnd DnsRequestOutboundIndex = 0xFF DnsRequestOutboundIndex_LogicalMask DnsRequestOutboundIndex = 0xFE - DnsRequestOutboundIndex_UserDefinedMax = DnsRequestOutboundIndex_AsIs - 1 + DnsRequestOutboundIndex_UserDefinedMax = DnsRequestOutboundIndex_Reject - 1 ) func (i DnsRequestOutboundIndex) String() string { diff --git a/component/dns/request_routing.go b/component/dns/request_routing.go index d89b598..69e439e 100644 --- a/component/dns/request_routing.go +++ b/component/dns/request_routing.go @@ -73,7 +73,7 @@ func (b *RequestMatcherBuilder) addQName(f *config_parser.Function, key string, } b.simulatedDomainSet = append(b.simulatedDomainSet, routing.DomainSet{ Key: consts.RoutingDomainKey(key), - RuleIndex: len(b.simulatedDomainSet), + RuleIndex: len(b.rules), Domains: values, }) upstreamId, err := b.upstreamToId(upstream.Name) diff --git a/component/dns/response_routing.go b/component/dns/response_routing.go index 42c72ca..2a7d91c 100644 --- a/component/dns/response_routing.go +++ b/component/dns/response_routing.go @@ -132,7 +132,7 @@ func (b *ResponseMatcherBuilder) addQName(f *config_parser.Function, key string, } b.simulatedDomainSet = append(b.simulatedDomainSet, routing.DomainSet{ Key: consts.RoutingDomainKey(key), - RuleIndex: len(b.simulatedDomainSet), + RuleIndex: len(b.rules), Domains: values, }) upstreamId, err := b.upstreamToId(upstream.Name)