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.