From 8e9e7601f57b0decc118bc78bdb9f0a0f41a8385 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 16 May 2019 16:25:11 -0700 Subject: [PATCH] main: Fix --net behavior Recent refactoring of the flags parsing broke the --net behavior where the network tap interface should be created by the VMM if the user does not provide any argument to this option. Signed-off-by: Sebastien Boeuf --- src/main.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0abe1fab9..6e23d5556 100755 --- a/src/main.rs +++ b/src/main.rs @@ -80,9 +80,14 @@ fn main() { .map(std::string::ToString::to_string) .unwrap_or_else(String::new); - let net_params = cmd_arguments - .value_of("net") - .map(std::string::ToString::to_string); + let mut net_params = None; + if cmd_arguments.is_present("net") { + if let Some(net) = cmd_arguments.value_of("net") { + net_params = Some(net.to_string()); + } else { + net_params = Some(String::new()) + } + } let rng_path = match cmd_arguments.occurrences_of("rng") { 0 => None,