-
Notifications
You must be signed in to change notification settings - Fork 19
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
Do not use RAW socket on Unix to allows unprivileged user usage #4
Conversation
On Unix platforms, SOCK_RAW usage is reserved privileged users. Fix "Operation not permitted" error on Linux and macOS.
Seems the tests failed on macOS without
|
That's odd I cannot reproduce on my M1 🤔 |
I can't reproduce the failure either on my M1 MacBook Pro. However, the tests fail on Test output on this PR$ git branch --show-current
fix-unprivileges-unix
$ cargo test
Finished test [unoptimized + debuginfo] target(s) in 0.03s
Running unittests (target/debug/deps/ping-4694b3d763dc3029)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/tests.rs (target/debug/deps/tests-cbf954419b14fb70)
running 1 test
test basic ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests ping
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s Test output on master
OS info
|
I'm using a intel mac book with big sur:
So this is a OS specified issue? But the tests won't passed on Linux too (Arch OS with latest kernel version which I have forgoten...) |
MacOS m1 |
I have test this MR on my linux (arch) box, and it not works. According to https://stackoverflow.com/a/20105379 , the unprivilege icmp package is not works out of box on linux. I think we should add a option or a new function to use the unprivileged ping. |
I see. I tried this change on macOS and it worked. I'll try testing it on Linux if I can get my hands on one. |
I have new idea, we should keep both the privileged / unprivileged implementations for specified usage. And a basic ping function as a alias to the new Is this implemented in #11 , does anyone have suggestions? |
I think that's a great idea, will close this 👍 |
I guess this is why I have to set |
On Unix platforms, SOCK_RAW usage is reserved to privileged users.
Fix "Operation not permitted" error on Linux and macOS.