Commit Graph

1412 Commits (1c5f2339e72175ca2523096afb4adacde3b37aea)
 

Author SHA1 Message Date
Tuetuopay 1c5f2339e7 bpf: make xdp maps functions safe
Values in those map are small enough to return copied values instead of
reference to values.
2 years ago
Tuetuopay 4bf7176559 aya: fix docstring missing trailing period 2 years ago
Tuetuopay f1a78b11b6 xdp: add support for chained xdp programs in {cpu,dev}map
set/insert functions can now take an optional bpf program fd to run once
the packet has been redirected from the main probe
2 years ago
Tuetuopay 6fbde9502d aya: add support for map-bound XDP programs
Such programs are to be bound to cpumap or devmap instead of the usual
network interfaces.
2 years ago
Tuetuopay 250cbb7c39 macros: add 'map' option to xdp macro
This option allows to place the program in the specific sections to
chain programs with devmaps and cpumaps.
2 years ago
Tuetuopay 066cb0444c bpf: Update XDP maps implementation
The implementation changed since the original commit was written, and
some mistakes went in:
- missing bpf_redirect_map wrapper
- extra bpf_map_lookup_elem on maps for which it is forbidden
2 years ago
Tuetuopay 6350709115 aya: Update XDP maps implementations
Map impls changed since this was first written.

Fixes: 2b726c8 ("aya: Implement XDP Map Types")
2 years ago
Dave Tucker 5d7fd7f9ca bpf: Implement XDP maps
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Dave Tucker 125257780b aya: Implement XDP Map Types
This commit adds implementations for:
- xskmap
- devmap
- devmap_hash
- cpumap

Which can all be used to redirect XDP packets to various different
locations

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 years ago
Tamir Duberstein e9690df834
Merge pull request #766 from aya-rs/obj-better-sense
aya-obj: reduce indirection in section parsing
2 years ago
Tamir Duberstein c139627f8f aya-obj: reduce indirection in section parsing
Remove repetition of permitted cgroup attach types. Make optionality of
name more explicit rather than pretending both kind and name are equal
to section.
2 years ago
Tamir Duberstein 116ddbd18d
Merge pull request #767 from aya-rs/fix-ci-again
github: fix CI
2 years ago
Tamir Duberstein 7803db22a0
github: remove symlinks to apple-provided python
See https://github.com/actions/setup-python/issues/577.
2 years ago
Tamir Duberstein f988e97b5f
Upgrade public-api
This fixes `cargo xtask public-api` by picking up
https://github.com/aDotInTheVoid/rustdoc-types/commit/577a774c2433beda6.
2 years ago
Tamir Duberstein 782eb85d4a
xtask: extract `Errors` type
This produces better errors in `cargo xtask public-api` because before
this change we'd print errors as display, which didn't show context.

Before:
```
Error: public API errors:
aya failed to check public API: public_api::Builder::build
aya-obj failed to check public API: public_api::Builder::build
aya-log failed to check public API: public_api::Builder::build
aya-log-common failed to check public API: public_api::Builder::build
aya-log-parser failed to check public API: public_api::Builder::build
aya-tool failed to check public API: public_api::Builder::build
aya-bpf failed to check public API: public_api::Builder::build
aya-bpf-bindings failed to check public API: public_api::Builder::build
aya-bpf-cty failed to check public API: public_api::Builder::build
aya-bpf-macros failed to check public API: public_api::Builder::build
aya-log-ebpf-macros failed to check public API: public_api::Builder::build
```

