Commit d7f4eec7 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

change format of mac to base 16

parent 914467e0
...@@ -28,8 +28,8 @@ impl EthernetFrame { ...@@ -28,8 +28,8 @@ impl EthernetFrame {
pub fn mac_str(mac: u64) -> String { pub fn mac_str(mac: u64) -> String {
let mut mac_string = String::new(); let mut mac_string = String::new();
let mut mac = mac; let mut mac = mac;
for _ in 0..8 { for _ in 0..6 {
mac_string = format!("{}:{}", mac as u8, mac_string); mac_string = format!("{:02x}:{}", mac as u8, mac_string);
mac = mac >> 8; mac = mac >> 8;
} }
mac_string.pop(); mac_string.pop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment