From: Brian W. <bwe...@xb...> - 2007-07-18 00:37:56
|
On Wed, 18 Jul 2007, Stefano Bagnara wrote: >> Something's very strange here. Both the standard unix dig and dnsjava's >> dig default to recursive queries - this can be been by the fact that >> both answers have the RD (recursion desired) bit set. For some reason, >> only the answer from dnsjava's dig has the RA (recursion available) bit >> set. I'm seeing the same responses, but I can't think of any good reason >> why that would happen. >> >> I tried adding the +qr option to the standard dig, and the -q option to >> dnsjava's dig, which causes the queries to be printed as well as the >> responses, but all that shows is that the queries are identical (except >> for query id). >> > So this is more weird than I thought :-/ > > After more "digging" ;-) I think I found a bug in dnsjava dig. If you > call it without the full type/class specification (MX IN at the end and > some more ignored parameters) then it throws a silently caught > ArrayIndexOutOfBoundException while processing arguments. This way it > never sets the server and will use your default server :-). So I think > this is a bug you can easily fix in your dig. Once you fix that bug or > simply add "MX IN -q somethingelse" the results are different: Good catch. Yes, that looks like a problem. > Now, back to my problem I have another domain that currently reproduce > the previous behaviour (even if this time the 2 dig results are equals): > > [snip] > > You say that dig defaults to recursive queries. Instead dnsjava Lookup > does not support recursive resolution, right? The terminology you're using here is a bit confusing. The standard unix dig, dnsjava's dig program, and the dnsjava Lookup class all behave the same way - they set the recursion desired bit on queries, meaning that they are requesting that the server perform a recursive lookup. None of them performs recursive resolution themselves. > We use dnsjava to lookup MX records for SMTP delivery: what do you think > is the behavior required by DNS+SMTP specification? Currently we simply > run the Lookup using the dnsservers configured by the user (or the one > autodiscovered by dnsjava) and take its result as is. In this > "uudial.ch." domain and 194.246.118.118 configuration the dnsjava > "Lookup" does not return the MX record: is this intended? Should we do > something different? Can you answer this or give me a pointer to some > doc I can read about? I don't know what 194.246.118.118 is, but when I query it, it's not doing recursion. dnsjava's Lookup class is a stub resolver, so it should only be sending queries to servers that perform recursion. If I instead send the query to a server that does perform recursion, I get the desired MX record. Brian |