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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenric Müller <hemuller@microsoft.com>2017-01-17 18:14:26 +0300
committerHenric Müller <hemuller@microsoft.com>2017-01-25 18:34:09 +0300
commit65b7f542d622dc59ce43d9fd84dc88b8dcc7f296 (patch)
treeb8458fbe64c7d4983439c355041f7486ebf5b70c /mcs/class/System/System.Net.NetworkInformation/Ping.cs
parentfd830218048a4074b6e0e2e731fdb94342fb410b (diff)
Fixing tests that asume IPV4 when first adapter is IPV6
Diffstat (limited to 'mcs/class/System/System.Net.NetworkInformation/Ping.cs')
-rw-r--r--mcs/class/System/System.Net.NetworkInformation/Ping.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/mcs/class/System/System.Net.NetworkInformation/Ping.cs b/mcs/class/System/System.Net.NetworkInformation/Ping.cs
index 1d2786002e1..90d0e3a59ca 100644
--- a/mcs/class/System/System.Net.NetworkInformation/Ping.cs
+++ b/mcs/class/System/System.Net.NetworkInformation/Ping.cs
@@ -207,11 +207,11 @@ namespace System.Net.NetworkInformation {
return Send (addresses [0], timeout, buffer, options);
}
- static IPAddress GetNonLoopbackIP ()
+ static IPAddress GetNonLoopbackIPV4 ()
{
#pragma warning disable 618
foreach (IPAddress addr in Dns.GetHostByName (Dns.GetHostName ()).AddressList)
- if (!IPAddress.IsLoopback (addr))
+ if (!IPAddress.IsLoopback (addr) && addr.AddressFamily == AddressFamily.InterNetwork)
return addr;
#pragma warning restore 618
@@ -243,7 +243,7 @@ namespace System.Net.NetworkInformation {
private PingReply SendPrivileged (IPAddress address, int timeout, byte [] buffer, PingOptions options)
{
IPEndPoint target = new IPEndPoint (address, 0);
- IPEndPoint client = new IPEndPoint (GetNonLoopbackIP (), 0);
+ IPEndPoint client = new IPEndPoint (GetNonLoopbackIPV4 (), 0);
// FIXME: support IPv6
using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp)) {