.. | .. |
---|
16 | 16 | #include <bpf/bpf_helpers.h> |
---|
17 | 17 | #include <bpf/bpf_endian.h> |
---|
18 | 18 | |
---|
| 19 | +#if defined(IPROUTE2_HAVE_LIBBPF) |
---|
| 20 | +/* Use a new-style map definition. */ |
---|
| 21 | +struct { |
---|
| 22 | + __uint(type, BPF_MAP_TYPE_SOCKMAP); |
---|
| 23 | + __type(key, int); |
---|
| 24 | + __type(value, __u64); |
---|
| 25 | + __uint(pinning, LIBBPF_PIN_BY_NAME); |
---|
| 26 | + __uint(max_entries, 1); |
---|
| 27 | +} server_map SEC(".maps"); |
---|
| 28 | +#else |
---|
19 | 29 | /* Pin map under /sys/fs/bpf/tc/globals/<map name> */ |
---|
20 | 30 | #define PIN_GLOBAL_NS 2 |
---|
21 | 31 | |
---|
.. | .. |
---|
35 | 45 | .max_elem = 1, |
---|
36 | 46 | .pinning = PIN_GLOBAL_NS, |
---|
37 | 47 | }; |
---|
| 48 | +#endif |
---|
38 | 49 | |
---|
39 | 50 | int _version SEC("version") = 1; |
---|
40 | 51 | char _license[] SEC("license") = "GPL"; |
---|