Fixed #297 - Incorrect value for `Ws2_32.IN6_ADDR.Loopback`

pull/299/head
dahall 2022-05-04 11:22:32 -06:00
parent fb607a799e
commit 92e7ca7365
2 changed files with 11 additions and 4 deletions

View File

@ -1405,11 +1405,11 @@ namespace Vanara.PInvoke
private ulong lower;
private ulong upper;
/// <summary>The IPv6 standard loopback address.</summary>
public static readonly IN6_ADDR Loopback = new IN6_ADDR { lower = 0xff_01_00_00_00_00_00_00, upper = 0x00_00_00_00_00_00_00_01 };
/// <summary>The IPv6 standard loopback address (<c>IN6ADDR_LOOPBACK_INIT</c>).</summary>
public static readonly IN6_ADDR Loopback = new(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 });
/// <summary>The IPv6 standard unspecified address.</summary>
public static readonly IN6_ADDR Unspecified = new IN6_ADDR { lower = 0, upper = 0 };
/// <summary>The IPv6 standard unspecified address (<c>IN6ADDR_ANY_INIT</c>).</summary>
public static readonly IN6_ADDR Unspecified = new();
/// <summary>Initializes a new instance of the <see cref="IN6_ADDR"/> struct.</summary>
/// <param name="v6addr">The IPv6 address as an array of bytes.</param>

View File

@ -20,6 +20,13 @@ namespace Vanara.PInvoke.Tests
public static IPAddress localIP4 => Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork);
[Test]
public void ConstTest()
{
Assert.That(new IPAddress(IN6_ADDR.Unspecified).ToString(), Is.EqualTo("::"));
Assert.That(new IPAddress(IN6_ADDR.Loopback).ToString(), Is.EqualTo("::1"));
}
[Test]
public void gai_strerrorTest()
{