selftests/bpf: Add BPF XDP link selftests

Add selftest validating all the attachment logic around BPF XDP link. Test
also link updates and get_obj_info() APIs.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200722064603.3350758-9-andriin@fb.com
This commit is contained in:
Andrii Nakryiko
2020-07-21 23:46:01 -07:00
committed by Alexei Starovoitov
parent dc8698cac7
commit fe48230cf2
2 changed files with 149 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
char LICENSE[] SEC("license") = "GPL";
SEC("xdp/handler")
int xdp_handler(struct xdp_md *xdp)
{
return 0;
}