19 Commits (bccd6d3cb6d6e8010ad3099b27251e067651594b)

Author SHA1 Message Date
Dave Tucker bccd6d3cb6 ebpf: Don't use name in macros
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
1 year ago
Dmitry Savintsev 8cd95c42ea adjust spacing to avoid VSCode changes on save
Signed-off-by: Dmitry Savintsev <dsavints@gmail.com>
2 years ago
Luca BRUNO 554702e63d
cargo-generate: add perf_event
This adds `perf_event` program type as a template entry.
The new entry comes with a skeleton example which register
scheduled events on each CPU at 1 HZ, triggered by the kernel
(based on clock ticks). The corresponding BPF logic logs each
event, and can identify kernel tasks from userland processes.
2 years ago
Michal Rostecki 70475f3b2a Add raw_tracepoint program type
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 379b23b1b4 ebpf: Stop using `unsafe` for the whole function
Users should opt in into `unsafe` when performing particular unsafe
actions (accesing raw pointers, interacting with maps etc.), but
assuming that the whole eBPF program code is unsafe is quite an
exaggeration.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 0c4b89b497 ebpf: Change `static mut` to `static` in map declaration
Maps are using UnsafeCell for interior mutability, therefore `static
mut` is not needed anymore.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 1ecc829b4f classifier: Use the new `TcContext` struct
That new context type exposes `data` and `data_end` fields for direct
access to the packet payload.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Kenjiro Nakayama 8621ea7d5f Add cgroup_sockopt template for BPF_PROG_TYPE_CGROUP_SOCKOPT 2 years ago
Kenjiro Nakayama 3bf8e87b3e Add cgroup_sysctl template for BPF_PROG_TYPE_CGROUP_SYSCTL
Since https://github.com/aya-rs/aya/pull/256 supports `BPF_PROG_TYPE_CGROUP_SYSCTL`,
this patch adds cgroup_sysctl template.
2 years ago
Dave Tucker 807131b955
Merge pull request #33 from nak3/add-socket-filter
Add template for socket_filter program type
2 years ago
Michal Rostecki 0ea4a7eb04 Add aya-log
This change adds aya-log and example log messsages to all eBPF
programs.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Kenjiro Nakayama 8dcda393c4 Add template for socket_filter program type
This patch adds template for socket_filter.
e.g.

```sh
cargo generate --path ~/dev/aya-template \
         --name my-test \
	 -d program_type=socket_filter
```
3 years ago
Michal Rostecki e1fb8024a6 fentry/fexit: Add template for fentry/fexit programs
Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
3 years ago
William Findlay d4a4f33902
ebpf: use new SkBuffContext instead of SkSkbContext 3 years ago
William Findlay 3f082e713e
tp_btf: add template for tp_btf programs 3 years ago
William Findlay 7ffb47cc6b
template: add a new template for LSM programs 3 years ago
Alessandro Decina ffa931552e ebpf: use core::hint::unreachable_unchecked()
unreachable!() can panic when debug assertions is on, and we don't want
that inside a panic handler
3 years ago
Dave Tucker d98d90be7a Generate Skeleton Programs for all program types
User may specify a program_type by prompt or CLI flag.
We then generate skeleton code to the ebpf program for a noop program of
that type.

Requires cargo-generate@main

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