Solved

IOCTL fo IPv6 address  for local interface

Posted on 2007-11-26
3
1,133 Views
Last Modified: 2009-01-11
I am getting the local interface IP address using following code:

IPAddrEntry *ipaddrentry;
TCP_REQUEST_QUERY_INFORMATION_EX req;

req.ID.toi_entity.tei_entity = GENERIC_ENTITY;
req.ID.toi_entity.tei_instance = 0;
req.ID.toi_class = INFO_CLASS_GENERIC;
req.ID.toi_type = INFO_TYPE_PROVIDER;
req.ID.toi_id = IP_MIB_ADDRTABLE_ENTRY_ID;



if( !DeviceIoControl( TCPDriverHandle, // Handle to TCP driver
IOCTL_TCP_QUERY_INFORMATION_EX, // Cmd code
&req, // Pointer to input buffer
sizeof(req), // Size of ipt buffer
ipaddrentry, // Ptr to output buffer
bufferLen, // Size of output buffer
&arrayLen, // Actual size of array
NULL ) )

This code only fetches the IPv4 address.

I am looking for a way to determine:

Whether IPv6 is enabled on that interface
and if so, then get the IPv6 address in the similar way.
0
Comment
Question by:devkathuria
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 20351427
You'd just use the IP Helper API (http://msdn2.microsoft.com/en-us/library/aa366073.aspx) for that purpose and 'GetAdaptersAddresses()' (http://msdn2.microsoft.com/en-us/library/aa365915.aspx) in particular, e.g.

IP_ADAPTER_ADDRESSES iaa;
ULONG ulSize;

ULONG ulRes = GetAdaptersAddresses(AF_INET6,0,&iaa,&ulSize);

If IPv6 is not enabled, you'll get an error indicating that.

See also http://msdn2.microsoft.com/en-us/library/aa365819.aspx ("Complete IP Helper Application Source Code")
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question