Subject: Reverse lookup for IPv6 on Windows

From: "AGARWAL,SWATI (HP-FtCollins,ex1)" <[email-masked]>
Date: Thu, 24 Jul 2003 10:04:35 -0700

Hello,

I am trying to do a reverse lookup on IPv6 on Windows. I am using
getnameinfo for that.  I am not able to successfully do this. Does someone
have an example code for this?

Swati
--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [email-masked]
--------------------------------------------------------------------

---

From: "Suresh Krishnan (QB/LMC)" <[email-masked]>
Date: Thu, 24 Jul 2003 14:34:51 -0400

Hi Swati,
	It has been a while since I did this, but here goes.

Regards
Suresh

<<<<<<<<<<<<<<<CODE SNIPPET>>>>>>>>>>>>>>>>>>>

  SOCKADDR_IN sinDest;
  int iDummy;  // Length if you want to use it in case of error in WSAStringToAddress

  // WSAStartup blah blah 
  // strIP is the char * with your IP address
  // strHostName will be the resolved hostname (char *)

  sinDest.sin_family = AF_INET;
  WSAStringToAddress(strIP, AF_INET, NULL,(LPSOCKADDR)&sinDest, &iDummy);

  if(getnameinfo((struct sockaddr *)&sinDest,sizeof(sinDest),
                  strHostName,sizeof(strHostName),
                  NULL, // Service info - don't care
  	            0, // Service info - don't care
                  NI_NAMEREQD // I want an error if it is not resolved
		))
  {
	// Error
  }
  else
  {
	// Success
  }

  // WSACleanup blah blah 
<<<<<<<<<<<<<<<CODE SNIPPET>>>>>>>>>>>>>>>>>>>

-----Original Message-----
From: AGARWAL,SWATI (HP-FtCollins,ex1) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 1:05 PM
To: [email-masked]'
Subject: Reverse lookup for IPv6 on Windows

Hello,

Swati

---

From: "AGARWAL,SWATI (HP-FtCollins,ex1)" <[email-masked]>
Date: Thu, 24 Jul 2003 11:56:05 -0700

Thanks Suresh. I tried it. But I am getting the following error:
 
WSANO_DATA
11004 
Valid name, no data record of requested type. 
The requested name is valid and was found in the database, but it does not
have the correct associated data being resolved for. The usual example for
this is a host name-to-address translation attempt (using gethostbyname or
WSAAsyncGetHostByName) which uses the DNS (Domain Name Server). An MX record
is returned but no A record-indicating the host itself exists, but is not
directly reachable.  

According to the above error it says that this is a hostname to ip address
translation. In my case it is vice versa. Also I am doing IPv6. I am able to
get the resolve the IPv6 addresses with nslookup using the 128 bit string.

Any thoughts?

Swati

-----Original Message-----
From: Suresh Krishnan (QB/LMC) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 12:35 PM
To: 'AGARWAL,SWATI (HP-FtCollins,ex1)'; [email-masked]'
Subject: RE: Reverse lookup for IPv6 on Windows

Hi Swati,

Regards
Suresh

  SOCKADDR_IN sinDest;
  int iDummy;  // Length if you want to use it in case of error in
WSAStringToAddress

  // WSAStartup blah blah 

  // WSACleanup blah blah 

-----Original Message-----
From: AGARWAL,SWATI (HP-FtCollins,ex1) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 1:05 PM
To: [email-masked]'
Subject: Reverse lookup for IPv6 on Windows

Hello,

Swati

---

From: "Suresh Krishnan (QB/LMC)" <[email-masked]>
Date: Thu, 24 Jul 2003 15:16:20 -0400

Hi Swati,
	Does your DNS server have the PTR records in the IP6.ARPA (or IP6.INT) domain for the IP address you are looking up? Short of that nothing else strikes my mind.

Regards
Suresh

-----Original Message-----
From: AGARWAL,SWATI (HP-FtCollins,ex1) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 2:56 PM
To: Suresh Krishnan (QB/LMC); [email-masked]'
Subject: RE: Reverse lookup for IPv6 on Windows

WSANO_DATA
11004 

Any thoughts?

Swati

-----Original Message-----
From: Suresh Krishnan (QB/LMC) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 12:35 PM
To: 'AGARWAL,SWATI (HP-FtCollins,ex1)'; [email-masked]'
Subject: RE: Reverse lookup for IPv6 on Windows

Hi Swati,

Regards
Suresh

  SOCKADDR_IN sinDest;

  // WSAStartup blah blah 

  // WSACleanup blah blah 

-----Original Message-----
From: AGARWAL,SWATI (HP-FtCollins,ex1) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 1:05 PM
To: [email-masked]'
Subject: Reverse lookup for IPv6 on Windows

Hello,

Swati

---

