Commit Graph

1604 Commits (431ce23f27ef5c36a6b38c73b38f23b1cf007900)
 

Author SHA1 Message Date
Andre Fredette abb75ba029 Make doc fixes
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Alessandro Decina 88d7777553
Merge pull request #431 from 0b01/refs
aya: use impl Borrow<T> instead of T for maps
2 years ago
Alessandro Decina 0b41018ee2 Revert "aya-log, aya-log-common: temporarily revert to old map API so we can release"
This reverts commit 0d040d2290.
2 years ago
Alessandro Decina 832bdd280c {{crate_name}}: release version 0.1.13 2 years ago
Alessandro Decina 0d040d2290 aya-log, aya-log-common: temporarily revert to old map API so we can release 2 years ago
Alessandro Decina dfb03382f6 release.toml: fix pre/post release templates 2 years ago
Alessandro Decina 5d0527ae51 release.toml: dev-version* are gone too 2 years ago
Alessandro Decina a564ab6e5b release.toml: consolidate-pushes doesn't exist anymore 2 years ago
0b01 76e417a474 Fix formatting 2 years ago
Dave Tucker 3adb9b049f
Merge pull request #436 from vadorovsky/aya-log-mac-addr
aya-log: Add format hints for MAC addresses
2 years ago
tiann 49404367d8 bpf: Add bindings for uid and gid 2 years ago
Andre Fredette a3e3e80698 Support both attach() and attach_with_options() for SchedClassifier
Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Michal Rostecki 3e089a61d1
Merge pull request #435 from vadorovsky/pin-fix-error-msg
maps: Fix the error message in `MapData::pin()`
2 years ago
Michal Rostecki 2223ab828d aya-log: Add format hints for MAC addresses
Add `{:mac}` (for lower-case hex representation) and `{:MAC}` (for
upper-case hex representation) format hints for the `[u8; 6]` type,
which is the standard one in Linux to store physical addresses in.

Tested with: https://github.com/vadorovsky/aya-examples/tree/main/xdp-mac

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Michal Rostecki e0a9895260 maps: Fix the error message in `MapData::pin()`
The syscall name is `BPF_OBJ_PIN`, not `BPF_OBJ_GET`.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
2 years ago
Ricky Han 6ce60ad21d make sure everything is marked correctly 2 years ago
Ricky Han 9525b1a370 fix array 2 years ago
Ricky Han 575fea4cb9 fix wrong bounds 2 years ago
Ricky Han fbfbedb6a8 cargo fmt 2 years ago
Ricky Han 9991ffb093 Use & 2 years ago
Ricky Han e9ec257328 Add test case 2 years ago
Ricky Han 1247ffc19b Use Borrow<T> instead 2 years ago
Dmitry Savintsev 82773f46c8 Make the integration tests handle errors internally.
Instead of returning anyhow>>Result<()> handle errors
'in-place' with unwrap or panic, for more informative
and user-friendly error messages on test failures.

Fixes #421.

Signed-off-by: Dmitry Savintsev <dsavints@gmail.com>
2 years ago
Michal Rostecki 13bc70eec7
Merge pull request #428 from dmitris/ref-in-deref
fix clippy needless_borrow warnings
2 years ago
Dmitry Savintsev d0424fb091 fix clippy needless_borrow warning 2 years ago
Dmitry Savintsev d4a399fb0c Update CONTRIBUTING.md to link to the test/README.md
Co-authored-by: Michal Rostecki <vadorovsky@skiff.com>
2 years ago
Andre Fredette af3de84b08 Use a struct for setting priority and handle in SchedClassfier attach
Use a struct called TcOptions for setting priority and handle in SchedClassifier attach

struct TcOptions implements the Default trait, so for the simple use
case in which the defaults are acceptable, we can call attach as
follows:
attach(“eth0”, TcAttachType::Ingress, TcOptions::default())

To specify all options:
attach(“eth0”, TcAttachType::Ingress, TcOptions { priority: (50), handle: (3) })

Or, some options:
attach(“eth0”, TcAttachType::Ingress, TcOptions { priority: (50), ..Default::default() })

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Andre Fredette ac07608b79 Support using handle in tc programs
Implements step 1 of https://github.com/aya-rs/aya/issues/414.

- Adds handle to the SchedClassifier attach API
- Saves handle in the TcLink sruct and uses it when detaching programs

