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.
This commit is contained in:
committed by
Yu Watanabe
parent
df4ec48f45
commit
8fe9dbb926
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user