]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
selftests/bpf: Use libbpf_attach_type_by_name in test_socket_cookie
authorAndrey Ignatov <rdna@fb.com>
Wed, 26 Sep 2018 22:24:56 +0000 (15:24 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 27 Sep 2018 19:14:59 +0000 (21:14 +0200)
Use newly introduced libbpf_attach_type_by_name in test_socket_cookie
selftest.

Signed-off-by: Andrey Ignatov <rdna@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/test_socket_cookie.c

index 68e108e4687a9908845882f649fe1c62ee3f35da..b6c2c605d8c050794cef847c73f779e40378b0ab 100644 (file)
@@ -158,11 +158,7 @@ static int run_test(int cgfd)
        bpf_object__for_each_program(prog, pobj) {
                prog_name = bpf_program__title(prog, /*needs_copy*/ false);
 
-               if (strcmp(prog_name, "cgroup/connect6") == 0) {
-                       attach_type = BPF_CGROUP_INET6_CONNECT;
-               } else if (strcmp(prog_name, "sockops") == 0) {
-                       attach_type = BPF_CGROUP_SOCK_OPS;
-               } else {
+               if (libbpf_attach_type_by_name(prog_name, &attach_type)) {
                        log_err("Unexpected prog: %s", prog_name);
                        goto err;
                }