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.
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>
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>
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>
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>
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>
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>
structopt was merged into clap (starting from clap 3.0), therefore
becoming a deprecated project.
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
structopt was merged into clap (starting from clap 3.0), therefore
becoming a deprecated project.
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
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>
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.