Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to update vmlinux.h (update to at least kernel 6.9) #3

Open
Integral-Tech opened this issue Nov 8, 2024 · 1 comment
Open

Comments

@Integral-Tech
Copy link
Contributor

  • struct bpf_lpm_trie_key has been deprecated since kernel 6.9. It is recommended to use struct bpf_lpm_trie_key_u8 (when the "data" member is needed for byte access) or struct bpf_lpm_trie_key_hdr (when using an alternative type for the trailing flexible array member) instead.
  • Since the data member in struct bpf_lpm_trie_key is unused in dae, struct bpf_lpm_trie_key_hdr is obviously a better option. By using the new struct bpf_lpm_trie_key_hdr, the following code in dae should be changed:
diff --git a/control/kern/tproxy.c b/control/kern/tproxy.c
index 2eb6471..be0d198 100644
--- a/control/kern/tproxy.c
+++ b/control/kern/tproxy.c
@@ -241,7 +241,7 @@ struct {
 
 // Array of LPM tries:
 struct lpm_key {
-       struct bpf_lpm_trie_key trie_key;
+       struct bpf_lpm_trie_key_hdr trie_key_hdr;
        __be32 data[4];
 };
 
@@ -888,15 +888,15 @@ static __always_inline __s64 route(const struct route_params *params)
                (ctx.h_dport == 53 && _l4proto_type == L4ProtoType_UDP) << 3;
 
        struct lpm_key lpm_key_saddr = {
-               .trie_key = { IPV6_BYTE_LENGTH * 8, {} },
+               .trie_key_hdr = { IPV6_BYTE_LENGTH * 8 },
        };
        ctx.lpm_key_saddr = lpm_key_saddr;
        struct lpm_key lpm_key_daddr = {
-               .trie_key = { IPV6_BYTE_LENGTH * 8, {} },
+               .trie_key_hdr = { IPV6_BYTE_LENGTH * 8 },
        };
        ctx.lpm_key_daddr = lpm_key_daddr;
        struct lpm_key lpm_key_mac = {
-               .trie_key = { IPV6_BYTE_LENGTH * 8, {} },
+               .trie_key_hdr = { IPV6_BYTE_LENGTH * 8 },
        };
        ctx.lpm_key_mac = lpm_key_mac;
        __builtin_memcpy(ctx.lpm_key_saddr.data, params->saddr,
@jschwinger233
Copy link
Member

你是不是在说这个:daeuniverse/dae#482

没细看你的方案,但是如果是一个在新旧内核都能 CORE 的做法,那非常好!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants