Skip to content

aya-log-v0.2.1

Compare
Choose a tag to compare
@dave-tucker dave-tucker released this 09 Oct 11:11
· 60 commits to main since this release

Chore

  • Rename bpf -> ebpf

Documentation

  • reword rustdocs a bit

New Features

  • Rename Bpf to Ebpf
    And BpfLoader to EbpfLoader.
    This also adds type aliases to preserve the use of the old names, making
    updating to a new Aya release less of a burden. These aliases are marked
    as deprecated since we'll likely remove them in a later release.
  • Rename BpfLogger to EbpfLogger

Bug Fixes

  • print &[u8] using full width
    Otherwise &[1u8, 0u8] cannot be distinguished from &[0x10u8] (they both become 10)

Other

  • remove unwrap and NonZero* in info
    Addresses the feedback from #1007:

    • remove panic from unwrap and expect
    • Option<NonZero*> => Option with 0 mapping to None
  • revamp MapInfo be more friendly with older kernels
    Adds detection for whether a field is available in MapInfo:

    • For map_type(), we treturn new enum MapType instead of the integer
      representation.
    • For fields that can't be zero, we return Option<NonZero*> type.
    • For name_as_str(), it now uses the feature probe bpf_name() to
      detect if field is available.
      Although the feature probe checks for program name, it can also be
      used for map name since they were both introduced in the same commit.
  • revamp ProgramInfo be more friendly with older kernels
    Purpose of this commit is to add detections for whether a field is
    available in ProgramInfo.

    • For program_type(), we return the new enum ProgramType instead of
      the integer representation.
    • For fields that we know cannot be zero, we return Option<NonZero*>
      type.
    • For name_as_str(), it now also uses the feature probe bpf_name()
      to detect if field is available or not.
    • Two additional feature probes are added for the fields:
      • prog_info_map_ids() probe -> map_ids() field
      • prog_info_gpl_compatible() probe -> gpl_compatible() field

    With the prog_info_map_ids() probe, the previous implementation that
    I had for bpf_prog_get_info_by_fd() is shortened to use the probe
    instead of having to make 2 potential syscalls.

    The test_loaded_at() test is also moved into info tests since it is
    better related to the info tests.

  • Allow logging core::net::Ipv4Addr and core::net::Ipv6Addr
    IP address types are available in core, so they can be used also in
    eBPF programs. This change adds support of these types in aya-log.

    • Add implementation of WriteTuBuf to these types.
    • Support these types in Ipv4Formatter and Ipv6Formatter.
    • Support them with DisplayHint::Ip.
    • Add support for formatting [u8; 4], to be able to handle
      Ipv4Addr::octets.
  • allow re-attach and read previously created logs
    This feature is useful if someone wants to view the log contents
    of a program that is already running. For e.g. a pinned program
    or an XDP program attached to a net interface.

Test

  • adjust test byte arrays for big endian
    Adding support for s390x (big endian architecture) and found that some
    of the unit tests have structures and files implemented as byte arrays.
    They are all coded as little endian and need a bug endian version to
    work properly.

Commit Statistics

  • 20 commits contributed to the release.
  • 223 days passed between releases.
  • 11 commits were understood as conventional.
  • 1 unique issue was worked on: #1008

Commit Details

view details
  • #1008
    • Print &[u8] using full width (55ed9e0)
  • Uncategorized
    • Release aya-log-common v0.1.15, aya-log-ebpf v0.1.1 (04bbbcc)
    • Release aya-obj v0.2.0, aya v0.13.0, safety bump aya v0.13.0 (c169b72)
    • Reduce duplication in {nr,possible}_cpus (f3b2744)
    • Remove unwrap and NonZero* in info (02d1db5)
    • Merge pull request #1007 from tyrone-wu/aya/info-api (15eb935)
    • Revamp MapInfo be more friendly with older kernels (fbb0930)
    • Revamp ProgramInfo be more friendly with older kernels (88f5ac3)
    • Merge pull request #974 from Billy99/billy99-arch-ppc64-s390x (ab5e688)
    • Adjust test byte arrays for big endian (eef7346)
    • Revert "Remove unused allow(dead_code)" (4161993)
    • Remove unused allow(dead_code) (5397c1c)
    • Allow logging core::net::Ipv4Addr and core::net::Ipv6Addr (a75fc2f)
    • Merge pull request #900 from catalin-h/log_init_from_program_id (e5d107d)
    • Reword rustdocs a bit (8830c0b)
    • Allow re-attach and read previously created logs (e66f954)
    • Merge pull request #528 from dave-tucker/rename-all-the-things (63d8d4d)
    • Rename Bpf to Ebpf (8c79b71)
    • Rename BpfLogger to EbpfLogger (a93e354)
    • Rename bpf -> ebpf (41c6156)