From eb9386236496f1bfca9361216684ba8fc306346a Mon Sep 17 00:00:00 2001 From: "Matthieu Baerts (NGI0)" Date: Wed, 27 Nov 2024 12:35:45 +0100 Subject: [PATCH] net: setup the loopback iface in a thread Now that setup_network() returns a vector of threads, it is easy to add an extra one. Setting up the loopback interface should be quick. Still, it can be done in parallel if there is nothing else depending on it. Signed-off-by: Matthieu Baerts (NGI0) --- src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index db368e2..137f5ef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -670,10 +670,15 @@ fn get_network_handle(network_dev: Option, guest_tools_dir: Option Option> { + return Some(thread::spawn(move || { + utils::run_cmd("ip", &["link", "set", "dev", "lo", "up"]); + })); +} + fn setup_network() -> Vec>> { - let mut vec = Vec::new(); + let mut vec = vec![setup_network_lo()]; - utils::run_cmd("ip", &["link", "set", "dev", "lo", "up"]); let cmdline = std::fs::read_to_string("/proc/cmdline").unwrap(); if cmdline.contains("virtme.dhcp") { if let Some(guest_tools_dir) = get_guest_tools_dir() {