Commit Graph

1057 Commits (ee0a3c792439103553cb1e5a0a36a1e05fb45569)
 

Author SHA1 Message Date
Dave Tucker 6f0637a6c8 aya-log, aya-log-common: start next development iteration 0.1.12-dev.0
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker ba927ac204 aya-log, aya-log-common: release version 0.1.11
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 66b4f79eca
Merge pull request #285 from dave-tucker/btf-redux
aya: Improved BTF Type API
2 years ago
Dave Tucker f34ebeba99 aya: Improved BTF Type API
This commit removes reliance on generated BtfType structs, as
well as adding a dedicated struct for each BTF type. As such,
we can now add nice accessors like `bits()` and `encoding()`
for Int vs. inlined shift/mask operations.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
conectado 7b143199fb
aya: update `VerifierLogLevel` to use bitflags 2 years ago
Dave Tucker 906c25ff23
Merge pull request #374 from dave-tucker/aya-tool
aya-gen: Rename to aya-tool
2 years ago
Dave Tucker aaa20cc1fd aya-gen: Rename to aya-tool
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 4826bf7f74
Merge pull request #366 from dave-tucker/pin-redux-2
aya: Fix Link Pinning
2 years ago
Dave Tucker 4c1d645aa6 aya: Fix Link Pinning
1. Removes OwnedLink
2. Allows Links to be converted into FdLink
3. Introduces a PinnedLink type to handle wrap FdLink when pinned and
   support un-pinning

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Michal Rostecki 9a8409e3a2 aya-log-ebpf-macros: Fix the DisplayHint expression names
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina b95adc3135
Merge pull request #371 from conectado/verifier-log-level
aya: expose BPF verifier log level configuration
2 years ago
conectado a6025255f5
aya: update `VerifierLogLevel` level variants 2 years ago
Michal Rostecki 83ec27f06b lib: Add display hints
This change adds optional display hints:

* `{:x}`, `{:X}` - for hex representation of numbers
* `{:ipv4}`, `{:IPv4}` - for IPv4 addresses
* `{:ipv6}`, `{:IPv6}` - for IPv6 addresses

It also gets rid of dyn-fmt and instead comes with our own parser
implementation.

Tested on: https://github.com/vadorovsky/aya-examples/tree/main/tc

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
conectado edd80397dc
aya: use enum to set verifier log level 2 years ago
conectado 3211646aef
aya: expose BPF verifier log level configuration 2 years ago
Michal Rostecki 944d6b8a16 Change from Rust edition 2018 to 2021
Rust 2021 adds more core prelude imports, including `TryFrom` and
`TryInto`.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Hengqi Chen c713dde061 aya-bpf/programs: Add `pull_data` method to SKB context
The pull_data method is used to ensure that all the required bytes
are available in the linear portion of the skb.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years ago
Michal Rostecki 7942c3ac19
Merge pull request #369 from chenhengqi/lpm-trie-flag
aya-bpf/maps: Create LPMTrie with BPF_F_NO_PREALLOC
2 years ago
Hengqi Chen e12e8a9ded aya-bpf/maps: Create LPMTrie with BPF_F_NO_PREALLOC
The Linux kernel requires BPF_F_NO_PREALLOC on creating LPMTrie ([0]).
Add BPF_F_NO_PREALLOC flag in LPMTrie constructor.

