Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <linux/bpf.h>
0003 
0004 #include <bpf/bpf_helpers.h>
0005 
0006 struct {
0007     __uint(type, BPF_MAP_TYPE_PROG_ARRAY);
0008     __uint(max_entries, 1);
0009     __uint(key_size, sizeof(__u32));
0010     __uint(value_size, sizeof(__u32));
0011 } jmp_table SEC(".maps");
0012 
0013 int count = 0;
0014 
0015 SEC("tc")
0016 int classifier_0(struct __sk_buff *skb)
0017 {
0018     count++;
0019     bpf_tail_call_static(skb, &jmp_table, 0);
0020     return 1;
0021 }
0022 
0023 SEC("tc")
0024 int entry(struct __sk_buff *skb)
0025 {
0026     bpf_tail_call_static(skb, &jmp_table, 0);
0027     return 0;
0028 }
0029 
0030 char __license[] SEC("license") = "GPL";