-
Notifications
You must be signed in to change notification settings - Fork 354
Open
Labels
upstream/llvmIssue which needs upstream work in LLVMIssue which needs upstream work in LLVM
Description
consider aya still doesn't have SkStore map, so I have to create my SkStore type
#[repr(C)]
pub struct SkStore<V> {
r#type: *const [c_int; BPF_MAP_TYPE_SK_STORAGE as _],
map_flags: *const [c_int; BPF_F_NO_PREALLOC as _],
key: *const c_int,
value: *const V,
max_entries: *const [c_int; 0],
}
unsafe impl<V: Sync> Sync for SkStore<V> {}
#[link_section = ".maps"]
#[export_name = "CONNECT_DST_IPV4_ADDR_STORAGE"]
pub static CONNECT_DST_IPV4_ADDR_STORAGE: SyncUnsafeCell<SkStore<Ipv4Addr>> =
SyncUnsafeCell::new(SkStore {
r#type: ptr::null(),
map_flags: ptr::null(),
key: ptr::null(),
value: ptr::null(),
max_entries: ptr::null(),
});however, it will fail when EbpfLoader try to load the ebpf file with error
called `Result::unwrap()` on an `Err` value: ParseError(BtfError(UnexpectedBtfType { type_id: 23 }))
unless I use
#[link_section = ".maps"]
#[export_name = "CONNECT_DST_IPV4_ADDR_STORAGE"]
pub static mut CONNECT_DST_IPV4_ADDR_STORAGE: SkStore<Ipv4Addr> = SkStore {
r#type: ptr::null(),
map_flags: ptr::null(),
key: ptr::null(),
value: ptr::null(),
max_entries: ptr::null(),
};to create this global static variable directly
I am not sure which one cause this problem, rustc, bpf-linker or aya crate?
Metadata
Metadata
Assignees
Labels
upstream/llvmIssue which needs upstream work in LLVMIssue which needs upstream work in LLVM