|
34 | 34 | #include <linux/if_ether.h> |
35 | 35 |
|
36 | 36 | #include <bpf/bpf.h> |
| 37 | +#include <bpf/libbpf.h> |
37 | 38 |
|
38 | 39 | #ifdef HAVE_GENHDR |
39 | 40 | # include "autoconf.h" |
|
59 | 60 |
|
60 | 61 | #define UNPRIV_SYSCTL "kernel/unprivileged_bpf_disabled" |
61 | 62 | static bool unpriv_disabled = false; |
| 63 | +static int skips; |
62 | 64 |
|
63 | 65 | struct bpf_test { |
64 | 66 | const char *descr; |
@@ -598,6 +600,11 @@ static void do_test_single(struct bpf_test *test, bool unpriv, |
598 | 600 | pflags |= BPF_F_ANY_ALIGNMENT; |
599 | 601 | fd_prog = bpf_verify_program(prog_type, prog, prog_len, pflags, |
600 | 602 | "GPL", 0, bpf_vlog, sizeof(bpf_vlog), 1); |
| 603 | + if (fd_prog < 0 && !bpf_probe_prog_type(prog_type, 0)) { |
| 604 | + printf("SKIP (unsupported program type %d)\n", prog_type); |
| 605 | + skips++; |
| 606 | + goto close_fds; |
| 607 | + } |
601 | 608 |
|
602 | 609 | expected_ret = unpriv && test->result_unpriv != UNDEF ? |
603 | 610 | test->result_unpriv : test->result; |
@@ -751,7 +758,7 @@ static bool test_as_unpriv(struct bpf_test *test) |
751 | 758 |
|
752 | 759 | static int do_test(bool unpriv, unsigned int from, unsigned int to) |
753 | 760 | { |
754 | | - int i, passes = 0, errors = 0, skips = 0; |
| 761 | + int i, passes = 0, errors = 0; |
755 | 762 |
|
756 | 763 | for (i = from; i < to; i++) { |
757 | 764 | struct bpf_test *test = &tests[i]; |
|
0 commit comments