]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-net.conf: use +e at teardown
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 19 Mar 2015 18:41:46 +0000 (18:41 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 6 Apr 2015 15:51:28 +0000 (11:51 -0400)
When we are shutting down the lxc network, we should not fail when
things go wrong, as that only makes it harder to clean up later.

See https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1429140 in particular

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
config/init/upstart/lxc-net.conf

index 279cd1eebe09a7833b14d93e4cef777d7c5cd901..d6b2165bf6b8b159524d132b1ccbacd7d5825b88 100644 (file)
@@ -23,6 +23,7 @@ pre-start script
        use_iptables_lock="-w"
        iptables -w -L -n > /dev/null 2>&1 || use_iptables_lock=""
        cleanup() {
+               set +e
                # dnsmasq failed to start, clean up the bridge
                iptables $use_iptables_lock -D INPUT -i ${LXC_BRIDGE} -p udp --dport 67 -j ACCEPT
                iptables $use_iptables_lock -D INPUT -i ${LXC_BRIDGE} -p tcp --dport 67 -j ACCEPT
@@ -34,6 +35,7 @@ pre-start script
                iptables $use_iptables_lock -t mangle -D POSTROUTING -o ${LXC_BRIDGE} -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill
                ifconfig ${LXC_BRIDGE} down || true
                brctl delbr ${LXC_BRIDGE} || true
+               set -e
        }
 
        if [ -d /sys/class/net/${LXC_BRIDGE} ]; then
@@ -73,6 +75,7 @@ post-stop script
        ls /sys/class/net/${LXC_BRIDGE}/brif/* > /dev/null 2>&1 && exit 0;
 
        if [ -d /sys/class/net/${LXC_BRIDGE} ]; then
+               set +e
                use_iptables_lock="-w"
                iptables -w -L -n > /dev/null 2>&1 || use_iptables_lock=""
                ifconfig ${LXC_BRIDGE} down
@@ -87,6 +90,7 @@ post-stop script
                pid=`cat ${varrun}/dnsmasq.pid 2>/dev/null` && kill -9 $pid || true
                rm -f ${varrun}/dnsmasq.pid
                brctl delbr ${LXC_BRIDGE}
+               set -e
        fi
        rm -f ${varrun}/network_up
 end script