summaryrefslogtreecommitdiff
path: root/src/xdp/xdp_prog_kern.c
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2023-02-12 23:26:32 +0100
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2023-02-13 11:21:23 +0100
commit71f91f08f45c1167743d55b2168a4d45c11c8eae (patch)
treef8dc5838497976f31cff85d740b9023e3f7d252d /src/xdp/xdp_prog_kern.c
parent7bacde871bb9c94d302251a54886ce2aac6f329e (diff)
downloadvyos-1x-71f91f08f45c1167743d55b2168a4d45c11c8eae.tar.gz
vyos-1x-71f91f08f45c1167743d55b2168a4d45c11c8eae.zip
debian: T5003: Update XDP for latest libbpf
Diffstat (limited to 'src/xdp/xdp_prog_kern.c')
-rw-r--r--src/xdp/xdp_prog_kern.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/xdp/xdp_prog_kern.c b/src/xdp/xdp_prog_kern.c
index a1eb395af..59308325d 100644
--- a/src/xdp/xdp_prog_kern.c
+++ b/src/xdp/xdp_prog_kern.c
@@ -16,19 +16,19 @@
#define memcpy(dest, src, n) __builtin_memcpy((dest), (src), (n))
#endif
-struct bpf_map_def SEC("maps") tx_port = {
- .type = BPF_MAP_TYPE_DEVMAP,
- .key_size = sizeof(int),
- .value_size = sizeof(int),
- .max_entries = 256,
-};
-
-struct bpf_map_def SEC("maps") redirect_params = {
- .type = BPF_MAP_TYPE_HASH,
- .key_size = ETH_ALEN,
- .value_size = ETH_ALEN,
- .max_entries = 1,
-};
+struct {
+ __uint(type, BPF_MAP_TYPE_DEVMAP);
+ __type(key, int);
+ __type(value, int);
+ __uint(max_entries, 256);
+} tx_port SEC(".maps");
+
+struct {
+ __uint(type, BPF_MAP_TYPE_HASH);
+ __type(key, ETH_ALEN);
+ __type(value, ETH_ALEN);
+ __uint(max_entries, 1);
+} redirect_params SEC(".maps");
static __always_inline __u16 csum_fold_helper(__u32 csum)
{
@@ -208,8 +208,12 @@ out:
return xdp_stats_record_action(ctx, action);
}
+#ifndef AF_INET
#define AF_INET 2
+#endif
+#ifndef AF_INET6
#define AF_INET6 10
+#endif
#define IPV6_FLOWINFO_MASK bpf_htonl(0x0FFFFFFF)
/* from include/net/ip.h */