From: Serge Hallyn Date: Thu, 19 Mar 2015 18:41:46 +0000 (+0000) Subject: lxc-net.conf: use +e at teardown X-Git-Tag: lxc-1.0.8~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4056340ae7ac5b3a6b31a47c5324df7328dccba0;p=thirdparty%2Flxc.git lxc-net.conf: use +e at teardown 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 Acked-by: Stéphane Graber --- diff --git a/config/init/upstart/lxc-net.conf b/config/init/upstart/lxc-net.conf index 279cd1eeb..d6b2165bf 100644 --- a/config/init/upstart/lxc-net.conf +++ b/config/init/upstart/lxc-net.conf @@ -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