selftests/bpf: Add some tests with new bpf_program__attach_sockmap() APIs

Add a few more tests in sockmap_basic.c and sockmap_listen.c to
test bpf_link based APIs for SK_MSG and SK_SKB programs.
Link attach/detach/update are all tested.

All tests are passed.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20240410043547.3738448-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
Yonghong Song
2024-04-09 21:35:47 -07:00
committed by Alexei Starovoitov
parent a15d58b2bc
commit 8ba218e625
5 changed files with 206 additions and 2 deletions

View File

@@ -49,4 +49,22 @@ int prog_msg_verdict(struct sk_msg_md *msg)
return prog_msg_verdict_common(msg);
}
SEC("sk_msg")
int prog_msg_verdict_clone(struct sk_msg_md *msg)
{
return prog_msg_verdict_common(msg);
}
SEC("sk_msg")
int prog_msg_verdict_clone2(struct sk_msg_md *msg)
{
return prog_msg_verdict_common(msg);
}
SEC("sk_skb/stream_verdict")
int prog_skb_verdict(struct __sk_buff *skb)
{
return SK_PASS;
}
char _license[] SEC("license") = "GPL";