[OE-core] [PATCH 2/2] runqemu-ifdown: ensure to clean up TAP

Khem Raj raj.khem at gmail.com
Thu Jun 7 17:10:26 UTC 2018


On Thu, Jun 7, 2018 at 12:52 AM, Chen Qi <Qi.Chen at windriver.com> wrote:
> 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 <Qi.Chen at windriver.com>
> ---
>  scripts/runqemu-ifdown | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown
> index ffbc9de..2486968 100755
> --- a/scripts/runqemu-ifdown
> +++ b/scripts/runqemu-ifdown
> @@ -51,6 +51,16 @@ fi
>
>  $TUNCTL -d $TAP
>
> +IFCONFIG=`which ip 2> /dev/null`
> +if [ "x$IFCONFIG" = "x" ]; then
> +       # better than nothing...
> +       IFCONFIG=/sbin/ip
> +fi
> +if [ -x "$IFCONFIG" ]; then
> +       if `$IFCONFIG link show $TAP > /dev/null 2>&1`; then
> +               $IFCONFIG link del $TAP
> +       fi
> +fi

Ah this fixes my problem, Now I dont have to reboot the build box :)



More information about the Openembedded-core mailing list