mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
The aggregation maps may become full, in which case the BPF programs will fail to create new entries for any IP-prefixes not currently in the map. This would previously result in stats from traffic that cannot fit into any aggregation entry to be missed. Add a fallback entry for each map, so that in case the aggregation map is full stats from any new IP-prefix will be added to this fallback entry instead. The fallback entry is reported as 0.0.0.0/0 (for IPv4) or ::/0 (for IPv6) in the output. Note that this is implemented by adding specific "magic values" as special keys in the aggregation maps (see IPV{4,6}_BACKUP_KEY in pping.h). These special keys have been selected so that no real traffic should collide with them by using prefixes from blocks reserved for documentation. Furthermore, these entries are added by the user space program AFTER the BPF programs are attached (as it's not possible to do it in-between loading and attaching when using libxdp). In case the BPF programs manage to fill the maps before the user space component can create the backup entries, it will fail and abort the program. Signed-off-by: Simon Sundberg <simon.sundberg@kau.se>
Practical BPF examples
This git repository contains a diverse set of practical BPF examples that solve (or demonstrate) a specific use-case using BPF.
It is meant to ease doing rapid prototyping and development, writing C-code BPF programs using libbpf. The goal is to make it easier for developers to get started coding.
Many developers struggle to get a working BPF build environment. The repo enviroment makes it easy to build/compile BPF programs by doing the necessary libbpf setup transparently and detect missing compile dependencies (via the configure script). It is a declared goal to make BPF programming more consumable by detecting and reporting issues (when possible).
Description
Languages
C
93.6%
Shell
4.7%
Makefile
1.6%