Compare commits

...

4 Commits

Author SHA1 Message Date
dependabot[bot] ce0c05b005
build(deps): update cargo_metadata requirement in the cargo-crates group
Updates the requirements on [cargo_metadata](https://github.com/oli-obk/cargo_metadata) to permit the latest version.

Updates `cargo_metadata` to 0.20.0
- [Release notes](https://github.com/oli-obk/cargo_metadata/releases)
- [Changelog](https://github.com/oli-obk/cargo_metadata/blob/main/CHANGELOG.md)
- [Commits](https://github.com/oli-obk/cargo_metadata/compare/0.20.0...0.20.0)

---
updated-dependencies:
- dependency-name: cargo_metadata
  dependency-version: 0.20.0
  dependency-type: direct:production
  dependency-group: cargo-crates
...

Signed-off-by: dependabot[bot] <support@github.com>
1 week ago
Xiaobo Liu 0b732c3d46 aya-log: simplify map name matching using direct Option comparison
Replace match statement with direct Option comparison for cleaner code

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
1 week ago
Xiaobo Liu cab559b9d9 aya-log: Use `None` instead of wildcard in `Format` impls
The `Format` implementations for various types were using a wildcard `_`
to match the `None` case on `Option<DisplayHint>`.

This is incorrect as it would also match any `Some(...)` variants that
were not explicitly handled, leading to unexpected behavior.

This commit changes the wildcard `_` to an explicit `None` match to
ensure that only the `None` case is handled, making the matching more
explicit and correct.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
1 week ago
Michal Rostecki 727dfcd7ee
ci: Fix bpf-linker installation (#1295)
We've recently added an xtask to bpf-linker (aya-rs/bpf-linker#282),
which resulted in multiple binary targets. Therefore, bpf-linker has
to be installed with the following command:

```
cargo install --git https://github.com/aya-rs/bpf-linker.git bpf-linker
```

The last argument (`bpf-linker`) specifies the binary target.
2 weeks ago

@ -170,7 +170,7 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo install --git https://github.com/aya-rs/bpf-linker.git - run: cargo install --git https://github.com/aya-rs/bpf-linker.git bpf-linker
- uses: taiki-e/install-action@cargo-hack - uses: taiki-e/install-action@cargo-hack
@ -297,7 +297,7 @@ jobs:
# --force so that bpf-linker gets always relinked against the latest LLVM downloaded above. # --force so that bpf-linker gets always relinked against the latest LLVM downloaded above.
# #
# Do this on all system (not just macOS) to avoid relying on rustc-provided libLLVM.so. # Do this on all system (not just macOS) to avoid relying on rustc-provided libLLVM.so.
- run: cargo install --git https://github.com/aya-rs/bpf-linker.git --no-default-features --force - run: cargo install --git https://github.com/aya-rs/bpf-linker.git bpf-linker --no-default-features --force
- uses: actions/cache@v4 - uses: actions/cache@v4
with: with:

@ -67,7 +67,7 @@ base64 = { version = "0.22.1", default-features = false }
bindgen = { version = "0.72", default-features = false } bindgen = { version = "0.72", default-features = false }
bitflags = { version = "2.2.1", default-features = false } bitflags = { version = "2.2.1", default-features = false }
bytes = { version = "1", default-features = false } bytes = { version = "1", default-features = false }
cargo_metadata = { version = "0.20.0", default-features = false } cargo_metadata = { version = "0.21.0", default-features = false }
clap = { version = "4", default-features = false } clap = { version = "4", default-features = false }
const-assert = { version = "1.0.1", default-features = false } const-assert = { version = "1.0.1", default-features = false }
dialoguer = { version = "0.11", default-features = false } dialoguer = { version = "0.11", default-features = false }

@ -151,10 +151,7 @@ impl<T: Log> EbpfLogger<T> {
.ok_or_else(|| Error::MapNotFound)? .ok_or_else(|| Error::MapNotFound)?
.iter() .iter()
.filter_map(|id| MapInfo::from_id(*id).ok()) .filter_map(|id| MapInfo::from_id(*id).ok())
.find(|map_info| match map_info.name_as_str() { .find(|map_info| map_info.name_as_str() == Some(MAP_NAME))
Some(name) => name == MAP_NAME,
None => false,
})
.ok_or(Error::MapNotFound)?; .ok_or(Error::MapNotFound)?;
let map = MapData::from_id(map.id())?; let map = MapData::from_id(map.id())?;
@ -295,7 +292,7 @@ impl Format for u32 {
Some(DisplayHint::Ip) => Ok(Ipv4Formatter::format(*self)), Some(DisplayHint::Ip) => Ok(Ipv4Formatter::format(*self)),
Some(DisplayHint::LowerMac) => Err(()), Some(DisplayHint::LowerMac) => Err(()),
Some(DisplayHint::UpperMac) => Err(()), Some(DisplayHint::UpperMac) => Err(()),
_ => Ok(DefaultFormatter::format(self)), None => Ok(DefaultFormatter::format(self)),
} }
} }
} }
@ -351,7 +348,7 @@ impl Format for [u8; 6] {
Some(DisplayHint::Ip) => Err(()), Some(DisplayHint::Ip) => Err(()),
Some(DisplayHint::LowerMac) => Ok(LowerMacFormatter::format(*self)), Some(DisplayHint::LowerMac) => Ok(LowerMacFormatter::format(*self)),
Some(DisplayHint::UpperMac) => Ok(UpperMacFormatter::format(*self)), Some(DisplayHint::UpperMac) => Ok(UpperMacFormatter::format(*self)),
_ => Err(()), None => Err(()),
} }
} }
} }
@ -365,7 +362,7 @@ impl Format for [u8; 16] {
Some(DisplayHint::Ip) => Ok(Ipv6Formatter::format(*self)), Some(DisplayHint::Ip) => Ok(Ipv6Formatter::format(*self)),
Some(DisplayHint::LowerMac) => Err(()), Some(DisplayHint::LowerMac) => Err(()),
Some(DisplayHint::UpperMac) => Err(()), Some(DisplayHint::UpperMac) => Err(()),
_ => Err(()), None => Err(()),
} }
} }
} }
@ -379,7 +376,7 @@ impl Format for [u16; 8] {
Some(DisplayHint::Ip) => Ok(Ipv6Formatter::format(*self)), Some(DisplayHint::Ip) => Ok(Ipv6Formatter::format(*self)),
Some(DisplayHint::LowerMac) => Err(()), Some(DisplayHint::LowerMac) => Err(()),
Some(DisplayHint::UpperMac) => Err(()), Some(DisplayHint::UpperMac) => Err(()),
_ => Err(()), None => Err(()),
} }
} }
} }
@ -395,7 +392,7 @@ macro_rules! impl_format {
Some(DisplayHint::Ip) => Err(()), Some(DisplayHint::Ip) => Err(()),
Some(DisplayHint::LowerMac) => Err(()), Some(DisplayHint::LowerMac) => Err(()),
Some(DisplayHint::UpperMac) => Err(()), Some(DisplayHint::UpperMac) => Err(()),
_ => Ok(DefaultFormatter::format(self)), None => Ok(DefaultFormatter::format(self)),
} }
} }
} }
@ -424,7 +421,7 @@ macro_rules! impl_format_float {
Some(DisplayHint::Ip) => Err(()), Some(DisplayHint::Ip) => Err(()),
Some(DisplayHint::LowerMac) => Err(()), Some(DisplayHint::LowerMac) => Err(()),
Some(DisplayHint::UpperMac) => Err(()), Some(DisplayHint::UpperMac) => Err(()),
_ => Ok(DefaultFormatter::format(self)), None => Ok(DefaultFormatter::format(self)),
} }
} }
} }

Loading…
Cancel
Save