diff options
authorChen Qi <>2018-06-07 15:52:47 +0800
committerRichard Purdie <>2018-06-17 08:37:49 +0100
commit238ec6875e81d3525c33692e39c752ba527a11e1 (patch)
parent5035737cdb0c65d1ff523e3e089608b6e1606989 (diff)
runqemu-ifdown: ensure to clean up TAP
In runqemu-ifup, ip command is used to add TAP; in runqemu-ifdown, we should do the reversed logic, using ip command to delete TAP, to make sure TAP is cleaned up by ourselves. I can see that in runqemu-ifdown script, 'tunctl -d' and 'iptables' commands are used to deal with TAP, but these two commands cannot make sure that the TAP is cleaned up. runqemu-ifup uses 'ip' to set up TAP, we really need to do the opposite in runqemu-ifdown. Signed-off-by: Chen Qi <> Signed-off-by: Richard Purdie <>
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown
index ffbc9de442..2486968588 100755
--- a/scripts/runqemu-ifdown
+++ b/scripts/runqemu-ifdown
@@ -51,6 +51,16 @@ fi
+IFCONFIG=`which ip 2> /dev/null`
+if [ "x$IFCONFIG" = "x" ]; then
+ # better than nothing...
+ IFCONFIG=/sbin/ip
+if [ -x "$IFCONFIG" ]; then
+ if `$IFCONFIG link show $TAP > /dev/null 2>&1`; then
+ $IFCONFIG link del $TAP
+ fi
# cleanup the remaining iptables rules
IPTABLES=`which iptables 2> /dev/null`
if [ "x$IPTABLES" = "x" ]; then