After:
```
Error: aya failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `struct`, `struct_field`, `union`, `enum`, `variant`, `function`, `typedef`, `opaque_ty`, `constant`, `trait`, `trait_alias`, `impl`, `static`, `foreign_type`, `macro`, `proc_attribute`, `proc_derive`, `assoc_const`, `assoc_type`, `primitive`, `keyword` at line 1 column 3082463
aya-obj failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `union`, `struct`, `struct_field`, `enum`, `variant`, `function`, `trait`, `trait_alias`, `impl`, `typedef`, `opaque_ty`, `constant`, `static`, `foreign_type`, `macro`, `proc_macro`, `primitive`, `assoc_const`, `assoc_type` at line 1 column 129355
aya-log failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `struct`, `struct_field`, `union`, `enum`, `variant`, `function`, `typedef`, `opaque_ty`, `constant`, `trait`, `trait_alias`, `impl`, `static`, `foreign_type`, `macro`, `proc_attribute`, `proc_derive`, `assoc_const`, `assoc_type`, `primitive`, `keyword` at line 1 column 311910
aya-log-common failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `union`, `struct`, `struct_field`, `enum`, `variant`, `function`, `trait`, `trait_alias`, `impl`, `typedef`, `opaque_ty`, `constant`, `static`, `foreign_type`, `macro`, `proc_macro`, `primitive`, `assoc_const`, `assoc_type` at line 1 column 130456
aya-log-parser failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `struct`, `struct_field`, `union`, `enum`, `variant`, `function`, `typedef`, `opaque_ty`, `constant`, `trait`, `trait_alias`, `impl`, `static`, `foreign_type`, `macro`, `proc_attribute`, `proc_derive`, `assoc_const`, `assoc_type`, `primitive`, `keyword` at line 1 column 204930
aya-tool failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `struct`, `struct_field`, `union`, `enum`, `variant`, `function`, `typedef`, `opaque_ty`, `constant`, `trait`, `trait_alias`, `impl`, `static`, `foreign_type`, `macro`, `proc_attribute`, `proc_derive`, `assoc_const`, `assoc_type`, `primitive`, `keyword` at line 1 column 234519
aya-bpf failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `struct`, `struct_field`, `union`, `enum`, `variant`, `function`, `typedef`, `opaque_ty`, `constant`, `trait`, `trait_alias`, `impl`, `static`, `foreign_type`, `macro`, `proc_attribute`, `proc_derive`, `assoc_const`, `assoc_type`, `primitive`, `keyword` at line 1 column 741697
aya-bpf-bindings failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `union`, `struct`, `struct_field`, `enum`, `variant`, `function`, `trait`, `trait_alias`, `impl`, `typedef`, `opaque_ty`, `constant`, `static`, `foreign_type`, `macro`, `proc_macro`, `primitive`, `assoc_const`, `assoc_type` at line 1 column 112445
aya-bpf-cty failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `union`, `struct`, `struct_field`, `enum`, `variant`, `function`, `trait`, `trait_alias`, `impl`, `typedef`, `opaque_ty`, `constant`, `static`, `foreign_type`, `macro`, `proc_macro`, `primitive`, `assoc_const`, `assoc_type` at line 1 column 315
aya-bpf-macros failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `struct`, `struct_field`, `union`, `enum`, `variant`, `function`, `typedef`, `opaque_ty`, `constant`, `trait`, `trait_alias`, `impl`, `static`, `foreign_type`, `macro`, `proc_attribute`, `proc_derive`, `assoc_const`, `assoc_type`, `primitive`, `keyword` at line 1 column 186226
aya-log-ebpf-macros failed to check public API

Caused by:
    0: public_api::Builder::build
    1: unknown variant `type_alias`, expected one of `module`, `extern_crate`, `import`, `struct`, `struct_field`, `union`, `enum`, `variant`, `function`, `typedef`, `opaque_ty`, `constant`, `trait`, `trait_alias`, `impl`, `static`, `foreign_type`, `macro`, `proc_attribute`, `proc_derive`, `assoc_const`, `assoc_type`, `primitive`, `keyword` at line 1 column 158055
```
2 years ago
Tamir Duberstein c0bc1866d8
github: update 6.4.0 URLs
Seems the previous spin was pulled.
2 years ago
Tamir Duberstein 461c2759c5
Merge pull request #765 from aya-rs/more-utf8-fixes
aya: support non-UTF8 probing
2 years ago
Tamir Duberstein 1ccfdbc175
aya: support non-UTF8 probing
Fixes #751.
2 years ago
Tamir Duberstein 8ffd9bb236
Merge pull request #742 from aya-rs/avoid-utf-assumption
maps,programs: avoid path UTF-8 assumptions
2 years ago
Tamir Duberstein 0bba9b14b0
maps,programs: avoid path UTF-8 assumptions 2 years ago
Tamir Duberstein 572d047e37
test: avoid lossy string conversions
We can be strict in tests.
2 years ago
Tamir Duberstein ff8c124770
Merge pull request #763 from aya-rs/lints
aya: deny various allow-by-default lints
2 years ago
Tamir Duberstein fb00fa13f3
Merge pull request #762 from aya-rs/remove-workaround
integration-test: Remove cargo symlink workaround
2 years ago
Tamir Duberstein ca2e43d318
integration-test: Remove cargo symlink workaround
https://github.com/rust-lang/cargo/pull/12369 fixed this bug and was
picked up in https://github.com/rust-lang/rust/pull/114027.
2 years ago
Tamir Duberstein abda239d63
aya: deny various allow-by-default lints
Notably:
- clippy::use_self: replaced many T with Self.
- single_use_lifetimes: removed some single use lifetimes.
- unreachable_pub: removed some unreachable pub items.
- unused_crate_dependencies: removed unused futures,parking_lot deps.
- unused_qualifications: found a potential `crate` vs `$crate` bug.
- let_underscore_drop: not enabled, seems to trigger false positives.
- missing_copy_implementations: not enabled, unclear if we want this.
- unsafe_op_in_unsafe_fn: not enabled, unclear if we want this.
- unused_results: not enabled, needs many fixes (but I think wanted).
2 years ago
vadorovsky 1fa1241ccb
Merge pull request #764 from aya-rs/fix-docs
aya: fix docs build
2 years ago
Tamir Duberstein b91d90d6b9
github: build qemu from source if bad signature
See https://github.com/Homebrew/homebrew-core/issues/140244.
2 years ago
Tamir Duberstein 9ff1bf3d3b
aya: fix docs build
Appease the new lint rustdoc::redundant_explicit_links that was added in
https://github.com/rust-lang/rust/pull/113167.
2 years ago
Tamir Duberstein 47a09a4ec9
Merge pull request #761 from aya-rs/mac-broken-qemu
Fix macOS CI
2 years ago
Tamir Duberstein 756e6b979a
github: brew reinstall qemu
See https://github.com/Homebrew/homebrew-core/pull/139492.
2 years ago
Tamir Duberstein 9ba0b04207
github: use gnubin rather than bespoke symlinks 2 years ago
Tamir Duberstein 1d5f764d07
Merge pull request #758 from aya-rs/map-fd-not-option
aya: MapData::fd is non-optional
2 years ago
Tamir Duberstein a31544b6e7
maps: BloomFilter::insert takes &mut self
This is consistent with all the other maps.
2 years ago
Tamir Duberstein 89bc255f1d
aya: MapData::fd is non-optional
The primary driver of change here is that `MapData::create` is now a
factory function that returns `Result<Self, _>` rather than mutating
`&mut self`. The remaining changes are consequences of that change, the
most notable of which is the removal of several errors which are no
longer possible.
2 years ago
Tamir Duberstein c7b5cd5eb5
Merge pull request #757 from aya-rs/attach-fd-owned
programs: `ProgramData::attach_prog_fd` is owned
2 years ago
Tamir Duberstein 3d68fa32cb
aya: use RAII to close FDs 2 years ago
Tamir Duberstein ae6526e59b
programs: `ProgramData::attach_prog_fd` is owned
This prevents a file descriptor leak when extensions are used.

