xref: /linux/tools/testing/selftests/bpf/progs/sock_addr_kern.c (revision 96f30c8f0aa9923aa39b30bcaefeacf88b490231)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2024 Google LLC */
3 #include <vmlinux.h>
4 #include <bpf/bpf_helpers.h>
5 #include "../bpf_testmod/bpf_testmod_kfunc.h"
6 
7 SEC("syscall")
8 int init_sock(struct init_sock_args *args)
9 {
10 	bpf_kfunc_init_sock(args);
11 
12 	return 0;
13 }
14 
15 SEC("syscall")
16 int close_sock(void *ctx)
17 {
18 	bpf_kfunc_close_sock();
19 
20 	return 0;
21 }
22 
23 SEC("syscall")
24 int kernel_connect(struct addr_args *args)
25 {
26 	return bpf_kfunc_call_kernel_connect(args);
27 }
28 
29 SEC("syscall")
30 int kernel_bind(struct addr_args *args)
31 {
32 	return bpf_kfunc_call_kernel_bind(args);
33 }
34 
35 SEC("syscall")
36 int kernel_listen(struct addr_args *args)
37 {
38 	return bpf_kfunc_call_kernel_listen();
39 }
40 
41 SEC("syscall")
42 int kernel_sendmsg(struct sendmsg_args *args)
43 {
44 	return bpf_kfunc_call_kernel_sendmsg(args);
45 }
46 
47 SEC("syscall")
48 int sock_sendmsg(struct sendmsg_args *args)
49 {
50 	return bpf_kfunc_call_sock_sendmsg(args);
51 }
52 
53 SEC("syscall")
54 int kernel_getsockname(struct addr_args *args)
55 {
56 	return bpf_kfunc_call_kernel_getsockname(args);
57 }
58 
59 SEC("syscall")
60 int kernel_getpeername(struct addr_args *args)
61 {
62 	return bpf_kfunc_call_kernel_getpeername(args);
63 }
64 
65 char _license[] SEC("license") = "GPL";
66