Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

IOCTL fo IPv6 address  for local interface

Posted on 2007-11-26
3
Medium Priority
?
1,141 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

cPanel is a Unix based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilizes a 3 tier structure that provides functionality for administrators, rese…
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 …
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

609 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