Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at for-next 39 lines 603 B view raw
1// SPDX-License-Identifier: GPL-2.0 2 3#include <linux/bpf.h> 4#include <bpf/bpf_helpers.h> 5 6__noinline 7long changes_pkt_data(struct __sk_buff *sk) 8{ 9 return bpf_skb_pull_data(sk, 0); 10} 11 12__noinline __weak 13long does_not_change_pkt_data(struct __sk_buff *sk) 14{ 15 return 0; 16} 17 18SEC("?tc") 19int main_with_subprogs(struct __sk_buff *sk) 20{ 21 changes_pkt_data(sk); 22 does_not_change_pkt_data(sk); 23 return 0; 24} 25 26SEC("?tc") 27int main_changes(struct __sk_buff *sk) 28{ 29 bpf_skb_pull_data(sk, 0); 30 return 0; 31} 32 33SEC("?tc") 34int main_does_not_change(struct __sk_buff *sk) 35{ 36 return 0; 37} 38 39char _license[] SEC("license") = "GPL";