Commit Graph

119 Commits (eb80e6f37e8969415edd4278e4c982d6d7f9ad1a)

Author SHA1 Message Date
Dave Tucker 1a9903d864 tests: Use Fedora 36
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 8305ee1eca test: Fix clippy lint
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 4826bf7f74
Merge pull request #366 from dave-tucker/pin-redux-2
aya: Fix Link Pinning
2 years ago
Dave Tucker 4c1d645aa6 aya: Fix Link Pinning
1. Removes OwnedLink
2. Allows Links to be converted into FdLink
3. Introduces a PinnedLink type to handle wrap FdLink when pinned and
   support un-pinning

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Michal Rostecki 944d6b8a16 Change from Rust edition 2018 to 2021
Rust 2021 adds more core prelude imports, including `TryFrom` and
`TryInto`.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 3664e1ea0d aya-log, test: Switch from simplelog to env_logger
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Dave Tucker dc31e11691 Re-organize into a single workspace
This commit moves the aya-log projects from the subtree and adds them to
the main cargo workspace. It also brings the BPF crates into the
workspace and moves the macro crates up a level since they aren't BPF
code.

Miri was disabled for aya-bpf as the previous config wasn't actually
checking anything.

CI, clippy, fmt and release configurations have all been adjusted
appropriately.

CI was not properly running for other supported arches which was also
ixed here.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker f976229477 Support BTF Maps
This commit allows for BTF maps in the .maps ELF section to be parsed.
It reads the necessary information from the BTF section of the ELF file.
While the btf_ids of Keys and Values types are stored, they are not (yet)
used.

When creating a BTF map, we pass the btf_key_type_id and
btf_value_type_id.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 79101e748a test: Replace RTF with Rust
This commit replaces the existing RTF test runner with a simple rust
binary package called - integration-test.

integration-test depends on integration-ebpf, which contains test eBPF
code written in Rust and C. `cargo xtask build-integration-test-ebpf`
can be used to build this code and supress rust-analyzer warnings. It
does require `bpf-linker`, but that is highly likely to be available to
developers of Aya. It also requires a checkout of `libbpf` to extract
headers like bpf-helpers.h.

Since everything is compiled into a single binary, it can be run
be run locally using `cargo xtask integration-test` or remotely using
`./run.sh` which re-uses the bash script from the old test framework
to spawn a VM in which to run the tests.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Tatsuyuki Ishi e852f7e0cc test: Update to use non-mut map types 2 years ago
Dave Tucker b2a6f00212 aya: Rename forget_link to take_link
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Davide Bertola e2685c98d8
Program unload API (#264)
aya: add `program.unload()` API
2 years ago
Dave Tucker f12c0269d0 bpf: Maps live in maps section
This forces all maps to the maps section so we remain compatible with
libbpf. This requires #181 to avoid breaking userspace.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker f357be7db4 aya: Support multiple maps in map sections
This commit uses the symbol table to discover all maps inside an ELF
section. Instead of doing what libbpf does - divide the section data
in to equal sized chunks - we read in to section data using the
symbol address and offset, thus allowing us to support definitions
of varying lengths.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker ce93774e0a ci: try running regression tests in a container
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 61c3675b92 test: Add a check for minimum kernel version
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 4bad464c92 test: Add smoke test for BPF_PROG_TYPE_EXT
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 657fb44525 test: Add compile_c_ebpf to library
This allows for C code to be compiled and used in tests!
It does require libbpf on the host machine though...

Also moved removal of the `user` and `ebpf` dirs created by rust-script
into `lib.sh` and parameterized bits of the XDP smoke test for ease of
copying

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 74ae8ce271 test: Add regression tests
This uses a mix of rust-script, bash, qemu and a test runner called RTF
to add a regression test suite... and wires it into GitHub Actions

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago