Getting prefix length for IPv6 interface address?
From: bbmsdn (bbmsdn_at_discussions.microsoft.com)
Date: 02/21/05
- Next message: Rhett Gong [MSFT]: "Re: GetIfTable doesn't return disabled adapters, how else?"
- Previous message: Adam: "Re: GetIfTable doesn't return disabled adapters, how else?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 20 Feb 2005 20:45:01 -0800
What is the correct way to get the prefix length for an IPv6 interface? I'm
using GetAdaptersAddresses to get the interface addresses and I thought I
could use the same relative position in the FirstPrefix list (e.g. 2nd entry
in FirstUnicastAddresses would map to the 2nd entry in FirstPrefix). This
works most of the time, but there are cases when it fails. For example,
immediately after I get notified of an interface list change
(FD_ADDRESS_LIST_CHANGE), I sometimes get the wrong prefix entry (e.g. 2nd
entry in FirstUnicastAddresses is IPv6, but 2nd entry in FirstPrefix is
IPv4). If I delay for a few seconds after FD_ADDRESS_LIST_CHANGE and before
calling GetAdaptersAddresses, it seems to work, but that's a little hack-ish.
Is my general approach correct? If so, is there something better than Sleep(
3000 ) to workaround the FirstUnicastAddress and FirstPrefix lists being
out-of-sync?
BTW...The way I'm reproducing this to manually set my IP to 169.254.x.x then
switch it back to DHCP. When I do this and immediately call
GetAdaptersAddresses after the FD_ADDRESS_LIST_CHANGE event is signaled, I
see the out-of-sync FirstPrefix list.
- Next message: Rhett Gong [MSFT]: "Re: GetIfTable doesn't return disabled adapters, how else?"
- Previous message: Adam: "Re: GetIfTable doesn't return disabled adapters, how else?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|