mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-25 19:42:19 +00:00
Try different combinations of global functions replacement: - replace function that changes packet data with one that doesn't; - replace function that changes packet data with one that does; - replace function that doesn't change packet data with one that does; - replace function that doesn't change packet data with one that doesn't; Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20241210041100.1898468-7-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
27 lines
452 B
C
27 lines
452 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <linux/bpf.h>
|
|
#include <bpf/bpf_helpers.h>
|
|
|
|
__noinline
|
|
long changes_pkt_data(struct __sk_buff *sk, __u32 len)
|
|
{
|
|
return bpf_skb_pull_data(sk, len);
|
|
}
|
|
|
|
__noinline __weak
|
|
long does_not_change_pkt_data(struct __sk_buff *sk, __u32 len)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
SEC("tc")
|
|
int dummy(struct __sk_buff *sk)
|
|
{
|
|
changes_pkt_data(sk, 0);
|
|
does_not_change_pkt_data(sk, 0);
|
|
return 0;
|
|
}
|
|
|
|
char _license[] SEC("license") = "GPL";
|