-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selftests/bpf: Add test for freplace program with expected_attach_type
This adds a new selftest that tests the ability to attach an freplace program to a program type that relies on the expected_attach_type of the target program to pass verification. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/158773526831.293902.16011743438619684815.stgit@toke.dk
- Loading branch information
Toke Høiland-Jørgensen
authored and
Alexei Starovoitov
committed
Apr 25, 2020
1 parent
03f87c0
commit 1d8a0af
Showing
3 changed files
with
58 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <linux/stddef.h> | ||
#include <linux/ipv6.h> | ||
#include <linux/bpf.h> | ||
#include <linux/in.h> | ||
#include <sys/socket.h> | ||
#include <bpf/bpf_helpers.h> | ||
#include <bpf/bpf_endian.h> | ||
|
||
SEC("freplace/do_bind") | ||
int new_do_bind(struct bpf_sock_addr *ctx) | ||
{ | ||
struct sockaddr_in sa = {}; | ||
|
||
bpf_bind(ctx, (struct sockaddr *)&sa, sizeof(sa)); | ||
return 0; | ||
} | ||
|
||
char _license[] SEC("license") = "GPL"; |