diff --git a/bpf_linux.go b/bpf_linux.go index 320400a..9b87ba4 100644 --- a/bpf_linux.go +++ b/bpf_linux.go @@ -3,10 +3,12 @@ package netlink /* #include #include +#include #include #include static int load_simple_bpf(int prog_type) { +#ifdef __NR_bpf // { return 1; } __u64 __attribute__((aligned(8))) insns[] = { 0x00000001000000b7ull, @@ -32,6 +34,10 @@ static int load_simple_bpf(int prog_type) { .license = (__u64)&license, }; return syscall(__NR_bpf, 5, &attr, sizeof(attr)); +#else + errno = EINVAL; + return -1; +#endif } */ import "C" diff --git a/filter_test.go b/filter_test.go index 6abd92d..0459a97 100644 --- a/filter_test.go +++ b/filter_test.go @@ -294,7 +294,7 @@ func TestFilterU32BpfAddDel(t *testing.T) { fd, err := loadSimpleBpf(BPF_PROG_TYPE_SCHED_ACT) if err != nil { - t.Fatal(err) + t.Skipf("Loading bpf program failed: %s", err) } filter := &U32{ FilterAttrs: FilterAttrs{ @@ -415,7 +415,7 @@ func TestFilterClsActBpfAddDel(t *testing.T) { } fd, err := loadSimpleBpf(BPF_PROG_TYPE_SCHED_CLS) if err != nil { - t.Fatal(err) + t.Skipf("Loading bpf program failed: %s", err) } filter := &BpfFilter{ FilterAttrs: filterattrs,