Commit Graph

1209 Commits (d5259ce789aea1b80d7b5b9c8138b81df1cd993c)
 

Author SHA1 Message Date
Dave Tucker 811ab299de
Merge pull request #496 from dave-tucker/program-from-pinned3
aya: Add from_pin for Programs
2 years ago
Dave Tucker 7a720ab0c1 aya: Add from_pin for Programs
This commit adds from_pin() which allows the creation of a Program
from a path on bpffs. This is useful to be able to call `attach` or
other APIs for programs that are already loaded to the kernel.

This differs from #444 since it implements this on the concrete program
type, not the Program enum, allowing the user to pass in any additional
context that isn't available from bpf_prog_info.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Alessandro Decina cfa693bc3b
Merge pull request #515 from alessandrod/fix-lru-hash
aya: fix Lru and LruPerCpu hash maps
2 years ago
Alessandro Decina c22014c757 aya: fix Lru and LruPerCpu hash maps
They were broken by https://github.com/aya-rs/aya/pull/397
2 years ago
Alessandro Decina 7868fffd7f
Merge pull request #514 from astoycos/fix-badge
Fix Aya build badge
2 years ago
Andrew Stoycos 4ddbc1cacb
Fix Aya build badge
Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Alessandro Decina 27017ca8a3
Merge pull request #512 from astoycos/crucial-btf-fixes
Support BTF key/value specification for all maps
2 years ago
Andrew Stoycos 52e625060e
Support BTF key/value specification for all maps
Fix a bug which was resulting in `ENOTSUPP` following
the `BPF_MAP_CREATE` Syscall.  This fix was initially
found by libbpf maintainers in:
https://github.com/libbpf/libbpf/issues/355.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Alessandro Decina 22d79312f7
Merge pull request #445 from anfredette/tc-link-recon
Support reconstruction of `SchedClassifierLink`
2 years ago
Andre Fredette 7855a0e0c6 retrigger checks
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 7c24296b5d Address review comments from @alessandrod
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Michal Rostecki be5b4c82cc
Merge pull request #508 from aya-rs/dependabot/cargo/indoc-2.0
build(deps): update indoc requirement from 1.0 to 2.0
2 years ago
dependabot[bot] 912ee06f39
build(deps): update indoc requirement from 1.0 to 2.0
Updates the requirements on [indoc](https://github.com/dtolnay/indoc) to permit the latest version.
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/1.0.0...2.0.0)

---
updated-dependencies:
- dependency-name: indoc
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
Alessandro Decina e8e276730e
Merge pull request #453 from alessandrod/btf-kind-enum64
Add support for BTF_KIND_ENUM64
2 years ago
Alessandro Decina 9a6f8143a1 aya: btf: add support for BTF_KIND_ENUM64 2 years ago
Alessandro Decina f81b1b9f3e
Merge pull request #501 from alessandrod/fix-enum32-relocs
aya: btf: fix relocations for signed enums (32 bits)
2 years ago
Alessandro Decina 4482db42d8 aya: btf: fix relocations for signed enums (32 bits)
Enums now carry a signed bit in the info flags. Take it into account
when applying enum relocations.
2 years ago
Alessandro Decina d6b976c6f1 aya: btf: switch ComputedRelocationValue::value to u64
This is in preparation of adding Enum64 relocation support
2 years ago
Alessandro Decina 9d7c950d1b
Merge pull request #506 from alessandrod/macos-tests
Speed up integration tests
2 years ago
Alessandro Decina 455cc95e8f integration-tests: run on macos to get nested virtualization
Switch integration-test host to macos as only macos runners support nested
virtualization. Adjust integration test runner accordingly.
2 years ago
Alessandro Decina 8e9608eedd test/run.sh: output `uname -a` after starting the vm 2 years ago
Alessandro Decina c7b262641b Run integration tests under fedora37 2 years ago
Michal Rostecki d2a999d27a
Merge pull request #504 from vadorovsky/unpin-nightly
Unpin Rust nightly
2 years ago
Michal Rostecki 7d19bde66b Unpin Rust nightly
The issues with core::sync::atomic got fixed.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina 3e9d85f871
Merge pull request #500 from vadorovsky/bpf-macros-visibility
aya-bpf-macros: Allow to make programs public
2 years ago
Alessandro Decina 7e5637bb9c
Merge pull request #471 from banditopazzo/tracefs_mount_select
add tracefs mount point select function
2 years ago
banditopazzo 48fdf5a250 chore: tracefs review fixes 2 years ago
banditopazzo c6c4ac7eea feat: get_tracefs function 2 years ago
Michal Rostecki 6ad2c3c373 aya-bpf-macros: Allow to make programs public
Allow to define programs as public functions (even in library crates)
and then import them.