This is an API breaking change.

Updates #612.
2 years ago
Tamir Duberstein 8b3a93161d
xtask: bless API with new nightly 2 years ago
dependabot[bot] befa55eafc
Merge pull request #755 from aya-rs/dependabot/cargo/num_enum-0.7 2 years ago
dependabot[bot] 623cfd89bf
build(deps): update num_enum requirement from 0.6 to 0.7
Updates the requirements on [num_enum](https://github.com/illicitonion/num_enum) to permit the latest version.
- [Commits](https://github.com/illicitonion/num_enum/compare/0.6.0...0.6.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
dependabot[bot] 9b72d6d260
Merge pull request #754 from aya-rs/dependabot/cargo/object-0.32 2 years ago
dependabot[bot] d0838a7688
build(deps): update object requirement from 0.31 to 0.32
Updates the requirements on [object](https://github.com/gimli-rs/object) to permit the latest version.
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.31.0...0.31.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2 years ago
Tamir Duberstein e813a054ad
Merge pull request #744 from aya-rs/programfd-borrowed
programs: `ProgramFd` is owned
2 years ago
Tamir Duberstein 504fd1df0a
programs: `ProgramFd` is owned
`ProgramData::fd` is now a `ProgramFd`. This means that `ProgramData`
now closes the file descriptor on drop. In the future we might consider
making `ProgramFd` hold a `BorrowedFd` but this requires API design work
due to overlapping borrows.

Since `ProgramFd` is no longer `Copy`, update methods to take it by
reference to allow callers to use it multiple times as they are
accustomed to doing.

`ProgramFd` is now returned by reference and implements `try_clone` to
allow callers to avoid file descriptor cloning when desired.

This is an API breaking change.

Updates #612.
2 years ago
Tamir Duberstein 7874ad99f7
Merge pull request #756 from aya-rs/wget
github: fix CI
2 years ago
Tamir Duberstein 6740c43a02
github: update 6.4.0 URLs
Seems the previous spin was pulled.
2 years ago
Tamir Duberstein 89eafd139d
github: use gxargs on macOS
`xargs -P0` always exits 0 on macOS, even on error.
2 years ago
Tamir Duberstein 47a8a4b878
github: reduce wget verbosity, remove -q
This allows errors to be shown; -q hides *all* output, which is not what
we want.
2 years ago
Andrew Stoycos bcc9743254
Merge pull request #637 from astoycos/helpers
Add more helpful methods to `ProgramInfo`
2 years ago
Andrew Stoycos e1a556894c
aya: add helper methods for ProgramInfo
- Add helper methods to get useful information from the ProgramInfo
object which is returned by the `loaded_programs()` API.  Specifically
this code mirrors the `bpftool prog` command in terms of useful fields.
- Add a new API macro to each aya `Program` type to allow us to fetch
its accompanying `ProgramInfo` metadata after its been loaded.
- Add a new ProgramInfo constructor that builds a new instance using
a raw fd.
- Add a smoke test for the loaded_programs() API as well as
all the relevant methods on the ProgramInfo type.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
2 years ago