Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: deconstructing tinydns(djbdns) SRV records

by VinsWorldcom (Prior)
on Aug 25, 2017 at 10:49 UTC ( [id://1198010]=note: print w/replies, xml ) Need Help??


in reply to Re: deconstructing tinydns(djbdns) SRV records
in thread deconstructing tinydns(djbdns) SRV records

I believe that is the "raw" format as it would go over the wire, but it's only the SRV record part, not the whole packet or whole DNS layer. Your solution above requires at least the whole DNS layer (if using $offset = 0) - at least that's they way I interpret it and according to a quick test, seems likely:

corrupt wire-format data at C:/Strawberry/perl/vendor/lib/Net/DNS/RR.p +m line 241.

You can try the Net::Frame::Layer::DNS module and it's NFL::DNS::RR::SRV sub module - you'll need the Net::Frame and Net::Frame::Simple modules as well (they will auto-install if you do a 'cpan Net::Frame::Layer::DNS' install as they are listed as dependencies) and they have dependencies themselves - so it may get a bit bigger than you need, but this works:

#!perl use strict; use warnings; use Net::Frame::Simple; my $data = "\000\012\000\144\023\304\003pbx\007example\003com\000"; my $info = Net::Frame::Simple->new( raw => $data, firstLayer => 'DNS::RR::SRV', ); print $info->print;
Output:
DNS::RR::SRV: priority:10 weight:100 port:5060 DNS::RR::SRV: target:pbx.example.com

UPDATE: Note the ':3600' is *not* part of the of the SRV rdata. It is part of the DNS Answer section so the $data in the OP isn't exactly the raw wire format.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1198010]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-24 19:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found