Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now if you try to use unprivileged ping (i.e. via
SOCK_DGRAM
) on the "develop" branch, it doesn't see the response packets.There are a few problems this PR fixes:
getsockname
. This change is necessary in order for it to see the ident fields line up and accept the responses.SOCK_DGRAM
for IPv4 unprivileged ping on Linux, there is nostruct ip
at the beginning of the message read byrecvmsg
. So we have to handle that situation specially. First, we need to account for the size of the missing header when logging the responses (since it is data sent/received over the wire, but it's not visible to the userspace process). Second, we need to avoid treating the start of the buffer asstruct ip
.test-11-nopriv
test will fail on Linux if the user is allowed to do unprivileged pings. We can check if the effective GID is within the range specified in the sysctlnet.ipv4.ping_group_range
and know in advance whether the ping is expected to work or not. If it is expected to work, then we should skip thetest-11-nopriv
test.