?
Solved

IOCTL fo IPv6 address  for local interface

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

765 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