ruby-dns / net-dns

Net::DNS is a DNS library written in Ruby.
http://net-dns.rubyforge.org
Other
165 stars 42 forks source link

SRV resolver issue #13

Open weppos opened 14 years ago

weppos commented 14 years ago

Posted on behalf of André Moura.

I use net-dns to resolve the entry SRV, like this:

require "net/dns/resolver"
require "net/dns/rr/srv"

domain = "_service._tcp.domain.com"
res = Net::DNS::Resolver.start(domain, "SRV")

outuput this script:

;; Answer received from 127.0.0.1:53 (141 bytes)
;;
;; HEADER SECTION
;; id = 56866
;; qr = 1       opCode: QUERY   aa = 0  tc = 0  rd = 1
;; ra = 1       ad = 0  cd = 0  rcode = NoError
;; qdCount = 1  anCount = 1     nsCount = 3     arCount = 0

;; QUESTION SECTION (1 record):
;; _service._tcp.domain.com.  IN      SRV

;; ANSWER SECTION (1 record):
_service._tcp.domain.com.   2360   IN   SRV

;; AUTHORITY SECTION (3 records):
domain.com.         56924   IN      NS      ns2.domain.com.
domain.com.         56924   IN      NS      ns3.domain.com.
domain.com.         56924   IN      NS      ns1.domain.com.

But answer section not display the correct values as the dig:

command: dig srv _service._tcp.domain.com
outuput:

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> srv _service._tcp.domain.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22017
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 0

;; QUESTION SECTION:
;_service._tcp.domain.com.      IN      SRV

;; ANSWER SECTION:
_service._tcp.domain.com. 2564 IN       SRV     0 0 80 canonicalname.domain.com

;; AUTHORITY SECTION:
domain.com.             57128   IN      NS      ns3.domain.com.
domain.com.             57128   IN      NS      ns1.domain.com.
domain.com.             57128   IN      NS      ns2.domain.com.

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Mar  9 15:47:17 2010
;; MSG SIZE  rcvd: 141
andrem commented 14 years ago

corrected: http://github.com/andrem/net-dns