summaryrefslogtreecommitdiff
path: root/repo/vde2/vde2.post-down
blob: be5f5b31d880b4e215307f4fbee777a3368a1455 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

VDE_SWITCH=/usr/bin/vde_switch
SLIRPVDE=/usr/bin/slirpvde

# this is not an interesting stanza for us
if [ -z "$IF_VDE2_SWITCH" -a -z "$IF_VDE2_PLUG" -a -z "$IF_VDE2_SLIRP" ]; then
  exit 0
fi

PIDFILE="/var/run/vde2/$IFACE-plug.pid"
CTLFILE="/var/run/vde2/$IFACE.ctl"
if [ -f $PIDFILE ]; then
    start-stop-daemon --stop --quiet --pidfile $PIDFILE
    rm -f $PIDFILE
fi

PIDFILE="/var/run/vde2/$IFACE-slirp.pid"
if [ -f $PIDFILE ]; then
    start-stop-daemon --stop --quiet --pidfile $PIDFILE \
        --exec $SLIRPVDE
    rm -f $PIDFILE
fi

PIDFILE="/var/run/vde2/$IFACE.pid"
CTLDIR="/var/run/vde2/$IFACE.ctl"
if [ -f $PIDFILE ]; then
    start-stop-daemon --stop --quiet --pidfile $PIDFILE \
        --exec $VDE_SWITCH
    rm -f $PIDFILE

    # set the tap interface to non-persistant, see #568363
    vde_tunctl -b -d $IFACE 1>/dev/null
fi

rm -rf $CTLDIR
rm -f $CTLDIR.*