This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NAPTR Look-up Using dnsjava - How to Access the Additional RRs  RSS feed

 
Ron McLeod
Saloon Keeper
Posts: 1431
207
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing a NAPTR look-up for a domain, and I get two records back. The records have the flags set to a, indicating that the replacement is a A/AAAA target. The response also contains the A records for the targets, but I can't figure-out how to access the Additional RRs provided in the NAPTR response. I don't want to have to follow-up with a number of A record look-ups if the answers were already provided.

Has anyone used dnsjava before and know if this is possible, or have any suggestions?

Candidate node: topoff.eth3.mmec01.mmegi8001.mme.epc.mnc990.mcc311.3gppnetwork.org.
Candidate node: topoff.eth1.mmec01.mmegi8001.mme.epc.mnc990.mcc311.3gppnetwork.org.



 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm familiar with DNSJava, but can't replicate your results because of the private IP. Can you post an example that uses public IPs instead?
 
Ron McLeod
Saloon Keeper
Posts: 1431
207
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf -- thanks for looking at this.

I have made the DNS server accessible from the public network and updated the code accordingly.

 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, that works. Those additional records are not part of the NAPTR records. The tool that produces the output you posted apparently performs additional A record lookups to retrieve them, so I think that's what you need to do as well.
 
Ron McLeod
Saloon Keeper
Posts: 1431
207
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The output that I posted was the actual wire response to the NAPTR query, and included the A records in the ADDITIONAL section of the response from the DNS server (bind 9).

I looked-through the source for the dnsjava library and found that the ADDITIONAL records are in-fact added to the cache (so no need to explicitly perform queries for the address records). What I didn't realize was that the entries in the cache are qualified with a Credibility value, and that data found in the ADDITIONAL section of the response is less credible than data found in the ANSWERS section, and that the default credibility for Lookup is higher than that of ADDITIONAL.

I found that to access the cached entries from the ADDITIONAL section of the response, I needed to set the minimum credibility for the address record look-up to ANY (or ADDITIONAL - both have the same level of credibility). After doing that, I can retrieve the NAPTR and associated A records with a single query (as long as I am willing to trust the address records provide in the ADDITIONAL section). If I leave the minimum credibility set to the default value (or explicitly set it to NORMAL), the library will issue A record queries and not used the cached less-credible entries.

Network trace - A records from ADDITIONAL section:
TX: DNS 114 Standard query 0x46f3 NAPTR mmec01.mmegi8001.mme.epc.mnc990.mcc311.3gppnetwork.org
RX: DNS 420 Standard query response 0x46f3 NAPTR 100 999 a NAPTR 200 999 a


Network trace - A records from additional queries:
TX: DNS 114 Standard query 0x9c51 NAPTR mmec01.mmegi8001.mme.epc.mnc990.mcc311.3gppnetwork.org
RX: DNS 420 Standard query response 0x9c51 NAPTR 200 999 a NAPTR 100 999 a
TX: DNS 126 Standard query 0x3ac9 A topoff.eth1.mmec01.mmegi8001.mme.epc.mnc990.mcc311.3gppnetwork.org
RX: DNS 192 Standard query response 0x3ac9 A 192.0.2.12 A 192.0.2.11
TX: DNS 126 Standard query 0x7b13 A topoff.eth3.mmec01.mmegi8001.mme.epc.mnc990.mcc311.3gppnetwork.org
RX: DNS 192 Standard query response 0x7b13 A 192.0.2.13 A 192.0.2.14


Test app output:
Candidate node: topoff.eth3.mmec01.mmegi8001.mme.epc.mnc990.mcc311.3gppnetwork.org.
192.0.2.13
192.0.2.14

Candidate node: topoff.eth1.mmec01.mmegi8001.mme.epc.mnc990.mcc311.3gppnetwork.org.
192.0.2.12
192.0.2.11


 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice sleuthing! I stand corrected.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!