1 // SPDX-License-Identifier: GPL-2.0
3 #include <bpf/bpf_helpers.h>
4 #include "bpf_legacy.h"
7 __uint(type
, BPF_MAP_TYPE_PROG_ARRAY
);
8 __uint(max_entries
, 1);
9 __uint(key_size
, sizeof(__u32
));
10 __uint(value_size
, sizeof(__u32
));
11 } jmp_table
SEC(".maps");
14 int subprog_tail(struct __sk_buff
*skb
)
16 if (load_byte(skb
, 0))
17 bpf_tail_call_static(skb
, &jmp_table
, 1);
19 bpf_tail_call_static(skb
, &jmp_table
, 0);
23 static volatile int count
;
26 int bpf_func_0(struct __sk_buff
*skb
)
29 return subprog_tail(skb
);
33 int entry(struct __sk_buff
*skb
)
35 bpf_tail_call_static(skb
, &jmp_table
, 0);
40 char __license
[] SEC("license") = "GPL";
41 int _version
SEC("version") = 1;