| 1 |
|
| 2 |
|
| 3 |
#include "common.h" |
| 4 |
|
| 5 |
int __section("socket/tail") tail_1() { |
| 6 |
return 42; |
| 7 |
} |
| 8 |
|
| 9 |
|
| 10 |
struct { |
| 11 |
__uint(type, BPF_MAP_TYPE_PROG_ARRAY); |
| 12 |
__type(key, uint32_t); |
| 13 |
__type(value, uint32_t); |
| 14 |
__uint(max_entries, 2); |
| 15 |
__array(values, int()); |
| 16 |
} prog_array_init __section(".maps") = { |
| 17 |
.values = |
| 18 |
{ |
| 19 |
|
| 20 |
[1] = &tail_1, |
| 21 |
}, |
| 22 |
}; |
| 23 |
|
| 24 |
int __section("socket/main") tail_main(void *ctx) { |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
bpf_tail_call(ctx, &prog_array_init, 1); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
struct { |
| 35 |
__uint(type, BPF_MAP_TYPE_ARRAY); |
| 36 |
__uint(max_entries, 1); |
| 37 |
__type(key, uint32_t); |
| 38 |
__type(value, uint32_t); |
| 39 |
} inner_map __section(".maps"); |
| 40 |
|
| 41 |
|
| 42 |
struct { |
| 43 |
__uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS); |
| 44 |
__uint(max_entries, 2); |
| 45 |
__type(key, uint32_t); |
| 46 |
__type(value, uint32_t); |
| 47 |
__array(values, typeof(inner_map)); |
| 48 |
} outer_map_init __section(".maps") = { |
| 49 |
.values = |
| 50 |
{ |
| 51 |
|
| 52 |
[1] = &inner_map, |
| 53 |
}, |
| 54 |
}; |