Commit 4056340a by Serge Hallyn Committed by Stéphane Graber

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: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent dbbfd438
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment