From b6538a429980e3e35cbd4be14d1fb6fb92b98586 Mon Sep 17 00:00:00 2001 From: Kunhui-Li Date: Fri, 18 Mar 2022 13:44:01 +0800 Subject: [PATCH] config_tools: fix the issue that got wrong device name after specifying mac address If user add the specific mac address (eg: mac=00:16:3E:77:A9:41) in launch script, we will get the device name with the specified mac address. This is unexpected. This patch updates the parser to fix the issue. v1-->v2: Update the parser with regex. Tracked-On: #7197 Signed-off-by: Kunhui-Li Reviewed-by: Junjie Mao --- misc/config_tools/launch_config/launch_script_template.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/config_tools/launch_config/launch_script_template.sh b/misc/config_tools/launch_config/launch_script_template.sh index 4c333af81..b0adb2be8 100644 --- a/misc/config_tools/launch_config/launch_script_template.sh +++ b/misc/config_tools/launch_config/launch_script_template.sh @@ -127,8 +127,10 @@ function add_virtual_device() { if [ "${kind}" = "virtio-net" ]; then # Create the tap device - tap_conf=${options%,*} - create_tap "${tap_conf#tap=}" >> /dev/stderr + if [[ ${options} =~ tap=([^,]+) ]]; then + tap_conf="${BASH_REMATCH[1]}" + create_tap "${tap_conf}" >> /dev/stderr + fi fi echo -n "-s ${slot},${kind}"