query name minimization does not work with partially bad glue records
Let's have a zone which has incomplete glue records in delegation like this:
ENTRY_BEGIN
MATCH opcode subdomain
ADJUST copy_id copy_query
REPLY QR NOERROR
SECTION QUESTION
com. IN A
SECTION AUTHORITY
; This is the offending NS (it must be ignored)
com. IN NS x.gtld-servers.net.
com. IN NS a.gtld-servers.net.
SECTION ADDITIONAL
x.gtld-servers.net. IN A 192.5.6.31
ENTRY_END
The server x.gtld-servers.net.
is broken and returns REFUSED for all but NS queries. The other server a.gtld-servers.net.
works.
kresd without query name minimization can handle it fine as it detects the x
server as bad
and moves on to the next server:
[ 0][plan] plan 'www.foo.com.' type 'A'
[55398][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[55398][resl] => using root hints
[39654][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[39654][resl] => querying: '193.0.14.129' score: 10 zone cut: '.' m12n: 'wWw.foO.cOM.' type: 'A' proto: 'udp'
[39654][iter] <= using glue for 'x.gtld-servers.net.': '192.5.6.31'
[39654][iter] <= referral response, follow
[39654][resl] <= server: '193.0.14.129' rtt: 6 ms
[30494][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[30494][resl] => querying: '192.5.6.31' score: 10 zone cut: 'com.' m12n: 'WWW.FoO.COM.' type: 'A' proto: 'udp'
[30494][iter] <= rcode: REFUSED
[30494][resl] <= server: '192.5.6.31' rtt: 1 ms
[18206][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[18206][resl] => querying: '192.5.6.31' score: 111 zone cut: 'com.' m12n: 'WWw.FOo.COm.' type: 'A' proto: 'udp'
[18206][iter] <= rcode: REFUSED
[18206][resl] <= server: '192.5.6.31' rtt: 1 ms
[57219][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[57219][resl] => querying: '192.5.6.31' score: 161 zone cut: 'com.' m12n: 'WwW.FoO.cOm.' type: 'A' proto: 'udp'
[57219][iter] <= rcode: REFUSED
[57219][resl] <= server: '192.5.6.31' rtt: 1 ms
[61022][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[61022][resl] => querying: '192.5.6.31' score: 186 zone cut: 'com.' m12n: 'wwW.fOO.COm.' type: 'A' proto: 'udp'
[61022][iter] <= rcode: REFUSED
[61022][resl] => server: '192.5.6.31' flagged as 'bad'
[54075][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[54075][plan] plan 'a.gtld-servers.net.' type 'AAAA'
[32802][iter] 'a.gtld-servers.net.' type 'AAAA' id was assigned, parent id 54075
[32802][resl] => using root hints
[61553][iter] 'a.gtld-servers.net.' type 'AAAA' id was assigned, parent id 54075
[61553][resl] => querying: '193.0.14.129' score: 11 zone cut: '.' m12n: 'A.gtld-SerVErS.nET.' type: 'AAAA' proto: 'udp'
[61553][iter] <= rcode: NOERROR
[61553][resl] <= server: '193.0.14.129' rtt: 2 ms
[30187][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[30187][plan] plan 'a.gtld-servers.net.' type 'A'
[27896][iter] 'a.gtld-servers.net.' type 'A' id was assigned, parent id 30187
[27896][resl] => using root hints
[34685][iter] 'a.gtld-servers.net.' type 'A' id was assigned, parent id 30187
[34685][resl] => querying: '193.0.14.129' score: 11 zone cut: '.' m12n: 'A.gtLd-SErVeRs.nET.' type: 'A' proto: 'udp'
[34685][iter] <= rcode: NOERROR
[30187][iter] <= using glue for 'a.gtld-servers.net.': '192.5.6.30'
[34685][resl] <= server: '193.0.14.129' rtt: 2 ms
[14390][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[14390][resl] => querying: '192.5.6.30' score: 10 zone cut: 'com.' m12n: 'WWW.foo.cOm.' type: 'A' proto: 'udp'
[14390][iter] <= referral response, follow
[14390][resl] <= server: '192.5.6.30' rtt: 1 ms
[14916][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[14916][plan] plan 'a.gtld-servers.net.' type 'AAAA'
[24215][iter] 'a.gtld-servers.net.' type 'AAAA' id was assigned, parent id 14916
[24215][resl] => using root hints
[45906][iter] 'a.gtld-servers.net.' type 'AAAA' id was assigned, parent id 14916
[45906][resl] => querying: '193.0.14.129' score: 11 zone cut: '.' m12n: 'A.gTld-SeRVErS.nET.' type: 'AAAA' proto: 'udp'
[45906][iter] <= rcode: NOERROR
[45906][resl] <= server: '193.0.14.129' rtt: 2 ms
[57675][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[57675][plan] plan 'a.gtld-servers.net.' type 'A'
[21748][iter] 'a.gtld-servers.net.' type 'A' id was assigned, parent id 57675
[21748][ rc ] => satisfied from cache
[21748][iter] <= rcode: NOERROR
[57675][iter] <= using glue for 'a.gtld-servers.net.': '192.5.6.30'
[49536][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[49536][resl] => querying: '192.5.6.30' score: 11 zone cut: 'www.foo.com.' m12n: 'WwW.fOo.CoM.' type: 'A' proto: 'udp'
[49536][iter] <= rcode: NOERROR
[49536][resl] <= server: '192.5.6.30' rtt: 1 ms
Unfortunately kresd does not move to the next server if query minimization is enabled:
[ 0][plan] plan 'www.foo.com.' type 'A'
[ 6555][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[ 6555][resl] => using root hints
[39232][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[39232][resl] => querying: '193.0.14.129' score: 10 zone cut: '.' m12n: 'coM.' type: 'NS' proto: 'udp'
[39232][iter] <= using glue for 'x.gtld-servers.net.': '192.5.6.31'
[39232][iter] <= referral response, follow
[39232][resl] <= server: '193.0.14.129' rtt: 7 ms
[17873][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[17873][resl] => querying: '192.5.6.31' score: 10 zone cut: 'com.' m12n: 'FoO.Com.' type: 'NS' proto: 'udp'
[17873][iter] <= using glue for 'x.gtld-servers.net.': '192.5.6.31'
[17873][iter] <= referral response, follow
[17873][resl] <= server: '192.5.6.31' rtt: 4 ms
[ 8362][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[ 8362][resl] => querying: '192.5.6.31' score: 11 zone cut: 'foo.com.' m12n: 'Www.fOo.cOM.' type: 'A' proto: 'udp'
[ 8362][iter] <= rcode: REFUSED
[ 8362][resl] <= server: '192.5.6.31' rtt: 3 ms
[ 6889][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[ 6889][resl] => querying: '192.5.6.31' score: 111 zone cut: 'foo.com.' m12n: 'WWw.fOO.cOm.' type: 'A' proto: 'udp'
[ 6889][iter] <= rcode: REFUSED
[ 6889][resl] <= server: '192.5.6.31' rtt: 2 ms
[43963][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[43963][resl] => querying: '192.5.6.31' score: 161 zone cut: 'foo.com.' m12n: 'Www.FOo.cOM.' type: 'A' proto: 'udp'
[43963][iter] <= rcode: REFUSED
[43963][resl] <= server: '192.5.6.31' rtt: 2 ms
[60355][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[60355][resl] => querying: '192.5.6.31' score: 186 zone cut: 'foo.com.' m12n: 'WWw.foo.COm.' type: 'A' proto: 'udp'
[60355][iter] <= rcode: REFUSED
[60355][resl] => server: '192.5.6.31' flagged as 'bad'
[26974][iter] 'www.foo.com.' type 'A' id was assigned, parent id 0
[26974][resl] => no valid NS left
Versions
Kresd: f9352bee
This is covered by (fixed) test sets/resolver/iter_ns_badglue.rpl from commit deckard@ebcc8b59c29652af83266abbae6e5ae512e66f45 . (temporary branch iter_ns_badglue)