This moves the path dependencies back into the per-crate Cargo.toml.
It is required such that the release tooling can correctly calculate
which version constraints require changing when we perform a release.
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
This allows for inheritance of common fields from the workspace root.
The following fields have been made common:
- authors
- license
- repository
- homepage
- edition
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
This commit cleans up the recently refactored aya-bpf-macros
to be a little easier to maintain:
Cosmetic changes:
1. The flow of the parse function is the same in each file
2. Useless if !attrs.is_empty() guards were removed
3. The compile error when cgroup_sock programs have an invalid
attach_type was in the wrong location
Functional changes:
1. Remove pop_required_arg. All args are optional and making them
required was a mistake on my part. We may revisit this later.
2. Rename pop_arg to pop_string_arg
3. Implement pop_bool_arg to allow for single idents to be mixed with
our key/value pair syntax in macro attributes. This is used for
`sleepable` and `frags` in XDP programs.
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
The aya-bpf-macros needed refactoring for:
1. Ease of testing
2. To be consistent with when we use K/V args vs. idents
3. To deprecate the use of `name` to change the exported name of a
function - we now use the symbol table.
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
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>
Kernel 4.15 added a new eBPF program that can
be used with cgroup v2 to control & observe device
access (e.g. read, write, mknod) - `BPF_PROG_TYPE_CGROUP_DEVICE`.
We add the ability to create these programs with the `cgroup_device`
proc macro which creates the `cgroup/dev` link section. Device
details are available to the eBPF program in `DeviceContext`.
The userspace representation is provided with the `CgroupDevice`
structure.
Fixes: #212
Signed-off-by: Milan <milan@mdaverde.com>
This change separates the previous `SkBuffContext` into three structs:
* `SkBuff` which is a wrapper around `__sk_buff` which contains all
possible methods operating on it.
* `SkBuffContext` which is a program context for programs which
**cannot** access `__sk_buff` directly and instead can only use
`load_bytes`.
* `TcContext` which is a classifier context which can access `__sk_buff`
directly, hence exposes `data` and `data_end`.
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
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>