From: "AGARWAL,SWATI (HP-FtCollins,ex1)" <[email-masked]>
Date: Thu, 24 Jul 2003 15:17:30 -0400

Yes the DNS server here has PTR records in the IP6.INT domain. Is that a
problem?

Swati

-----Original Message-----
From: Suresh Krishnan (QB/LMC) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 1:16 PM
To: 'AGARWAL,SWATI (HP-FtCollins,ex1)'; [email-masked]'
Subject: RE: Reverse lookup for IPv6 on Windows

Hi Swati,
	Does your DNS server have the PTR records in the IP6.ARPA (or
IP6.INT) domain for the IP address you are looking up? Short of that nothing
else strikes my mind.

Regards
Suresh

-----Original Message-----
From: AGARWAL,SWATI (HP-FtCollins,ex1) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 2:56 PM
To: Suresh Krishnan (QB/LMC); [email-masked]'
Subject: RE: Reverse lookup for IPv6 on Windows

WSANO_DATA
11004 

Any thoughts?

Swati

-----Original Message-----
From: Suresh Krishnan (QB/LMC) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 12:35 PM
To: 'AGARWAL,SWATI (HP-FtCollins,ex1)'; [email-masked]'
Subject: RE: Reverse lookup for IPv6 on Windows

Hi Swati,

Regards
Suresh

  SOCKADDR_IN sinDest;

  // WSAStartup blah blah 

  // WSACleanup blah blah 

-----Original Message-----
From: AGARWAL,SWATI (HP-FtCollins,ex1) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 1:05 PM
To: [email-masked]'
Subject: Reverse lookup for IPv6 on Windows

Hello,

Swati

---

From: "Suresh Krishnan (QB/LMC)" <[email-masked]>
Date: Thu, 24 Jul 2003 15:37:35 -0400

Hi Swati,
	Maybe. The IP6.INT is deprecated (Check RFC3152). Use a packet grabber on your windows network and capture the outgoing DNS PTR query (Query Type 0x000c). Check what is being sent in the query. If the windows hosts sends a PTR query for <ipv6_address>.IP6.ARPA then your server needs to have the PTR record in IP6.ARPA

Regards
Suresh

-----Original Message-----
From: AGARWAL,SWATI (HP-FtCollins,ex1) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 3:18 PM
To: Suresh Krishnan (QB/LMC); AGARWAL,SWATI (HP-FtCollins,ex1);
[email-masked]'
Subject: RE: Reverse lookup for IPv6 on Windows

Swati

-----Original Message-----
From: Suresh Krishnan (QB/LMC) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 1:16 PM
To: 'AGARWAL,SWATI (HP-FtCollins,ex1)'; [email-masked]'
Subject: RE: Reverse lookup for IPv6 on Windows

Hi Swati,

Regards
Suresh

-----Original Message-----
From: AGARWAL,SWATI (HP-FtCollins,ex1) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 2:56 PM
To: Suresh Krishnan (QB/LMC); [email-masked]'
Subject: RE: Reverse lookup for IPv6 on Windows

WSANO_DATA
11004 

Any thoughts?

Swati

-----Original Message-----
From: Suresh Krishnan (QB/LMC) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 12:35 PM
To: 'AGARWAL,SWATI (HP-FtCollins,ex1)'; [email-masked]'
Subject: RE: Reverse lookup for IPv6 on Windows

Hi Swati,

Regards
Suresh

  SOCKADDR_IN sinDest;

  // WSAStartup blah blah 

  // WSACleanup blah blah 

-----Original Message-----
From: AGARWAL,SWATI (HP-FtCollins,ex1) [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 1:05 PM
To: [email-masked]'
Subject: Reverse lookup for IPv6 on Windows

Hello,

Swati

---

From: "AGARWAL,SWATI (HP-FtCollins,ex1)" <[email-masked]>
Date: Thu, 24 Jul 2003 16:05:56 -0400

I changed the address family to AF_INET6 adn using SOCKADDR_IN6. I got the
DNS name resolution to work.

Thank you for all your help.

Regards
Swati

-----Original Message-----
From: Matti Aarnio [mailto:[email-masked]]
Sent: Thursday, July 24, 2003 1:40 PM
To: AGARWAL,SWATI (HP-FtCollins,ex1)
Cc: 'Suresh Krishnan (QB/LMC)'; [email-masked]'
Subject: Re: Reverse lookup for IPv6 on Windows

The example code snippets are written with explite IPv4 lookups
(AF_INET), NOT for AF_INET6

Another small detail is usage of  SOCKADDR_IN,  whereas
correct one would be  SOCKADDR_IN6

(All this without having any idea of what windows API supports,
but knowing RFC API, and its UNIX incarnations.)
--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [email-masked]
--------------------------------------------------------------------