NOTE: this changes the API, so it will require a bump in the Aya version.

Signed-off-by: Andre Fredette <afredette@redhat.com>
2 years ago
Alessandro Decina d6cb1a16ad
Merge pull request #397 from astoycos/refactor-map-api2
Refactor map API
2 years ago
Andrew Stoycos 82edd681c3 Fix doc links, update rustdoc args
Fix some broken rust doc links.

Make sure rustdoc build fail on warnings
so we catch these broken links in CI.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Andrew Stoycos f3262e87bd Make map APIs return an option
switch map() and map_mut() from returning a
`Result` to an `Option` since it's just getting
a value from a Hashmap, and to stay in line with
the Programs API.

Remove `MapError::MapNotFound`

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Andrew Stoycos 4ddf2600b4 Fixups4
Remove From method and replace with internal
helper function.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Andrew Stoycos 440097d7bc Fixups 3
Remove MapError::UnexpectedMapType

Add Macro for converting from aya::Map to
u32 (map type) for use in
`MapError::InvalidMapType { map_type: x }`

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Michal Rostecki 89df8c36d3
Merge pull request #416 from aya-rs/dependabot/cargo/bindgen-0.61
build(deps): update bindgen requirement from 0.60 to 0.61
2 years ago
Andrew Stoycos 939d16cce5 Fixups 2
Respond to more review comments:

Revert to try_from in doctests so we don't need
to explicitly specify type parameters.

Fixup some documentation

Remove explit types in `try_from` methods

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Andrew Stoycos 8009361694 Fixups
Respond to review comments, specifically:

- Remove Map::map_type()

- Update some comments

- remove `docs` from feature macros

- generalize check_bounds, check_kv_size,
and check_v_size functions to remove
duplicate code

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Andrew Stoycos 893f9f44a2 Implement Copy for MapData
Implement Copy for MapData so that
when `take_map` is used we create a
1 to 1 mapping of MapData to internal
FileDescriptor.  This will ensure
that when MapData is used in multiple
tasks that we don't drop the FD before
all tasks are done using it.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Andrew Stoycos 898a14d425 Use SockMapFd
Create a new type called `SockMapFd` which is
solely used when a program needs to attach
to a socket map. In the future this same
tatic could be used for other use cases
so we may make this more generic.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Andrew Stoycos 1aefa2e5e6 Core refactor of Map API
Build completing tests passing

Refactor the Map API to better align
with the aya programs API.  Specifically
remove all internal locking mechanisms
and custom Deref/DerefMut implementations.
They are replaced with a Map enum
and AsRef/AsMut implementations.

All Try_From implementations have been moved
to standardized enums, with a slightly
special one for PerfEventArray's.

Also cleanup/fix all associated tests and
documentation.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago
Alessandro Decina 0a9c9960e4 Add Documentation section to CONTRIBUTING.md 2 years ago
dependabot[bot] 5717f17367
build(deps): update bindgen requirement from 0.60 to 0.61
Updates the requirements on [bindgen](https://github.com/rust-lang/rust-bindgen) to permit the latest version.
- [Release notes](https://github.com/rust-lang/rust-bindgen/releases)
- [Changelog](https://github.com/rust-lang/rust-bindgen/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/rust-bindgen/compare/v0.60.0...v0.61.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
Dave Tucker a0b0399dcd
Merge pull request #409 from abhijeetbhagat/integration-tests-cli-options
add list, run cli flags to integration tests.
2 years ago
abhijeetbhagat c83d012c51 preserve existing behavior and avoid changes to gh workflows/xtask 2 years ago
abhi 4183c7a7d2
Merge branch 'aya-rs:main' into integration-tests-cli-options 2 years ago
Dave Tucker 77c5543993
Merge pull request #408 from abhijeetbhagat/patch-1
add libelf as a pre-requisite for linux, libbpf repo link
2 years ago
Michal Rostecki 94bc93ea07
Merge pull request #411 from abhijeetbhagat/fix-warnings
fix all clippy warnings
2 years ago
abhijeetbhagat 6c813b8c38 fix all clippy warnings 2 years ago
Michal Rostecki 57ab0d7978
Merge pull request #406 from dave-tucker/unused-deps
cargo: Remove unused dependencies
2 years ago
abhijeetbhagat 7499661670 fix formatting 2 years ago
abhijeetbhagat 638cf514fb use macro to log, execute test and handle error 2 years ago