[Interest] Any known issues with rDNS lookups on OS X?

Bob Hood bhood2 at comcast.net
Tue Apr 12 05:00:05 CEST 2016


On 4/11/2016 8:09 PM, Thiago Macieira wrote:
> On segunda-feira, 11 de abril de 2016 19:11:37 PDT Bob Hood wrote:
>> I'm using Qt 5.4.2 code to retrieve a connected machine's hostname (via
>> QHostInfo::lookupHost()).  The code works perfectly under Windows, but fails
>> under OS X.  I get the hostname under Windows, but I'm left with only the
>> connections network address on OS X.
>>
>> Does anybody know of any existing issues with reverse-DNS look-ups on OS X?
> There are no known issues. Are you sure the machine in question has a reverse
> entry in DNS?
>
> Please show us the code you're using and the proof with the "host" command
> that the resolution of that IP works.
>

Slot:

   void Service::slot_lookup_complete()
   {
       RDnsBind* rdns_bind = qobject_cast<RDnsBind*>(sender());
       QString domain_id = rdns_bind->cd->domain_id;
       QString key;

       if(rdns_bind->host_info.error() != QHostInfo::NoError)
       {
if(!rdns_bind->host_info.addresses().isEmpty())
           {
               QHostAddress address = rdns_bind->host_info.addresses().first();
               key = address.toString();

               RDnsData rdns_data;
               rdns_data.domain_ip = key;
               rdns_data.domain_hostname = key;
               rDNS_cache[domain_id] = rdns_data;
           }
       }
       else if(!rdns_bind->host_info.addresses().isEmpty())
       {
           QHostAddress address = rdns_bind->host_info.addresses().first();
           key = address.toString();

           RDnsData rdns_data;
           rdns_data.domain_ip = key;
           rdns_data.domain_hostname = rdns_bind->host_info.hostName();
           rDNS_cache[domain_id] = rdns_data;
       }

       ...

       rdns_bind->deleteLater();
   }

Invocation:

   ...
   RDnsBind* rdns_bind = new RDnsBind(this);
   rdns_bind->cd = cd;
   connect(rdns_bind, SIGNAL(signal_lookup_complete()), this, 
SLOT(slot_lookup_complete()));

   QHostInfo::lookupHost(IP, rdns_bind, SLOT(slot_lookup_complete(QHostInfo)));
   ...

"host" command:

     Bobs-Mac:repo bob$ host 10.38.1.108
     Host 108.1.38.10.in-addr.arpa. not found: 3(NXDOMAIN)
     Bobs-Mac:repo bob$ host sikun
     Host sikun not found: 3(NXDOMAIN)

So, obviously there is no host entry for a NAT'd machine on the local network 
segment.  However, Windows machines identify other Windows machines correctly 
using this functionality on the same network segment.  Perhaps it's the 
Windows NetBIOS layer that is making that possible between Microsoft operating 
systems.



More information about the Interest mailing list