From 06c7024479205f8dbe3051daddba06c9d6920b53 Mon Sep 17 00:00:00 2001 From: pythops Date: Wed, 11 Sep 2024 19:36:38 +0200 Subject: [PATCH] update mac addr display --- oryx-common/src/arp.rs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/oryx-common/src/arp.rs b/oryx-common/src/arp.rs index d224aec..4c7beb2 100644 --- a/oryx-common/src/arp.rs +++ b/oryx-common/src/arp.rs @@ -33,15 +33,20 @@ pub struct MacAddr(pub [u8; 6]); impl Display for MacAddr { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!( - f, - "{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", - self.0[0].to_be(), - self.0[1].to_be(), - self.0[2].to_be(), - self.0[3].to_be(), - self.0[4].to_be(), - self.0[5].to_be() - ) + //FIX: workaround for the moment + if self.0.iter().all(|x| *x == 0) { + write!(f, "ff:ff:ff:ff:ff:ff",) + } else { + write!( + f, + "{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", + self.0[0].to_be(), + self.0[1].to_be(), + self.0[2].to_be(), + self.0[3].to_be(), + self.0[4].to_be(), + self.0[5].to_be() + ) + } } }