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
, 2);
9 __uint(key_size
, sizeof(__u32
));
10 __uint(value_size
, sizeof(__u32
));
11 } jmp_table
SEC(".maps");
14 int subprog_tail2(struct __sk_buff
*skb
)
16 volatile char arr
[64] = {};
18 if (load_word(skb
, 0) || load_half(skb
, 0))
19 bpf_tail_call_static(skb
, &jmp_table
, 10);
21 bpf_tail_call_static(skb
, &jmp_table
, 1);
27 int subprog_tail(struct __sk_buff
*skb
)
29 volatile char arr
[64] = {};
31 bpf_tail_call_static(skb
, &jmp_table
, 0);
37 int bpf_func_0(struct __sk_buff
*skb
)
39 volatile char arr
[128] = {};
41 return subprog_tail2(skb
);
45 int bpf_func_1(struct __sk_buff
*skb
)
47 volatile char arr
[128] = {};
53 int entry(struct __sk_buff
*skb
)
55 volatile char arr
[128] = {};
57 return subprog_tail(skb
);
60 char __license
[] SEC("license") = "GPL";
61 int _version
SEC("version") = 1;