For example, we can have library crate with `libfoo/src/lib.rs`
containing:

```rust
pub fn my_xdp_program(ctx: XdpContext) -> u32 {
    xdp_action::XDP_PASS
}
```

And then a binary importing it:

```rust
pub use libfoo::my_xdp_program;
```

This way, commonly used eBPF programs can be distributed as lib crates.

Tested with: https://github.com/vadorovsky/aya-examples/tree/main/pub-progs

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina 556463a85f ebpf: SkbBuff: add some accessors 2 years ago
Andre Fredette d43879d991 Updates after rebase due to changes in define_link_wrapper
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 6766532341 Remove SchedClassifierLink description
It was redundant with the one provided in define_link_wrapper

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 2972d462a5 Address review comments
- Rename `new_tc_link` to `attached`
- Simplified example for `attached`

The following was not requested in reviews:
- Moved example from `SchedClassifierLink` tor
  `SchedClassifierLink::attached' since we're only showing an
  example of that one method

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 65f5b76593 Address review comments
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 849796c420 rename SchedClassifierLink:new() to new_tc_link()
Avoids name confilct with pr #462

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 67efc33414 Additional edits to SchedClassifierLink documentation.
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette 6563e6cc06 Combine updates to SchedClassifierLink example made by Dave Tucker
Co-authored-by: Dave Tucker <dave@dtucker.co.uk>
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette c3a8400e4d Add example for SchedClassifierLink::new()
Also modified the impl a bit to work as described in the example.

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette f46fd17cc3 Support reconstruction of `SchedClassifierLink`
This is the proposed solution for Step 2 of issue #414

“For cases where you have done program.take_link() to manage
ownership of TcLink we need an API similar to PinnedLink::from_pin
that can reconstruct a TcLink”

As long as a user application continues to run after executing
`take_link()`, the `SchedClassifierLink` returned can be used to
detach the program.  However, if we want to handle cases where the
application exits or crashes, we need a way to save and reconstruct
the link, and to do that, we also need to know the information
required for the reconstruction -- namely, the `interface`,
`attach_type`, `priority`, and `handle`.  The user knows the first
two because they are required to execute `attach()` in the first
place; however, the user will not know the others if they let the
system choose them.

This pr solves the problems by adding an `impl` for
`SchedClassifierLink` with an accessor for `tc_options` and a `new()`
function.

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andrew Stoycos 1899d5f4fd Expose inner errors
Currently aya will just report a standard outer level
error on failure.  Ensure that we also report the inner
error condition back to the user

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Alessandro Decina 9f4ef6f67d Fix lints 2 years ago
Alessandro Decina d33ed21fc4 Pin nightly to nightly-2023-01-10
This until https://github.com/rust-lang/rust/pull/106796 gets fixed
2 years ago
Alessandro Decina 405c6a8533
Merge pull request #485 from MatteoNardi/remove_libbpf_dependency
Remove libbpf dependency from relocation tests
2 years ago
Michal Rostecki e2b3be6b31
Merge pull request #486 from vadorovsky/integration-smoke-fix-version-check
integration-test: Fix the kernel version chceck for smoke test
2 years ago
Michal Rostecki bea0e83512
Merge pull request #484 from vadorovsky/update-tokio
Update Tokio and inventory
2 years ago
Michal Rostecki 42c4a8be7c
Merge pull request #487 from vadorovsky/new-map-types
aya-obj: Add new map types
2 years ago
Michal Rostecki 3d03c8a8e0 aya-obj: Add new map types
Include all new map types which were included in the last libbpf update
(5d13fd5aca).

Fixes: cb28533e2f ("aya-obj: Update `BPF_MAP_TYPE_CGROUP_STORAGE` name to `BPF_MAP_TYPE_CGRP_STORAGE`")
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 0399991383
Merge pull request #483 from aya-rs/codegen
Update libbpf to 3423d5e7cdab356d115aef7f987b4a1098ede448
2 years ago
Michal Rostecki cb28533e2f aya-obj: Update `BPF_MAP_TYPE_CGROUP_STORAGE` name to `BPF_MAP_TYPE_CGRP_STORAGE`
It changed in libbpf

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 75336e5a35 integration-test: Fix the kernel version chceck for smoke test
Before this chane, the check was always negative if the minor version
was less then 9. So, for example, the smoke test was skipped for kernel
6.1:

```
skipping as 6.1 does not meet version requirement of 5.9
```

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago