libxdp: Allow creation of xsk with exclusive umem without CAP_NET_RAW #338
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.
Adding a new API xsk_umem__create_with_fd() that accepts an extra file descriptor of already open AF_XDP socket. This function can be used as a substitute of a regular xsk_umem__create() in case where process doesn't have CAP_NET_RAW privileges. Privileged process may open a socket beforehand and send the file descriptor via UNIX domain socket or pass it during exec(). Subsequent xsk_socket__create() will re-use this socket. No other operations require privileges in case the program load is inhibited.
This change allows use of AF_XDP with libxdp by processes with no extra privileges.
xsk_socket__create_shared() requires opening a new socket for each queue after the first one, so it will require more work in order to create a pretty API. Not doing that right now. The target use-case is AF_XDP network backend in QEMU that doesn't need shared umem, but requires running without any privileges.