Skip to content

Commit

Permalink
update mac addr display
Browse files Browse the repository at this point in the history
  • Loading branch information
pythops committed Sep 11, 2024
1 parent 74b6ddd commit 06c7024
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions oryx-common/src/arp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
}
}
}

0 comments on commit 06c7024

Please sign in to comment.