Closes #332.

  [0]: https://github.com/torvalds/linux/blob/9e6b19a66d9b/kernel/bpf/lpm_trie.c#L551

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years ago
Michal Rostecki c80ab31d7b
Merge pull request #365 from dave-tucker/xtask-it-fix
xtask: Fix integration-test command
2 years ago
Dave Tucker 5e6b75a29a xtask: Fix integration-test command
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Michal Rostecki 632ea300ed
Merge pull request #361 from chenhengqi/fix-aya-log-links
aya-log/README: Fix links to aya-log repo
2 years ago
Hengqi Chen b8b291c51b aya-log/README: Fix links to aya-log repo
The aya-log repo ([0]) has been archived, use the link to
aya repo instead.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years ago
Andre Fredette 207c689f56 Add support for setting priority for classifier programs
Addresses issue #358

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Alessandro Decina 2f715f0036
Merge pull request #360 from conectado/patch-1
Minor fix for `lpm_trie::key` docs
2 years ago
Gabi 14bad9ba92
aya-bpf: minor fix lpm_trie::key docs 2 years ago
Michal Rostecki 3d5ab0b17d
Merge pull request #357 from vadorovsky/env_logger
aya-log, test: Switch from simplelog to env_logger
2 years ago
Michal Rostecki 3664e1ea0d aya-log, test: Switch from simplelog to env_logger
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Dave Tucker 55a7e3c4d0
Merge pull request #355 from dave-tucker/rm-map-pin-path
aya: Remove MapError::InvalidPinPath
2 years ago
Dave Tucker 03a15b9864 aya: Remove MapError::InvalidPinPath
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 8e6c9ad0d2
Merge pull request #343 from dave-tucker/pinning-redux
Small Pinning API improvements
2 years ago
Dave Tucker 34ba2bc048 aya: Use PinError for all pinning errors
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 64f8a434d2 aya: Implement FdLink::pin()
This allows for FdLinks to also be pinned to BpfFs.
In order for it to be called, the user would first call
`take_link` to get the underlying link. This can then
be destructured to an FdLink where FdLink::pin() may be called.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 5726b6d044 aya: Allow pin to be used on all programs
This allows for `pin` to be called as `Xdp::pin()` or
Program::pin() - the same way that unload() can be used.
This simplifies the use of this API.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Michal Rostecki d968094b66
Merge pull request #353 from vadorovsky/log-remove-u128
aya-log: Remove i128 and u128 types
2 years ago
Michal Rostecki 611f967cd1 aya-log: Remove i128 and u128 types
They are not supported by eBPF VM and we are going to use arrays for
IPv6.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki f37a51433f
Merge pull request #350 from dave-tucker/monorepo
Bring aya-log into aya, creating a Monorepo
2 years ago
Dave Tucker 6ab7148731 bpf: Only use never type with rust nightly
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker c9e70a8758 aya: Fix rlimit warning on for 32bit systems
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker dc31e11691 Re-organize into a single workspace
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>
2 years ago
Michal Rostecki 28abaece2a Fix the log buffer bounds
Change 821ba0b243fd removed the `size > buf.len()` check, which was a
mistake, because we might write to a subslice of the whole buffer, so
then `buf` can be lower than `LOG_BUF_CAPACITY`.

This change compares `size` with `min::(buf.len(), LOG_BUF_CAPACITY)`
instead.

Fixes: 821ba0b243fd ("Ensure log buffer bounds")
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki 2e0702854b Ensure log buffer bounds
This change adds checks in `TagLenValue.write()` to ensure that the size
of written data doesn't exceed the buffer size.

Verifier in recent kernel versions requires the bound to be a constant
value, so using `buf.len()` does not work.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Alessandro Decina 6aea880890 ebpf: use new PerCpuArray::get_ptr_mut API 2 years ago
Dave Tucker 526493b444 aya-log, aya-log-common: start next development iteration 0.1.11-dev.0 2 years ago
Dave Tucker 3abd97307e aya-log, aya-log-common: release version 0.1.10 2 years ago
dependabot[bot] 060ba45153 Update aya requirement from 0.10.7 to 0.11.0
Updates the requirements on [aya](https://github.com/aya-rs/aya) to permit the latest version.
- [Release notes](https://github.com/aya-rs/aya/releases)
- [Commits](https://github.com/aya-rs/aya/compare/aya-v0.10.7...aya-v0.11.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
Dave Tucker 0038b43627 Add CI
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker c1bb790c0d Add vim/vscode rust-analyzer settings
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 3f0085195f Add rustfmt.toml
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 5789585994 ebpf: Add example
This ensures that macro expansion works properly and that expanded code
compiles

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago