Use unprivileged socket to send ping on macOS/iOS/tvOS/Mac Catalyst (#52240)
authorFilip Navara <navara@emclient.com>
Fri, 7 May 2021 14:05:11 +0000 (16:05 +0200)
committerGitHub <noreply@github.com>
Fri, 7 May 2021 14:05:11 +0000 (16:05 +0200)
commite98614ea1911eb2b0fca2c4748be410ba470733f
tree3824563b60206b6bd8ce9ecbd785b5cbc2da6a78
parent594e87a26e098034639c06bb7bd61b7346780abb
Use unprivileged socket to send ping on macOS/iOS/tvOS/Mac Catalyst (#52240)

Revival of #42006 with some feedback incorporated.

This improves Ping behavior on macOS/iOS family. For unprivileged users, it allows to send/receive buffer with custom content and removes craft around spawning new process. (uses [this example](https://developer.apple.com/library/archive/samplecode/SimplePing/Introduction/Intro.html)).

It adds new macOS/iOS/tvOS targets for the assembly that exclude the process creation code.

Fixes #36941
Fixes #51395

Co-authored-by: Tomas Weinfurt <tweinfurt@yahoo.com>
src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs
src/libraries/System.Net.Ping/src/System.Net.Ping.csproj
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.OSX.cs [new file with mode: 0644]
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.PingUtility.cs [new file with mode: 0644]
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs [new file with mode: 0644]
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Unix.cs
src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs
src/libraries/System.Net.Ping/tests/FunctionalTests/UnixPingUtilityTests.cs