Skip to content
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

Ping does not work on iOS devices #36941

Closed
wfurt opened this issue May 24, 2020 · 1 comment · Fixed by #52240
Closed

Ping does not work on iOS devices #36941

wfurt opened this issue May 24, 2020 · 1 comment · Fixed by #52240
Labels
area-System.Net enhancement Product code improvement that does NOT require public API changes/additions help wanted [up-for-grabs] Good issue for external contributors os-ios Apple iOS
Milestone

Comments

@wfurt
Copy link
Member

wfurt commented May 24, 2020

Description

This is fragment of #36890. When Ping is executed on non-windows platforms as ordinary user, it will try to start system ping utility as separate process. That will not work on various mobile devices.

Configuration

I was able to reproduce this on iPhone X simulator with 13.4 iOS. This is generally applicable to all .NET versions.

Regression?

no.

Other information

@mandel-macaque kindly pointed at Apple's example https://developer.apple.com/library/archive/samplecode/SimplePing/Introduction/Intro.html
as well as Mono has working implementation.

It turns out, OSX can use socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP) and socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6) without privilege in way similar to RAW sockets. That would allow us to have full featured ping without all the troubles we had in the past with ping6 on OSX and it would avoid spawning new process. As well as this would be portable to mobile devices.

Sure enough, ping utility on OSX is not SUID as it is on Linux.

Shining:src furt$ ls -al /sbin/ping
-r-xr-xr-x  1 root  wheel  55216 Jan 23 05:59 /sbin/ping

vs Linux

root@vps2001:~# ls -al /bin/ping
-rwsr-xr-x 1 root root 61240 Nov 10  2016 /bin/ping
@wfurt wfurt added area-System.Net os-mac-os-x macOS aka OSX help wanted [up-for-grabs] Good issue for external contributors os-ios Apple iOS labels May 24, 2020
@ghost
Copy link

ghost commented May 24, 2020

Tagging subscribers to this area: @dotnet/ncl
Notify danmosemsft if you want to be subscribed.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label May 24, 2020
@marek-safar marek-safar added this to the 6.0.0 milestone Jun 24, 2020
@marek-safar marek-safar removed os-mac-os-x macOS aka OSX untriaged New issue has not been triaged by the area owner labels Jun 24, 2020
@karelz karelz added the enhancement Product code improvement that does NOT require public API changes/additions label Apr 23, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label May 4, 2021
akoeplinger pushed a commit that referenced this issue May 7, 2021
…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 <[email protected]>
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label May 7, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net enhancement Product code improvement that does NOT require public API changes/additions help wanted [up-for-grabs] Good issue for external contributors os-ios Apple iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants