fix: Fix bpf CO-RE issue on 6.9 (#483)

This commit is contained in:
/gray 2024-03-27 12:39:26 +08:00 committed by GitHub
parent d31d8802ce
commit b18e081e09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -601,10 +601,13 @@ route(const __u32 flag[8], const void *l4hdr, const __be32 saddr[4],
#define _dscp flag[6]
int ret;
struct lpm_key lpm_key_instance, *lpm_key;
struct lpm_key *lpm_key;
__u32 key = MatchType_L4Proto;
__u16 h_dport;
__u16 h_sport;
struct lpm_key lpm_key_instance = {
.trie_key = { IPV6_BYTE_LENGTH * 8, {} },
};
/// TODO: BPF_MAP_UPDATE_BATCH ?
ret = bpf_map_update_elem(&l4proto_ipversion_map, &key, &_l4proto_type, BPF_ANY);
@ -631,7 +634,6 @@ route(const __u32 flag[8], const void *l4hdr, const __be32 saddr[4],
if (unlikely((ret = bpf_map_update_elem(&h_port_map, &key, &h_dport, BPF_ANY))))
return ret;
lpm_key_instance.trie_key.prefixlen = IPV6_BYTE_LENGTH * 8;
__builtin_memcpy(lpm_key_instance.data, daddr, IPV6_BYTE_LENGTH);
key = MatchType_IpSet;
ret = bpf_map_update_elem(&lpm_key_map, &key, &lpm_key_instance, BPF_ANY);