-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use unprivileged socket to send ping on macOS/iOS/tvOS/Mac Catalyst #52240
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsRevival 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). It adds new macOS/iOS/tvOS targets for the assembly that exclude the process creation code. cc: @wfurt @marek-safar
|
Co-authored-by: Tomas Weinfurt <tweinfurt@yahoo.com>
src/libraries/System.Net.Ping/tests/FunctionalTests/System.Net.Ping.Functional.Tests.csproj
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs
Show resolved
Hide resolved
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs
Outdated
Show resolved
Hide resolved
{ | ||
int ipHeaderLength = socketConfig.IsIpv4 ? MinIpHeaderLengthInBytes : 0; | ||
|
||
await socket.SendToAsync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this pass the timeout in too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It passes the timeout to the socket options which should apply here.
src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks for dragging this to completion @filipnavara
I was not sure if we want to give up ping utility on OSX and if the capability to for example send custom patterns is equivalent. But having it consistent on top of sockets is nice.
runtime-libraries-coreclr outerloop-linux |
/azp run runtime-libraries-coreclr outerloop-linux |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-libraries-coreclr outerloop-osx |
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/System.Net.Ping/tests/FunctionalTests/System.Net.Ping.Functional.Tests.csproj
Outdated
Show resolved
Hide resolved
The outerloop tests on a950b48 were good, just unrelated failures: https://dev.azure.com/dnceng/public/_build/results?buildId=1126913&view=results Merging :) |
ref: dotnet/runtime#41355 Unlike what we have today for legacy support for Ping was added in dotnet/runtime#52240
ref: dotnet/runtime#41355 Unlike what we have today for legacy support for Ping was added in dotnet/runtime#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).
It adds new macOS/iOS/tvOS targets for the assembly that exclude the process creation code.
Fixes #36941
Fixes #51395
cc: @wfurt @marek-safar