diff --git a/aya-log-common/src/lib.rs b/aya-log-common/src/lib.rs index c9554d62..b4e0af18 100644 --- a/aya-log-common/src/lib.rs +++ b/aya-log-common/src/lib.rs @@ -74,12 +74,10 @@ impl_formatter_for_types!( } ); -pub trait Ipv4Formatter {} -impl Ipv4Formatter for u32 {} - -pub trait Ipv6Formatter {} -impl Ipv6Formatter for [u8; 16] {} -impl Ipv6Formatter for [u16; 8] {} +pub trait IpFormatter {} +impl IpFormatter for u32 {} +impl IpFormatter for [u8; 16] {} +impl IpFormatter for [u16; 8] {} pub trait LowerMacFormatter {} impl LowerMacFormatter for [u8; 6] {} @@ -94,9 +92,7 @@ pub fn check_impl_lower_hex(_v: T) {} #[inline(always)] pub fn check_impl_upper_hex(_v: T) {} #[inline(always)] -pub fn check_impl_ipv4(_v: T) {} -#[inline(always)] -pub fn check_impl_ipv6(_v: T) {} +pub fn check_impl_ip(_v: T) {} #[inline(always)] pub fn check_impl_lower_mac(_v: T) {} #[inline(always)] diff --git a/aya-log-ebpf-macros/src/expand.rs b/aya-log-ebpf-macros/src/expand.rs index 953010bb..21eab976 100644 --- a/aya-log-ebpf-macros/src/expand.rs +++ b/aya-log-ebpf-macros/src/expand.rs @@ -90,8 +90,7 @@ fn hint_to_format_check(hint: DisplayHint) -> Result { DisplayHint::Default => parse_str("::aya_log_ebpf::macro_support::check_impl_default"), DisplayHint::LowerHex => parse_str("::aya_log_ebpf::macro_support::check_impl_lower_hex"), DisplayHint::UpperHex => parse_str("::aya_log_ebpf::macro_support::check_impl_upper_hex"), - DisplayHint::Ipv4 => parse_str("::aya_log_ebpf::macro_support::check_impl_ipv4"), - DisplayHint::Ipv6 => parse_str("::aya_log_ebpf::macro_support::check_impl_ipv6"), + DisplayHint::Ip => parse_str("::aya_log_ebpf::macro_support::check_impl_ip"), DisplayHint::LowerMac => parse_str("::aya_log_ebpf::macro_support::check_impl_lower_mac"), DisplayHint::UpperMac => parse_str("::aya_log_ebpf::macro_support::check_impl_upper_mac"), } diff --git a/bpf/aya-log-ebpf/src/lib.rs b/bpf/aya-log-ebpf/src/lib.rs index 777b8771..42f352b6 100644 --- a/bpf/aya-log-ebpf/src/lib.rs +++ b/bpf/aya-log-ebpf/src/lib.rs @@ -23,10 +23,10 @@ pub static mut AYA_LOGS: PerfEventByteArray = PerfEventByteArray::new(0); #[doc(hidden)] pub mod macro_support { pub use aya_log_common::{ - check_impl_default, check_impl_ipv4, check_impl_ipv6, check_impl_lower_hex, - check_impl_lower_mac, check_impl_upper_hex, check_impl_upper_mac, DefaultFormatter, - DisplayHint, Ipv4Formatter, Ipv6Formatter, Level, LowerHexFormatter, LowerMacFormatter, - UpperHexFormatter, UpperMacFormatter, LOG_BUF_CAPACITY, + check_impl_default, check_impl_ip, check_impl_lower_hex, check_impl_lower_mac, + check_impl_upper_hex, check_impl_upper_mac, DefaultFormatter, DisplayHint, IpFormatter, + Level, LowerHexFormatter, LowerMacFormatter, UpperHexFormatter, UpperMacFormatter, + LOG_BUF_CAPACITY, }; pub use aya_log_ebpf_macros::log; }