Subject: | Uncooked SOA rname? |
I have started using the venerable `dnswalk` to find cruft in my DNS and noticed that it was reporting a bogus error of my SOA rname having an '@' (which it doesn't).
Looking through the Net::DNS code, I found that the Net::DNS::Mailbox was translating the raw 'hostmaster.example.com.' into a proper e-mail address. I presume this happened in 0.68:
"Introduction of Mailbox.pm module that will be used in the future to represent RDATA components containing DNS coded RFC822 mailbox addresses."
This seems like a good, friendly addition, but for an application like `dnswalk`, which should be looking at the least-cooked data to identify problems, it is a step backwards, because now Net::DNS is obscuring bad data. As a workaround, I changed it to pull the raw rname from the rdstring: https://github.com/wcooley/dnswalk/commit/bdadb7499d589fac94add243314af4e60072dfd6
Maybe it's not worth the effort for a corner-case like this to provide a lower-level interface, but it would be nice if it did.
I am imagining potentially a cooked/raw flag to the Net::DNS::RR constructor, which would enable accessors to return raw (but decoded-to-text) data; I could imagine any data that is otherwise cooked with Net::DNS::Mailbox* could benefit from this, especially RRs that had more than one field in the rdata.
Actually, it I guess it could be simpler than that, now that I look deeper, if I am reading this correctly -- if Net::DNS::Domain->new stored the original string and provided an accessor, then that would be all I need. (To be completely proper, SOA would need an accessor for me to get the underlying object in $rr->{rname}; it violates encapsulation to access the attribute data like that.)
Thanks!