On Mar 20, 2007, at 8:07 PM, Darren wrote: > Tracking this down, appears to be an issue in Answer.__init__ inside > resolver.py > I can probably patch it to work, but is there a reason ANY queries > aren't accepted, or is this a bug?
ANY is a bit tricky for dnspython's stub resolver API, as an ANY query can return multiple RRsets and thus doesn't fit into the API's notion of a single "answer rrset". I've got a number of ideas about how ANY could be supported, but I doubt that it should be. ANY queries are perilous if you're using them for something other than debugging, as an ANY query sent to a non-authoritative server gets you only those RRs it has in its cache (if it has any). Consider this example: $ dig woof.dnspython.org. ; <<>> DiG 9.3.2 <<>> woof.dnspython.org. ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43699 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;woof.dnspython.org. IN A ;; ANSWER SECTION: woof.dnspython.org. 3592 IN A 204.152.189.147 Now my resolver has just this A RR in its cache. Let's do an ANY query: $ dig woof.dnspython.org. any ; <<>> DiG 9.3.2 <<>> woof.dnspython.org. any ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7562 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;woof.dnspython.org. IN ANY ;; ANSWER SECTION: woof.dnspython.org. 3588 IN A 204.152.189.147 Now let's look at what the authority has at "woof.dnspython.org": $ dig @woof.dnspython.org. woof.dnspython.org. any ; <<>> DiG 9.3.2 <<>> @woof.dnspython.org. woof.dnspython.org. any ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17223 ;; flags: qr aa rd; QUERY: 1, ANSWER: 4, AUTHORITY: 3, ADDITIONAL: 0 ;; QUESTION SECTION: ;woof.dnspython.org. IN ANY ;; ANSWER SECTION: woof.dnspython.org. 3600 IN A 204.152.189.147 woof.dnspython.org. 3600 IN MX 0 woof.dnspython.org. woof.dnspython.org. 3600 IN TXT "v=spf1 mx -all" woof.dnspython.org. 3600 IN TYPE99 \# 15 0E763D73706631206D78202D616C6C So, if, for example you were doing the ANY query because you hoped to get MX, TXT, and SPF records in a single query, you may get them but you're not guaranteed to. This tends to complicate your program logic rather than simplify it. /Bob _______________________________________________ dnspython-users mailing list [email protected] http://woof.play-bow.org/mailman/listinfo/dnspython-users
