]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/bpf-firewall.c
bpf: name unnamed bpf programs
authorJulia Kartseva <hex@fb.com>
Sat, 22 Jan 2022 02:50:26 +0000 (18:50 -0800)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 22 Jan 2022 07:48:42 +0000 (16:48 +0900)
commit8fe9dbb9266988235a0590f76a4e77428540f900
treef276616e4d75f7144ba78f4c0a55ecebc4026ba1
parentdf4ec48f45f518b6926e02ef4d77c8ed1a8b4e2c
bpf: name unnamed bpf programs

bpf-firewall and bpf-devices do not have names. This complicates
debugging with bpftool(8).

Assign names starting with 'sd_' prefix:
* firewall program names are 'sd_fw_ingress' for ingress attach
point and 'sd_fw_egress' for egress.
* 'sd_devices' for devices prog

'sd_' prefix is already used in source-compiled programs, e.g.
sd_restrictif_i, sd_restrictif_e, sd_bind6.

The name must not be longer than 15 characters or BPF_OBJ_NAME_LEN - 1.

Assign names only to programs loaded to kernel by systemd since
programs pinned to bpffs are already loaded.
src/core/bpf-devices.c
src/core/bpf-firewall.c
src/shared/bpf-program.c
src/shared/bpf-program.h
src/test/test-bpf-firewall.c
src/test/test-bpf-foreign-programs.c