From faf26220a7bfd782ce0844af116d10d20ecfd389 Mon Sep 17 00:00:00 2001 From: Wenjia Zhang Date: Fri, 22 Jan 2021 08:57:35 +0100 Subject: [PATCH] hsci: fix failed to delete an HSCI connected with VLAN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deleting an HSCI interface, the connected HiperSockets interface's name and the connected Ethernet interface's name are extracted from "ip link show". Currently the extracted names are directly used in "bridge -d link show dev ifname" for further checking. If "iflink" and "ifindex" of an interface are not matched, ip commands will print @ifXX appended to the real interface's name. Thus, it will be failed if the interface's name with the ending @ifXX is used in "bridge -d link show dev ifname" for further checking. To solve the problem, the ending @ifXX must be removed before the interface name is used further. Signed-off-by: Wenjia Zhang Signed-off-by: Jan Höppner --- hsci/hsci | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hsci/hsci b/hsci/hsci index d1cf3b5a..33dd00d0 100755 --- a/hsci/hsci +++ b/hsci/hsci @@ -303,10 +303,14 @@ function del_hsci { bports="$(ip link show | grep "master $hsci" | awk '{print $2}')" for bport in $bports; do + bport=${bport%:} + if [[ $bport == *@* ]]; then + bport=${bport%@*} + fi if [ $(bridge -d link show dev $bport | grep "learning_sync on" | wc -l) -ne 0 ]; then - hsdev=${bport%:} + hsdev=$bport else - ndev=${bport%:} + ndev=$bport fi done if [ "$hsdev" == "" ]; then