标签:strong ted size_t set expec exp elf attr ems
size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn); prog_fd = bpf_load_program(BPF_PROG_TYPE_SOCKET_FILTER, prog, insns_cnt, "GPL", 0, bpf_log_buf, BPF_LOG_BUF_SIZE);
int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns, size_t insns_cnt, const char *license, __u32 kern_version, char *log_buf, size_t log_buf_sz) { struct bpf_load_program_attr load_attr; memset(&load_attr, 0, sizeof(struct bpf_load_program_attr)); load_attr.prog_type = type; load_attr.expected_attach_type = 0; load_attr.name = NULL; load_attr.insns = insns; load_attr.insns_cnt = insns_cnt; load_attr.license = license; load_attr.kern_version = kern_version; return bpf_load_program_xattr(&load_attr, log_buf, log_buf_sz); }
int load_bpf_file(char *path) { return do_load_bpf_file(path, NULL); } int load_bpf_file_fixup_map(const char *path, fixup_map_cb fixup_map) { return do_load_bpf_file(path, fixup_map); } do_load_bpf_file ret = load_and_attach(shname, data->d_buf,data->d_size); load_and_attach parses prog section and maps prog load_and_attach(const char *event, struct bpf_insn *prog, int size) load_elf_maps_section load_maps bpf_create_map_node fd = bpf_load_program(prog_type, prog, insns_cnt, license, kern_version, bpf_log_buf, BPF_LOG_BUF_SIZE);
标签:strong ted size_t set expec exp elf attr ems
原文地址:https://www.cnblogs.com/dream397/p/12222427.html