diff --git a/src/runtime-rs/crates/hypervisor/ch-config/src/convert.rs b/src/runtime-rs/crates/hypervisor/ch-config/src/convert.rs index 44e833ac48..89d97b0732 100644 --- a/src/runtime-rs/crates/hypervisor/ch-config/src/convert.rs +++ b/src/runtime-rs/crates/hypervisor/ch-config/src/convert.rs @@ -2,15 +2,14 @@ // // SPDX-License-Identifier: Apache-2.0 -use crate::net_util::MAC_ADDR_LEN; use crate::NamedHypervisorConfig; use crate::VmConfig; use crate::{ guest_protection_is_tdx, ConsoleConfig, ConsoleOutputMode, CpuFeatures, CpuTopology, - CpusConfig, DiskConfig, MacAddr, MemoryConfig, PayloadConfig, PlatformConfig, PmemConfig, - RngConfig, VsockConfig, + CpusConfig, DiskConfig, MemoryConfig, PayloadConfig, PlatformConfig, PmemConfig, RngConfig, + VsockConfig, }; -use anyhow::{anyhow, Context, Result}; +use anyhow::Result; use kata_sys_util::protection::GuestProtection; use kata_types::config::default::DEFAULT_CH_ENTROPY_SOURCE; use kata_types::config::hypervisor::Hypervisor as HypervisorConfig; @@ -19,7 +18,6 @@ use kata_types::config::hypervisor::{ }; use kata_types::config::BootInfo; use std::convert::TryFrom; -use std::fmt::Display; use std::path::PathBuf; use crate::errors::*; @@ -542,41 +540,6 @@ fn get_platform_cfg(guest_protection_to_use: GuestProtection) -> Option(s: &S) -> Result -where - S: AsRef + ?Sized + Display, -{ - let v: Vec<&str> = s.as_ref().split(':').collect(); - let mut bytes = [0u8; MAC_ADDR_LEN]; - - if v.len() != MAC_ADDR_LEN { - return Err(anyhow!( - "invalid MAC {} (length {}, expected {})", - s, - v.len(), - MAC_ADDR_LEN - )); - } - - for i in 0..MAC_ADDR_LEN { - if v[i].len() != 2 { - return Err(anyhow!( - "invalid MAC {} (segment {} length {}, expected {})", - s, - i, - v.len(), - 2 - )); - } - - bytes[i] = - u8::from_str_radix(v[i], 16).context(format!("failed to parse MAC address: {}", s))?; - } - - Ok(MacAddr { bytes }) -} - #[cfg(test)] mod tests { use super::*;