We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug and how to reproduce
Run the following program. (Please change InterfaceIndex to proper value below)
static void Main(string[] args) { InitializeIpForwardEntry(out var route); route.InterfaceIndex = 6; route.DestinationPrefix.Prefix.Ipv6.sin6_family = Ws2_32.ADDRESS_FAMILY.AF_INET6; route.DestinationPrefix.Prefix.Ipv6.sin6_addr = new Ws2_32.IN6_ADDR(IPAddress.Parse("2404:6800:4004:801::2003").GetAddressBytes()); route.DestinationPrefix.PrefixLength = 128; route.NextHop.Ipv6.sin6_family = Ws2_32.ADDRESS_FAMILY.AF_INET6; route.NextHop.Ipv6.sin6_addr = new Ws2_32.IN6_ADDR(IPAddress.Parse("fe80::1").GetAddressBytes()); route.SitePrefixLength = 128; route.Metric = 0; route.Protocol = IpHlpApi.MIB_IPFORWARD_PROTO.MIB_IPPROTO_NETMGMT; route.Loopback = false; route.AutoconfigureAddress = false; route.Publish = false; route.Immortal = false; CreateIpForwardEntry2(ref route); }
Then NextHop and RouteMetric of the route are wrong values.
> Get-NetRoute -DestinationPrefix 2404:6800:4004:801::2003/128 ifIndex DestinationPrefix NextHop RouteMetric ifMetric PolicyStore ------- ----------------- ------- ----------- -------- ----------- 6 2404:6800:4004:801::2003/128 :: 3 45 ActiveStore
What code is involved
I suppose structure size (= 30) of IP_ADDRESS_PREFIX is wrong.
IP_ADDRESS_PREFIX
Vanara/PInvoke/IpHlpApi/NetIOApi.cs
Lines 5850 to 5851 in 91490dc
The value 32 seems correct according to C++ sizeof() output.
sizeof()
[StructLayout(LayoutKind.Sequential, Pack = 4, Size = 32)] public struct IP_ADDRESS_PREFIX : IEquatable<IP_ADDRESS_PREFIX>
Expected behavior
With Size = 32, NextHop and Mertic will be the correct values.
Size = 32
> Get-NetRoute -DestinationPrefix 2404:6800:4004:801::2003/128 ifIndex DestinationPrefix NextHop RouteMetric ifMetric PolicyStore ------- ----------------- ------- ----------- -------- ----------- 6 2404:6800:4004:801::2003/128 fe80::1 0 45 ActiveStore
The text was updated successfully, but these errors were encountered:
Applied suggested fix for IP_ADDRESS_PREFIX (#405)
f10080d
No branches or pull requests
Describe the bug and how to reproduce
Run the following program.
(Please change InterfaceIndex to proper value below)
Then NextHop and RouteMetric of the route are wrong values.
What code is involved
I suppose structure size (= 30) of
IP_ADDRESS_PREFIX
is wrong.Vanara/PInvoke/IpHlpApi/NetIOApi.cs
Lines 5850 to 5851 in 91490dc
The value 32 seems correct according to C++
sizeof()
output.Expected behavior
With
Size = 32
, NextHop and Mertic will be the correct values.The text was updated successfully, but these errors were encountered: