How to read UDP packet payload using netif_receive_skb tracepoint with the libbpf framework #231
Unanswered
hundredmiles
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Asked in stackover flow as well and posting it here with a hope of a faster reply
I am trying to retrieve the payload of UDP packets using tracepoint
netif_receive_skb
at the receiver. The goal is to get the packet payload and send it to userspace for further processing.Method 1
:I am navigating to the payload with the following code but, when I print and check the payload, some part of the data at the end is missing.
Method 2
:Get the payload data in the custom structure and send it out using event. But I receive the error
R8 invalid mem access 'inv'
. Here is the code snippet.:
Error from the verifier
Method 3
:Read n bytes from the kernel memory using
bpf_probe_read_kernel(data, sizeof(*custom_data), udph + 1);
retrieves only part of the data with garbage values.Am I missing any obvious steps? Any other methods using libbpf library to read udp packet payloads.
I am using kernel version
4.19
Beta Was this translation helpful? Give feedback.
All reactions