diff --git a/net_util/src/open_tap.rs b/net_util/src/open_tap.rs index e711529ca..e02e3b5e8 100644 --- a/net_util/src/open_tap.rs +++ b/net_util/src/open_tap.rs @@ -135,7 +135,7 @@ pub fn open_tap( // same device. tap = open_tap_rx_q_0(if_name, ip_addr, netmask, host_mac, mtu, num_rx_q, flags)?; // Set the name of the tap device we open in subsequent iterations. - ifname = String::from_utf8(tap.get_if_name()).unwrap(); + ifname = String::from_utf8(tap.get_if_name().to_vec()).unwrap(); } else { tap = Tap::open_named(ifname.as_str(), num_rx_q, flags).map_err(Error::TapOpen)?; diff --git a/net_util/src/tap.rs b/net_util/src/tap.rs index 1dc0b7f48..bc841de11 100644 --- a/net_util/src/tap.rs +++ b/net_util/src/tap.rs @@ -481,8 +481,8 @@ impl Tap { ifreq } - pub fn get_if_name(&self) -> Vec { - self.if_name.clone() + pub fn get_if_name(&self) -> &[u8] { + &self.if_name } #[cfg(fuzzing)]