Solved

IOCTL fo IPv6 address  for local interface

Posted on 2007-11-26
3
1,084 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
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Run Program using VBScript 3 51
Decrypting the Zepto Virus 21 598
SignTool Error with Windows 10 5 96
Need IE 6 on Win 7 or Win 10 23 79
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now