Skip to content

Commit

Permalink
fix: Fix bpf CO-RE issue on 6.9 (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwinger233 authored Mar 27, 2024
1 parent d31d880 commit b18e081
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions control/kern/tproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit b18e081

Please sign in to comment.