History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Alexei Starovoitov says: ==================== pull-request: bpf-next 2021-12-30 The following pull-request contains BPF updates for your *net-next* tree. We've added 72 non-merge commits during the last 20 day(s) which contain a total of 223 files changed, 3510 insertions(+), 1591 deletions(-). The main changes are: 1) Automatic setrlimit in libbpf when bpf is memcg's in the kernel, from Andrii. 2) Beautify and de-verbose verifier logs, from Christy. 3) Composable verifier types, from Hao. 4) bpf_strncmp helper, from Hou. 5) bpf.h header dependency cleanup, from Jakub. 6) get_func_[arg|ret|arg_cnt] helpers, from Jiri. 7) Sleepable local storage, from KP. 8) Extend kfunc with PTR_TO_CTX, PTR_TO_MEM argument support, from Kumar. ====================

David S. Miller committed 4 years ago

Commit e63a0232 parents ce2b6eb 9e6b19a221 files · +3506 −1591Browse files

Showing the changes to samples (2 of 221 files). Show all

Unified · Split

2 files
  1. samples/bpf/hbm.c +10 −1
  2. samples/bpf/xdp_fwd_user.c +10 −2
samples/bpf/hbm.c+10−1
@@ -120,6 +120,9 @@ static void do_error(char *msg, bool errno_flag) · 119 unmodified lines
120120
121121 static int prog_load(char *prog)
122122 {
123+ struct bpf_program *pos;
124+ const char *sec_name;
125+
123126 obj = bpf_object__open_file(prog, NULL);
124127 if (libbpf_get_error(obj)) {
125128 printf("ERROR: opening BPF object file failed\n");
@@ -132,7 +135,13 @@ static int prog_load(char *prog) · 6 unmodified lines
132135 goto err;
133136 }
134137
135− bpf_prog = bpf_object__find_program_by_title(obj, "cgroup_skb/egress");
138+ bpf_object__for_each_program(pos, obj) {
139+ sec_name = bpf_program__section_name(pos);
140+ if (sec_name && !strcmp(sec_name, "cgroup_skb/egress")) {
141+ bpf_prog = pos;
142+ break;
143+ }
144+ }
136145 if (!bpf_prog) {
137146 printf("ERROR: finding a prog in obj file failed\n");
138147 goto err;
samples/bpf/xdp_fwd_user.c+10−2
@@ -79,7 +79,9 @@ int main(int argc, char **argv) · 78 unmodified lines
7979 .prog_type = BPF_PROG_TYPE_XDP,
8080 };
8181 const char *prog_name = "xdp_fwd";
82− struct bpf_program *prog;
82+ struct bpf_program *prog = NULL;
83+ struct bpf_program *pos;
84+ const char *sec_name;
8385 int prog_fd, map_fd = -1;
8486 char filename[PATH_MAX];
8587 struct bpf_object *obj;
@@ -134,7 +136,13 @@ int main(int argc, char **argv) · 48 unmodified lines
134136 return 1;
135137 }
136138
137− prog = bpf_object__find_program_by_title(obj, prog_name);
139+ bpf_object__for_each_program(pos, obj) {
140+ sec_name = bpf_program__section_name(pos);
141+ if (sec_name && !strcmp(sec_name, prog_name)) {
142+ prog = pos;
143+ break;
144+ }
145+ }
138146 prog_fd = bpf_program__fd(prog);
139147 if (prog_fd < 0) {
140148 printf("program not found: %s\n", strerror(prog_fd));