Commit Graph

7 Commits (cd53baf71b2ea62485d5b8b09e14ffeeb5cb3588)

Author SHA1 Message Date
Hengqi Chen e12e8a9ded aya-bpf/maps: Create LPMTrie with BPF_F_NO_PREALLOC
The Linux kernel requires BPF_F_NO_PREALLOC on creating LPMTrie ([0]).
Add BPF_F_NO_PREALLOC flag in LPMTrie constructor.

Closes #332.

  [0]: https://github.com/torvalds/linux/blob/9e6b19a66d9b/kernel/bpf/lpm_trie.c#L551

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
3 years ago
Gabi 14bad9ba92
aya-bpf: minor fix lpm_trie::key docs 3 years ago
Michal Rostecki ee15fbbbc5 bpf: Use `then_some` instead of `then(|| [...])`
This change fixes the `unnecessary_lazy_evaluations` clippy warning.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
3 years ago
tirex 42c4d5c3af Temporary change return value condition to avoid problems with possibly (not aware) cast from int to long 3 years ago
tirex 5b1a3ed866 Fix return value for map removing/deleting 3 years ago
Tatsuyuki Ishi 41c6b56142 bpf: Replace map types to use &self, remove HashMap::get_mut
The bpf_map_defs are now wrapped with UnsafeCell, which also happens to
provide a cozy way to get a *mut pointer. An UnsafeCell isn't strictly
required as the struct fields are practically opaque to us, but using an
UnsafeCell follows the general best practices against miscompilation and
also prevents some obvious errors.

HashMap::get_mut was removed because the idea is completely unsound.
Previous users should wrap their data with UnsafeCell instead or use
atomics.

Closes: https://github.com/aya-rs/aya/issues/233
3 years ago
Nimrod Shneor d0b6daa091 Add LPMTrie Map to aya-bpf for BPF programs 4 years ago