Skip to content

Userspace eBPF

Peihao Yang edited this page Feb 23, 2022 · 1 revision

Sentinel can be integrated into a userspace eBPF program, for flow control at the early stage. The eBPF part is based on redbpf.

It is recommended to install llvm-13 in advance. Because the Makefile is written with the expectation that llvm-13 is installed. Otherwise, you may change the Makefile according to your environment.

The basic idea for sentinel integration is to use eBPF map to interact with kernel eBPF probes and listen to kernel events.

Examples

  • probe: A flow control demo based on xdp. The sentinel resource is named after port:{destination_port_id}. The corresponding kernel probe and user program are implemented in examples/ebpf/probes/src/port and examples/ebpf/userspace/src. Run make ebpf_port in root directory to verify it.

Examples on other kernel events are welcomed. Currently, the redbpf supports KProbe, KRetProbe, UProbe, URetProbe, SocketFilter, XDP, StreamParser, StreamVerdict, TaskIter, SkLookup.