Questions tagged [xdp-ebpf]

12 questions
3
votes
1 answer

Thread safe operations on XDP

I was able to confirm from the documentation that bpf_map_update_elem is an atomic operation if done on HASH_MAPs. Source (https://man7.org/linux/man-pages/man2/bpf.2.html). [Cite: map_update_elem() replaces existing elements atomically] My question…
Rishab
  • 73
  • 4
1
vote
2 answers

kernel compilation error when CONFIG_DEBUG_INFO_BTF is enabled

FAILED: load BTF from vmlinux: No such file or directory make: *** [Makefile:1164: vmlinux] Error 255 make: *** Deleting file 'vmlinux' root@akb:/home/akb/SRC/net/net-next# I have to enable BTF for my BPF xdp program to work. Environment :on…
1
vote
1 answer

Unable to fetch data using bpf_map_lookup_elem()

I am trying to write a code for XDP where a user space program will populate a bpf map and then later the Kernel will look into the map. For creating the map I have added a SEC(".maps") in the bpf_obj file that will get loaded into the kernel.…
Rishab
  • 73
  • 4
1
vote
1 answer

Multiple ebpf hooks cgroup_skb

I have basic question on ebpf behavior when multiple ebpf hooks are loaded(not using chaining) simultaneously in kernel. Are all of those hooks invoked? For example, I loaded my ebpf program which has cgroup_skb/ingress hook. The ebpf hooks…
0
votes
1 answer

pass by value not supported XDP

I am creating a function to loop through some loops and try to match a set. It is supposed to work fine, but unfortunately, it is not. I get a "pass by value not supported" error. How can I fix this? int matchSet(Program p, int match[], int…
Fabian
  • 24
  • 4
0
votes
1 answer

How do I copy data to buffer in eBPF?

I'm wanting to store the packets' payload to my custom buffer in eBPF & XDP hook. But I can't pass the verifier. I learned others' code found no difference. In the code, I checked the length of payload should be less than MTU, which is 1500 in my…
0
votes
1 answer

How to generate delay using eBPF kernel program

I'm trying to generate delay in acknowledgement using eBPF kernel program for egress packet. I'm running the python+c program using bcc. i tried mdelay/msleep/udelay etc functions with delay.h library in c, it gives me LLVM error that "Program using…
0
votes
1 answer

ebpf verifier fails for bpf_csum_diff()

Not able to understand why the following code fails verifier. I am doing all possible validations in this test function. { if (tcph + 1 > data_end) return XDP_DROP; tcp_len = tcph->doff * 4; if (tcp_len < sizeof(*tcph)) …
0
votes
1 answer

Sending custom data to socket using eBPF

I'm trying, finally, to understand eBPF and maybe use it in an upcoming project. For sake of simplicity I started with reading bcc documentation. In my project I'll need to send some data over network upon some kernel function calls. Can that be…
David
  • 182
  • 1
  • 1
  • 8
0
votes
0 answers

How to parse through bytes in a packets without using helper headers with XDP in C?

I am new to using XDP and trying to teach myself how to create ELF programs to do a variety of XDP actions. I am also a beginner to using C. How can I parse through packets to show data from specific bytes in the data without using helper headers…
Dave
  • 727
  • 1
  • 9
  • 20
0
votes
0 answers

Update destination port with bcc and xdp

I am running an application in port 80 in a container. Now I want to call it by using port 90 and xdp will change the port from 90 to 80. But for some reason, I am getting any response or server is not getting any call either. Here is my ebf…
Omar Faroque Anik
  • 2,531
  • 1
  • 29
  • 42
0
votes
0 answers

xdp_md->egress_ifindex not found | XDP Ebpf

So I have this code in my ebpf program and so on my system struct xdp_md does exists. struct xdp_md { __u32 data; __u32 data_end; __u32 data_meta; /* Below access go through struct xdp_rxq_info */ __u32 ingress_ifindex; /*…
user786
  • 3,902
  • 4
  • 40
  • 72