Alessandro Decina
37c3a198c4
Rework the error hierarchy
...
Add BpfError::IO and BpfError::BtfError and remove the nested IO and
BtfError variants inside ParseError and RelocationError
4 years ago
Alessandro Decina
96db24e285
Untangle map relocation from BTF relocation
4 years ago
Alessandro Decina
88d49927c2
btf: rename BtfRelocationError to RelocationError
4 years ago
Alessandro Decina
3b668d9274
Fix some warnings
4 years ago
Alessandro Decina
65d520bbd7
Support non-native endianness
4 years ago
Alessandro Decina
5b8def7b69
Refactor ELF parser a bit and add more tests
4 years ago
Alessandro Decina
fd0ba2355d
btf: remove object::pod usage
4 years ago
Alessandro Decina
4b65da66ea
btf: check array bounds while doing candidate matching
4 years ago
Alessandro Decina
b49a627cac
btf: implement candidate matching for enums
4 years ago
Alessandro Decina
08d5fa6059
Initial BTF support
...
Still missing a couple of things but the bulk is there
4 years ago
Alessandro Decina
b75efc8efe
bpf: fix loading socket filters from obj files
4 years ago
Alessandro Decina
a8c212377f
bpf: make program() and program_mut() return inner program types
...
program() and program_mut() are now generic and can return the inner
program type, which is what you want 99.999% of the time, eg:
let prog = bpf.program_mut::<&mut Xdp>("foo")?.unwrap();
prog.load()?;
prog.attach("eth0")?;
The methods will fail if the requested program is not of the expected
type (eg if you try to retrieve a kprobe as an xdp program).
4 years ago
Alessandro Decina
4dc01f64dd
bpf: make map() and map_mut() optionally return concrete map types
...
map() and map_mut() used to return Ref<Map>, then to convert to a concrete
type you had to:
let mut perf_map: PerfMap<_> = bpf.map_mut("PERF_MAP").unwrap().try_into()?;;
But the base Map type is pretty much only useful internally. This change
makes map() and map_mut() use TryInto internally, so that now
conversions can can be done with:
let mut perf_map: PerfMap<_> = bpf.map_mut("PERF_MAP")?.unwrap();
4 years ago
Alessandro Decina
a41edbca2c
maps: add ProgramArray
...
ProgramArray is a wrapper around BPF_MAP_TYPE_PROG_ARRAY maps. Can be
used to setup jump tables for bpf_tail_call().
4 years ago
Alessandro Decina
f7cdd2e059
maps: move maps inside RefCells
4 years ago
Alessandro Decina
77fa7d857c
syscalls: add Pod bound on keys
4 years ago
Alessandro Decina
83f57447dc
maps: move MapsIter/MapsKeys from hash_map.rs to the parent module
4 years ago
Alessandro Decina
72e43aae1a
maps: hash_map: make MapKeys and MapIter generic
...
Introduce IterableMap trait and make MapKeys/MapIter use that.
4 years ago
Alessandro Decina
70fab20193
maps: hash map: remove Clone bound
4 years ago
Alessandro Decina
b0b83cbd8c
Use own Pod trait
4 years ago
Alessandro Decina
561b0015bb
programs: xdp: support detaching with FdLink
4 years ago
Alessandro Decina
0f0bc795e3
programs: add FdLink
...
FdLink is a generic Link impl that calls close() on the given fd.
4 years ago
Alessandro Decina
84afa318c8
Formatting fixes
4 years ago
Alessandro Decina
15be301f8c
Initial commit
4 years ago