[dnsdist] regexrule for ipv6-PTR-queries (ipv6-subnet)

Pieter Lexis pieter.lexis at powerdns.com
Thu Oct 15 07:33:25 UTC 2020


Hi Tom,

On 10/15/20 8:54 AM, Tom via dnsdist wrote:
> I'm trying to route ipv6-ptr-queries for the net "2001:db8:7000::/36" to
> our knot. This should cover all v6-adresses for "2001:db8:7*".
>
> I've configured the following regexrule:
>
> addAction(AndRule({RegexRule(".*\.7\.8\.b\.d\.0\.1\.0\.0\.2\.ip6\.arpa$"),
> QTypeRule(DNSQType.PTR)}), PoolAction("knot"))
>
> Any hints what's wrong with the regex above? How can I catch the
> PTR-queries for "*.7.8.b.d.0.1.0.0.2.ip6.arpa."?

No idea on what is wrong with the regex, but it is easier (and faster)
to use a SuffixMatch here:

smn = newSuffixMatchNode()
smn:add("7.8.b.d.0.1.0.0.2.ip6.arpa.")
addAction(AndRule{SuffixMatchNodeRule(smn), QTypeRule(DNSQType.PTR)},
PoolAction("knot"))

showRules l;ists thsi as:

0           0 (qname in 7.8.b.d.0.1.0.0.2.ip6.arpa.) && (qtype==PTR)
to pool knot

This should be exactly what you need.

Cheers,

Pieter

-- 
Pieter Lexis
PowerDNS.COM BV -- https://www.powerdns.com


More information about the dnsdist mailing list