How pinoogni/ebpf-samples works
ebpf-samples is an educational collection of standalone eBPF examples, not a single application. The learner’s workflow is to choose a domain example, run its Go control plane to load and attach a kernel program, then observe counters or other results. XDP, tracepoint, kprobe, TC, program-test, and inspection examples are distinct branches. Sampled code supports specific attach and map-observation relationships; other example internals are represented by their directories because they were not sampled.
Main entry points: headers eBPF headers · example7/main.go XDP controller · example7/main.go Packet trace controller · xdp.c IPv4 counter
Components 23
Network dataplane
- XDP examples
xdp - XDP controller
xdp/example7/main.go - IPv4 counter
xdp/example7/xdp.c - XDP metrics
xdp/example8/main.go - TC examples
tc - TC dropper
tc/example3/main.go - Classic BPF filter
tc/example3_cBPF/main.go - TC experiments
tc-experiments
Kernel observation
- Tracepoint examples
tracepoint - Packet trace controller
tracepoint/example7/main.go - Packet trace programs
tracepoint/example7/tracepoint.c - Kprobe examples
kprobe
Program experiments
- BPF test-run
program_test - Program inspection
program_insights
Shared definitions
- eBPF headers
headers - Common definitions
headers/common.h - Endian helpers
headers/bpf_endian.h - Tracing helpers
headers/bpf_tracing.h - Helper definitions
headers/bpf_helper_defs.h - Kernel BTF types
vmlinux/vmlinux.h
Other components
- Learner
- Linux kernel
- Prometheus endpoint
Connections 24
- Learner → XDP examples: explores
- Learner → TC examples: explores
- Learner → TC experiments: explores
- Learner → Tracepoint examples: explores
- Learner → Kprobe examples: explores
- Learner → BPF test-run: explores
- Learner → Program inspection: explores
- XDP controller → IPv4 counter: loads and attaches
xdp/example7/main.go - XDP controller → Linux kernel: attaches XDP
xdp/example7/main.go - IPv4 counter → Linux kernel: counts packets
xdp/example7/xdp.c - XDP controller → IPv4 counter: reads maps
xdp/example7/main.go - XDP metrics → Linux kernel: attaches XDP
xdp/example8/main.go - XDP metrics → Prometheus endpoint: serves metrics
xdp/example8/main.go - TC dropper → Linux kernel: attaches TC filter
tc/example3/main.go - Classic BPF filter → Linux kernel: installs filter
tc/example3_cBPF/main.go - Packet trace controller → Packet trace programs: loads and attaches
tracepoint/example7/main.go - Packet trace controller → Linux kernel: attaches tracepoints
tracepoint/example7/main.go - Packet trace programs → Linux kernel: counts packets
tracepoint/example7/tracepoint.c - Packet trace controller → Packet trace programs: reads counter maps
tracepoint/example7/main.go - eBPF headers → Common definitions: provides
- eBPF headers → Endian helpers: provides
- eBPF headers → Tracing helpers: provides
- eBPF headers → Helper definitions: provides
- Kernel BTF types → Linux kernel: describes types