Skip to content

[DNS] Reverse DNS resolution returns - (dash) character #4229

Description

@Mickael-van-der-Beek

I encountered a strange behaviour on the dns.reverse() method. e.g:

If you resolve the domain name www.fagron.com to an IP address:

dns.resolve4('www.fagron.com', function (e, addresses) {
    console.log(addresses); // [ '87.233.241.210' ]
});

If you now re-use this IPv4 address and do a reverse DNS resolution:

dns.reverse('87.233.241.210', function (e, hostnames) {
    console.log(hostnames); // [ '-' ]
});

It seems fairly strange that the returned value is a - dash character (45) since you would expect that:

  • if an error occurred, the error is returned and the hostnames argument is undefined
  • if no hostname is found at all, the hostnames argument is an empty array []

Node.js version is: v4.2.2
Operating system version is: Darwin myhostname.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64

Activity

  1. ChALkeR commented on Dec 10, 2015

    @ChALkeR
    Member
    $ dig +noall +answer -x 87.233.241.210
    210.241.233.87.in-addr.arpa. 86366 IN   PTR     -.
    

    That's what DNS actually returns. There is nothing that Node.js could or should do here.

  2. added
    dnsIssues and PRs related to the dns subsystem.
    on Dec 10, 2015
  3. Mickael-van-der-Beek commented on Dec 10, 2015

    @Mickael-van-der-Beek
    Author

    @ChALkeR Thanks for the quick answer.

    Is this part of the DNS protocol ? I can't find information anywhere about a possible - dash character as a return value even after looking through the Node.js and C-Ares source codes.

  4. bnoordhuis commented on Dec 10, 2015

    @bnoordhuis
    Member

    It's technically legal, the RDATA field in PTR records is free-form. Suggest close?

  5. Mickael-van-der-Beek commented on Dec 10, 2015

    @Mickael-van-der-Beek
    Author

    It might be interesting to mention this in the DNS core module documentation if that's the case because otherwise anyone that does not validate the hostnames returned will encounter unnecessary errors further down the pipeline.

    Yup, the issue can be closed. Thanks for the information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dnsIssues and PRs related to the dns subsystem.questionIssues asking questions about Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions