17d3f38675
Adding test that setup following program: SEC("classifier/test_pkt_md_access") int test_pkt_md_access(struct __sk_buff *skb) with its extension: SEC("freplace/test_pkt_md_access") int test_pkt_md_access_new(struct __sk_buff *skb) and tracing that extension with: SEC("fentry/test_pkt_md_access_new") int BPF_PROG(fentry, struct sk_buff *skb) The test verifies that the tracing program can dereference skb argument properly. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/160138355603.48470.9072073357530773228.stgit@toke.dk
26 lines
449 B
C
26 lines
449 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include "vmlinux.h"
|
|
#include <bpf/bpf_helpers.h>
|
|
#include <bpf/bpf_tracing.h>
|
|
|
|
__u64 fentry_called = 0;
|
|
|
|
SEC("fentry/test_pkt_md_access_new")
|
|
int BPF_PROG(fentry, struct sk_buff *skb)
|
|
{
|
|
fentry_called = skb->len;
|
|
return 0;
|
|
}
|
|
|
|
__u64 fexit_called = 0;
|
|
|
|
SEC("fexit/test_pkt_md_access_new")
|
|
int BPF_PROG(fexit, struct sk_buff *skb)
|
|
{
|
|
fexit_called = skb->len;
|
|
return 0;
|
|
}
|
|
|
|
char _license[] SEC("license") = "GPL";
|