Re: gethostbyaddr returning null for CNAME records

From: Villy Kruse (vek_at_station02.ohout.pharmapartners.nl)
Date: 02/27/04


Date: 27 Feb 2004 09:01:33 GMT

On Thu, 26 Feb 2004 15:19:33 -0800,
    David Schwartz <davids@webmaster.com> wrote:

>
>
> Your expectation is wrong. The function is get*HOST*byaddr, not
> get*WhateverHappensToBeThere*byaddr. Since there is no host record, it
> correctly returns NULL.
>
> The gethostbyaddr function tries to resolve an IP address to a PTR
> record to obtain the host name. In this case, there is no host name. If you
> look in the 'hostent' structure that gethostbyaddr returns, there is no
> place to put 'the canonical name for the IP address'.
>
> Basically, a CNAME for an IP address is not a host name.
>

It may be if it is part of a rfc2317 style in-addr.arpa delegation. The
name to which the CNAME refers to must then resolve to a PTR RR for the
real hostname and the latter seems to be missing.

Villy



Relevant Pages

  • Name resolution in .Net - arrrrrggghhhh!
    ... "The Resolve method queries a DNS server for the IP address associated ... "When hostName is a DNS-style host name associated with multiple IP ... documentation, ...
    (microsoft.public.dotnet.languages.csharp)
  • [SLE] Apache 2.0.46 & ipv6
    ... I have setup the dns to resolve ipv6.wiplinger.org. ... I can ping this host from my local lan from an xp machine with ping and ... In order to make sure that I really use IPv6, I set up apache to use ...
    (SuSE)
  • Re: MX-only domains dying?
    ... I've always thought of the www host as being an artifact of the good old days of the web where DNS was used as part of the maintenance methodology - if you needed to service a box you switched the IP in DNS to the hot spare. ... Using service names allows you to have each respective serviceresolve to different address, thus allowing you to spread services across different hosts. ... If you are wondering why I have A records for domainN.tld verses a CNAME record, I have never been able to get CNAME records to co-exist with any other record type for a given name. ...
    (comp.mail.sendmail)
  • Re: redirect apt to local repository
    ... > guess this is partly a dhcp question, ... Just so that you are not totally confused, my main server has 192.168.0.20 as ... 21 IN PTR kanger.home. ... host kanger { ...
    (Debian-User)
  • Re: Host name not resolved using zone
    ... A DNS server can answer from its cache as easily as it can from the zones, ... > to resolve 2 remote hosts under same domain, ... name or add the host records for it. ...
    (microsoft.public.win2000.dns)