Skip to content

Commit

Permalink
[System.Net] Replace use of obsolete SupportsIPv6 property.
Browse files Browse the repository at this point in the history
The obsolete property was always set to false. Fixes mono#6940
  • Loading branch information
alexischr committed Mar 15, 2018
1 parent 8c3d7c8 commit 803128b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 0 additions & 2 deletions mcs/class/System/System.Net/Dns.cs
Expand Up @@ -320,11 +320,9 @@ private static IPHostEntry hostent_to_IPHostEntry(string originalHostName, strin
try {
IPAddress newAddress = IPAddress.Parse(h_addrlist[i]);

#pragma warning disable 618
if( (Socket.SupportsIPv6 && newAddress.AddressFamily == AddressFamily.InterNetworkV6) ||
(Socket.SupportsIPv4 && newAddress.AddressFamily == AddressFamily.InterNetwork) )
addrlist.Add(newAddress);
#pragma warning restore 618
} catch (ArgumentNullException) {
/* Ignore this, as the
* internal call might have
Expand Down
6 changes: 6 additions & 0 deletions mcs/class/System/Test/System.Net/DnsTest.cs
Expand Up @@ -209,6 +209,12 @@ public void GetHostAddresses_HostNameOrAddress_UnspecifiedAddress ()
}
}

[Test]
public void GetHostAddresses_IPv6 ()
{
var address = Dns.GetHostAddresses("ipv6.google.com");
}

[Test]
public void GetHostName ()
{
Expand Down
6 changes: 0 additions & 6 deletions mcs/class/System/Test/System.Net/IPAddressTest.cs
Expand Up @@ -241,9 +241,6 @@ public void IsLoopbackV4 ()
[Test]
public void IsLoopbackV6 ()
{
// if (!Socket.SupportsIPv6)
// Assert.Ignore ("IPv6 must be enabled in machine.config");

IPAddress ip = IPAddress.IPv6Loopback;
Assert.IsTrue (IPAddress.IsLoopback (ip), "#1");

Expand Down Expand Up @@ -612,9 +609,6 @@ public void IsIPv6Teredo ()
[Test]
public void ParseWrongV6 ()
{
//if (!Socket.SupportsIPv6)
// Assert.Ignore ("IPv6 must be enabled in machine.config");

for (int i = 0; i < ipv6ParseWrong.Length; i++) {
string ipAddress = ipv6ParseWrong [i];

Expand Down
Expand Up @@ -318,7 +318,7 @@ private static IPHostEntry GetLocalHost()
// old IPv4 gethostbyname(null). Instead we need
// to do a more complete lookup.
//
if (Socket.SupportsIPv6)
if (Socket.OSSupportsIPv6)
{
//
// IPv6 enabled: use getaddrinfo() of the local host name
Expand Down

0 comments on commit 803128b

Please sign in to comment.