Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2021-02-19 23:35:51 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2021-02-19 23:35:51 +0300
commitf57dab4729377040840c42723debe0be34bc48cc (patch)
treec7701ad5eec90615a1da7d2f163391c4410c7eb3
parentd40c6ddc817cf6a79aadf4247b091bd066cbd760 (diff)
Only use IPv6 if available
-rw-r--r--src/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs4
-rw-r--r--src/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs4
-rw-r--r--src/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs b/src/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs
index e140430c2d..cef721fc25 100644
--- a/src/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs
+++ b/src/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs
@@ -43,7 +43,7 @@ namespace System.Net.Security.Tests
[InlineData(true)]
public async Task CertificateValidationClientServer_EndToEnd_Ok(bool useClientSelectionCallback)
{
- IPEndPoint endPoint = new IPEndPoint(IPAddress.IPv6Loopback, 0);
+ IPEndPoint endPoint = new IPEndPoint(Socket.OSSupportsIPv6 ? IPAddress.IPv6Loopback : IPAddress.Loopback, 0);
var server = new TcpListener(endPoint);
server.Start();
@@ -63,7 +63,7 @@ namespace System.Net.Security.Tests
_clientCertificateRemovedByFilter = true;
}
- using (var clientConnection = new TcpClient(AddressFamily.InterNetworkV6))
+ using (var clientConnection = new TcpClient(Socket.OSSupportsIPv6 ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork))
{
IPEndPoint serverEndPoint = (IPEndPoint)server.LocalEndpoint;
diff --git a/src/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs b/src/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs
index 50f37d2169..dd48a96d3b 100644
--- a/src/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs
+++ b/src/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs
@@ -150,10 +150,10 @@ namespace System.Net.Security.Tests
{
_log.WriteLine("Server: " + serverSslProtocols + "; Client: " + clientSslProtocols);
- IPEndPoint endPoint = new IPEndPoint(IPAddress.IPv6Loopback, 0);
+ IPEndPoint endPoint = new IPEndPoint(Socket.OSSupportsIPv6 ? IPAddress.IPv6Loopback : IPAddress.Loopback, 0);
using (var server = new DummyTcpServer(endPoint, encryptionPolicy))
- using (var client = new TcpClient(AddressFamily.InterNetworkV6))
+ using (var client = new TcpClient(Socket.OSSupportsIPv6 ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork))
{
server.SslProtocols = serverSslProtocols;
await client.ConnectAsync(server.RemoteEndPoint.Address, server.RemoteEndPoint.Port);
diff --git a/src/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs b/src/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs
index 68e845e56c..c45c488f0f 100644
--- a/src/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs
+++ b/src/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs
@@ -107,11 +107,11 @@ namespace System.Net.Security.Tests
int timeOut = expectedToFail ? TestConfiguration.FailingTestTimeoutMiliseconds
: TestConfiguration.PassingTestTimeoutMilliseconds;
- IPEndPoint endPoint = new IPEndPoint(IPAddress.IPv6Loopback, 0);
+ IPEndPoint endPoint = new IPEndPoint(Socket.OSSupportsIPv6 ? IPAddress.IPv6Loopback : IPAddress.Loopback, 0);
var server = new TcpListener(endPoint);
server.Start();
- using (var clientConnection = new TcpClient(AddressFamily.InterNetworkV6))
+ using (var clientConnection = new TcpClient(Socket.OSSupportsIPv6 ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork))
{
IPEndPoint serverEndPoint = (IPEndPoint)server.LocalEndpoint;