Subject: | URI lookups don't work on Windows |
The wshelper res_search() (invoked from dnsglue.c) calls
DnsQuery_A(). (The _A here refers to ANSI encoding, not DNS A
records). This Windows function helpfully parses the response packet
and yields a linked list of records, each decoded according to the
query type. wshelper undoes this work, reassembling a fake DNS
response packet from the query domain and resource records, so that
we can parse it again in dnsglue.c and dnssrv.c.
DnsQuery_A() has no support for URI records. Therefore,
res_quer.c:build_rr() has no code to piece together a URI record
encoding from a PDNS_RECORD. Although it is experimentally possible
to make a URI query and find the record encoding (un-decoded) in the
PDNS_RECORD function where the union rests, retrieving the record
this way seems unlikely to keep working if Windows ever implements
the URI type.
I am hoping to use the DNS_QUERY_RETURN_MESSAGE flag to get the
original DNS response packet so we don't have to reassemble it;
however, this flag is not documented well enough to use and I can
find no examples of code using it. I have asked Microsoft dochelp
for clarification and will report back with their answer.
DnsQuery_A(). (The _A here refers to ANSI encoding, not DNS A
records). This Windows function helpfully parses the response packet
and yields a linked list of records, each decoded according to the
query type. wshelper undoes this work, reassembling a fake DNS
response packet from the query domain and resource records, so that
we can parse it again in dnsglue.c and dnssrv.c.
DnsQuery_A() has no support for URI records. Therefore,
res_quer.c:build_rr() has no code to piece together a URI record
encoding from a PDNS_RECORD. Although it is experimentally possible
to make a URI query and find the record encoding (un-decoded) in the
PDNS_RECORD function where the union rests, retrieving the record
this way seems unlikely to keep working if Windows ever implements
the URI type.
I am hoping to use the DNS_QUERY_RETURN_MESSAGE flag to get the
original DNS response packet so we don't have to reassemble it;
however, this flag is not documented well enough to use and I can
find no examples of code using it. I have asked Microsoft dochelp
for clarification and will report back with their answer.