Commit Graph

81 Commits (713494609e7314a0cb9bf1c54cb0a5955793c2ee)
 

Author SHA1 Message Date
Alessandro Decina 713494609e aya-bpf-bindings: remove unused code 4 years ago
Alessandro Decina 59ed237343 aya: generate code with xtask 4 years ago
Alessandro Decina fb0c8f0bc9 xtask: add code generator for aya 4 years ago
Alessandro Decina 08d4b1aeda aya-gen: add bindgen builder for userspace code 4 years ago
Alessandro Decina d9c3489165 aya-gen: rename probe_read_getter to read_getter
The same code can be used to wrap with preserve_access_index()
4 years ago
Alessandro Decina 9cd04a79e7 xtask: use more aya-gen 4 years ago
Alessandro Decina 99447bcc0d aya-gen: add bindgen module and utils to write to file 4 years ago
Alessandro Decina 16975e87d8 xtask: rework code generator for bpf helpers 4 years ago
Alessandro Decina 7ae3ddf2fa xtask: use aya-gen to generate the getters 4 years ago
Alessandro Decina b66a73f6c7 Add aya-gen
aya-gen can be used to generate bindings for kernel types, eg:

	aya-gen btf-types ethhdr --probe-read-getters

Will generate:

	// ...

	#[repr(C)]
	#[derive(Debug, Copy, Clone)]
	pub struct ethhdr {
	    pub h_dest: [::aya_bpf_cty::c_uchar; 6usize],
	    pub h_source: [::aya_bpf_cty::c_uchar; 6usize],
	    pub h_proto: __be16,
	}

	impl ethhdr {
	    pub fn h_dest(&self) -> Option<[::aya_bpf_cty::c_uchar; 6usize]> {
		unsafe { ::aya_bpf::helpers::bpf_probe_read(&self.h_dest) }.ok()
	    }
	    pub fn h_source(&self) -> Option<[::aya_bpf_cty::c_uchar; 6usize]> {
		unsafe { ::aya_bpf::helpers::bpf_probe_read(&self.h_source) }.ok()
	    }
	    pub fn h_proto(&self) -> Option<__be16> {
		unsafe { ::aya_bpf::helpers::bpf_probe_read(&self.h_proto) }.ok()
	    }
	}
4 years ago
Alessandro Decina 7815711196 bpf: add aya-bpf-bindings
Move the generated bindings to aya-bpf-bindings.
4 years ago
Alessandro Decina b5cb1f479f xask: add bindings::write 4 years ago
Alessandro Decina ee205627b7 xtask: rename bindgen module to bindings 4 years ago
Alessandro Decina 1bb3846071 xtask: fix getters source order
Generate getters in the same order as the fields they access. Avoids git
noise and makes for better docs.
4 years ago
Alessandro Decina 25170a539b xtask: start moving bindgen to its own module 4 years ago
Alessandro Decina dc15c978f5 aya-bpf: generate bpf_probe_read getters for kernel types 4 years ago
Alessandro Decina cdf960aaa1 bpf: initial bpf bindings 4 years ago
Alessandro Decina 8327ffbb8d xdp: xdp BPF_LINK_CREATE was added in 5.9 4 years ago
Alessandro Decina 1e779c520a aya: obj: implement sane defaults for license and kernel version
Default to license=GPL and kernel_version=any
4 years ago
Alessandro Decina f11df77f85 aya: implement missing bit of retprobes 4 years ago
Alessandro Decina b7369d2763 aya: sys: fix warning 4 years ago
Alessandro Decina 82bcef3790 aya: rename gen-bindings to gen-bindings.sh 4 years ago
Alessandro Decina 245cd46bab aya: tweak error display 4 years ago
Alessandro Decina 3e8a279a59 Fix build with musl 4 years ago
Alessandro Decina 68a633fe51 perf_map: support max_entries=0
When a PerfMap has max_entries=0, set max_entries to the number of
available CPUs.
4 years ago
Alessandro Decina f56c32b46b util: add possible_cpus() 4 years ago
Alessandro Decina d6f299065d Add rustfmt.toml 4 years ago
Alessandro Decina a3ab2eff57 Format fixes 4 years ago
Alessandro Decina 0cf5d17e38 deps: enable only the std feature for the futures crate 4 years ago
Alessandro Decina 3abe9bb859 Fix RawFd import paths 4 years ago
Alessandro Decina 2cec04c578 bpf: add explicit BTF argument to the load API
Add a `target_btf: Option<Btf>` argument to Bpf::load. None can be
passed to indicate to skip BTF relocation, for example for kernels that
don't support it. Some(btf) can be used to pass BTF parsed with
Btf::from_sys_fs() or Btf::parse/parse_file.

Finally, add a simpler Bpf::load_file(path) that uses from_sys_fs()
internally to simplify the common case.
4 years ago
Alessandro Decina 01e9f81043 Add license files 4 years ago
Alessandro Decina 55d8bcf386 xdp: add support for attaching with custom xdp flags 4 years ago
Alessandro Decina d326038cf4 programs: rework ProgramError a bit
Move type specific errors to XdpError SocketFilterError etc.

Annotate all source errors with #[source]
4 years ago
Alessandro Decina f88ca1f1f1 programs: add internal API to create links 4 years ago
Alessandro Decina ba992a2414 maps: fail new() for high level wrappers if the underlying map hasn't been created 4 years ago
Alessandro Decina 873691d050 Trim deps a bit more 4 years ago
Alessandro Decina f1da541234 The futures crate is only needed when async is enabled 4 years ago
Alessandro Decina 14c98455a9 btf: remove unused methods 4 years ago
Alessandro Decina a5e19fc4ac Fix warnings 4 years ago
Alessandro Decina fdc4dad5ff maps: add AsyncPerfMap
When the async_tokio or async_std features are enabled, AsyncPerfMap
provides an async version of PerfMap which returns a future from
read_events()
4 years ago
Alessandro Decina 4be0c45305 perf_map: split in sub modules 4 years ago
Alessandro Decina 95a24c6f8b perf_map: implement AsRawFd 4 years ago
Alessandro Decina 5d6fe8bdf4 Add IOError variants to PerfMapError and PerfBufferError 4 years ago
Alessandro Decina b9be2f1a9b Make aya::maps::perf_map public 4 years ago
Alessandro Decina 160e0be6d6 Change the suffix of errors from *Failed to *Error 4 years ago
Alessandro Decina d4e282535b bpf, perf_map: make maps usable from multiple threads
Change PerfMap API so that individual buffers can be read from multiple
threads.

Change the way maps are stored in the `Bpf` struct from RefCell to a
custom RwLock.
4 years ago
Alessandro Decina d7c91efb2d Make online_cpus() util public 4 years ago
Alessandro Decina 2215e202f4 Generate arch specific bindings
Currently x86_64 and aarch64 are supported
4 years ago
Alessandro Decina 1de392964b Add src/generated/netlink_bindings.rs to repo 4 years ago