summaryrefslogtreecommitdiff
path: root/src/xdp/xdp_prog_kern.c
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-02-15 19:05:47 +0100
committerGitHub <noreply@github.com>2023-02-15 19:05:47 +0100
commitc8a6b4cf2efec079af558997c0600c54be45215c (patch)
treeff25541d9dad6ffd304b1de5919eb308d35f090f /src/xdp/xdp_prog_kern.c
parenta48940a943d237b0b2e8fcf8f9066c416d175e8d (diff)
parent819eab8708365ac5398f44c25178470358330c36 (diff)
downloadvyos-1x-c8a6b4cf2efec079af558997c0600c54be45215c.tar.gz
vyos-1x-c8a6b4cf2efec079af558997c0600c54be45215c.zip
Merge pull request #1817 from sarthurdev/bookworm
debian: T5003: Upgrade base system to Debian 12 "Bookworm"
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 */