113 Commits (e86392d422048729799d9da6556c8b798735c474)
 

Author SHA1 Message Date
Dmitry Savintsev e86392d422 Fix clippy issues in the generated code.
Fix template so that the generated code would not have any
clippy issues (per `cargo +nightly clippy`).
Add template conditionals on the program_type to avoid
a warning about unused 'opt' variable.

Fixes #66.
2 years ago
Michal Rostecki 3ac1aa63ce
Merge pull request #64 from vadorovsky/update-deps
Update dependencies
2 years ago
Michal Rostecki 76699e10b2 Update dependencies
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 4720291f67
Merge pull request #63 from vadorovsky/log_level
readme: Mention `RUST_LOG` env variable
2 years ago
Michal Rostecki cba4774787 readme: Mention `RUST_LOG` env variable
The default log level of env_logger is `error`. We are using `info!` in
the template, so let's suggest running the example with `RUST_LOG=info`.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina 864e1995f7
Merge pull request #61 from vadorovsky/aya-log-dont-unwrap
Don't fail on `BpfLogger::init()` error
2 years ago
Michal Rostecki ab442eb10f Don't fail on `BpfLogger::init()` error
An error during `BpfLogger` initialization most likely means that
`ayalog-ebpf` is not used in the eBPF crate.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki df87136bdb
Merge pull request #60 from vadorovsky/no-unsafe
ebpf: Stop using `unsafe` for the whole function
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 ccb2ad0f81
Merge pull request #59 from vadorovsky/static-mut
ebpf: Change `static mut` to `static` in map declaration
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
Dave Tucker 12c43b56bf
Merge pull request #54 from vadorovsky/tc-context
classifier: Use the new `TcContext` struct
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
Dave Tucker 37410be032
Merge pull request #55 from vadorovsky/monorepo
ebpf: Update git repository URL for aya-log
2 years ago
Dave Tucker 88243bad08
Merge pull request #56 from vadorovsky/env_logger
Switch from simplelog to env_logger
2 years ago
Michal Rostecki 3b831ffda3 Switch from simplelog to env_logger
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki f462b301f4 ebpf: Update git repository URL for aya-log
aya-log was moved to the main aya repository, the old one is archived.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Dave Tucker 8c6016040e
Merge pull request #49 from dave-tucker/deps
Update dependency
2 years ago
Dave Tucker 3b2b186e0b Update dependency
Use `aya = ">=0.11"` and therefore the Aya version picked by
Cargo will be bounded by the latest version supported in
`aya-log = "0.1"` - once it's been released again.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 02185e1e14
Merge pull request #48 from ishitatsuyuki/patch-1
Fix trailing comma in ebpf/.vscode/settings.json
2 years ago
Tatsuyuki Ishi c15f1d34de
Fix trailing comma in ebpf/.vscode/settings.json 2 years ago
Alessandro Decina 54e16b80f7
Merge pull request #47 from nak3/add-BPF_PROG_TYPE_CGROUP_SOCKOPT
Add cgroup_sockopt template for BPF_PROG_TYPE_CGROUP_SOCKOPT
2 years ago
Kenjiro Nakayama dcb6523ada Fix wrong elif condition 2 years ago
Kenjiro Nakayama 8621ea7d5f Add cgroup_sockopt template for BPF_PROG_TYPE_CGROUP_SOCKOPT 2 years ago
Alessandro Decina c6b6f1ed3d
Merge pull request #46 from nak3/add-cgroup-sysctl
Add cgroup_sysctl template for BPF_PROG_TYPE_CGROUP_SYSCTL
2 years ago
Kenjiro Nakayama 886182d1bc Add cgroup_sysctl to CI 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
Alessandro Decina 0df4d8f969
Merge pull request #45 from vadorovsky/use-main
aya: Switch (again) from crates.io to git
2 years ago
Michal Rostecki 9f69ee52b2 aya: Switch (again) from crates.io to git
This time we need to switch to git again, because of this unreleased
change:

aya-rs/aya@d1f2215193

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
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
Dave Tucker aeb81111ea
Merge pull request #44 from vadorovsky/xtask-clap
xtask: Use clap instead of structopt
2 years ago
Michal Rostecki 9297249e01 xtask: Use clap instead of structopt
structopt was merged into clap (starting from clap 3.0), therefore
becoming a deprecated project.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina 5dd77572e6
Merge pull request #43 from vadorovsky/aya-log
Add aya-log
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
Alessandro Decina 1f179c0af1
Merge pull request #41 from vadorovsky/clap
Use clap instead of structopt
2 years ago
Michal Rostecki f940467c4a Use clap instead of structopt
structopt was merged into clap (starting from clap 3.0), therefore
becoming a deprecated project.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina 947986160a
Merge pull request #42 from vadorovsky/update-deps
Update dependencies
2 years ago
Michal Rostecki f5181a822f Update dependencies
Update simplelog and tokio

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina eda904b187
Merge pull request #40 from vadorovsky/profile-dev
ebpf: Make the dev target identical to release
2 years ago
Michal Rostecki 04584fe9c5 ebpf: Make the dev target identical to release
eBPF programs cannot be debugged and those ones built with the default
dev profile are often annoying the verifier. Therefore it doesn't make
sense to compile not optimized eBPF objects.

However, we still want to let people to use the dev profile, especially
in the future when we want to get rid of xtask by using cargo binary
dependencies[0]. The trick is to have no real difference between dev and
release profile in eBPF.

This change doesn't affect the userspace part which still is going to
contain debug symbols when built with dev profile.

[0] https://rust-lang.github.io/rfcs/3028-cargo-binary-dependencies.html

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
3 years ago
Michal Rostecki ec1910fffd Revert "Use release profile for eBPF programs by default"
This reverts commit ad9b8ee8dc.
3 years ago
Alessandro Decina b9abc9a11c
Merge pull request #36 from nak3/fix-regex
Use strict regex for additional args
3 years ago
Kenjiro Nakayama 640d0dcef5 Use strict regex for additional args.
Current `[a-z_]+` regex allows upper case such as `NET_dev`, `netDev`
or even `NET_DEV` when one of `a-z` or `_` contains in the string. It
should be disallowed.

This patch fixes it.
3 years ago
Dave Tucker 8cde8c2232
Merge pull request #35 from mraerino/patch-1
Use HTTPS url for git dependency
3 years ago
Marcus Weiner 220aa73093
Use HTTPS url for git dependency 3 years ago
Dave Tucker bdcf172ec4
Merge pull request #34 from dmitris/edition-2021
use edition 2021
3 years ago
Dmitry Savintsev aa3b2a4407 use edition 2021 3 years ago
Kenjiro Nakayama 11798df0ab Fix sock_filter to socket_filter 3 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
Dave Tucker c41fb5ef0d
Merge pull request #31 from vadorovsky/profile-release
Use release profile for eBPF programs by default
3 years ago