summaryrefslogtreecommitdiffstats
path: root/src/shared/bpf-program.h
diff options
context:
space:
mode:
authorJulia Kartseva <hex@fb.com>2022-01-22 03:50:26 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-01-22 08:48:42 +0100
commit8fe9dbb9266988235a0590f76a4e77428540f900 (patch)
treef276616e4d75f7144ba78f4c0a55ecebc4026ba1 /src/shared/bpf-program.h
parentFix journald audit logging with fields > N_IOVEC_AUDIT_FIELDS. (diff)
downloadsystemd-8fe9dbb9266988235a0590f76a4e77428540f900.tar.xz
systemd-8fe9dbb9266988235a0590f76a4e77428540f900.zip
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.
Diffstat (limited to 'src/shared/bpf-program.h')
-rw-r--r--src/shared/bpf-program.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shared/bpf-program.h b/src/shared/bpf-program.h
index e54900fa2f..b640fb9d9f 100644
--- a/src/shared/bpf-program.h
+++ b/src/shared/bpf-program.h
@@ -20,6 +20,7 @@ struct BPFProgram {
/* The loaded BPF program, if loaded */
int kernel_fd;
uint32_t prog_type;
+ char *prog_name;
/* The code of it BPF program, if known */
size_t n_instructions;
@@ -32,7 +33,7 @@ struct BPFProgram {
uint32_t attached_flags;
};
-int bpf_program_new(uint32_t prog_type, BPFProgram **ret);
+int bpf_program_new(uint32_t prog_type, const char *prog_name, BPFProgram **ret);
int bpf_program_new_from_bpffs_path(const char *path, BPFProgram **ret);
BPFProgram *bpf_program_free(BPFProgram *p);