From 1871fbec7b8ad6fda759338389017bc478905735 Mon Sep 17 00:00:00 2001 From: Logan V Date: Sun, 1 Apr 2018 22:41:24 -0500 Subject: [PATCH] Fix lxc-system-manage ipv6 setup When the lxc-dnsmasq service is restarted while ipv6 is active, it will always fail to restart because the ip -6 addr add command fails due to the address already existing on the interface. ex. Apr 01 22:39:48 lsn-mc1009 systemd[1]: Starting lxc dnsmasq service... Apr 01 22:39:48 lsn-mc1009 lxc-system-manage[19134]: Creating LXC IPtables rules. Apr 01 22:39:48 lsn-mc1009 lxc-system-manage[19134]: RTNETLINK answers: File exists Apr 01 22:39:48 lsn-mc1009 systemd[1]: lxc-dnsmasq.service: Control process exited, code=exited status=2 Apr 01 22:39:48 lsn-mc1009 systemd[1]: Failed to start lxc dnsmasq service. Apr 01 22:39:48 lsn-mc1009 systemd[1]: lxc-dnsmasq.service: Unit entered failed state. Apr 01 22:39:48 lsn-mc1009 systemd[1]: lxc-dnsmasq.service: Failed with result 'exit-code'. Apr 01 22:39:50 lsn-mc1009 systemd[1]: lxc-dnsmasq.service: Service hold-off time over, scheduling restart. Change-Id: Ia3ebaf2125a00c4031f50bf03b60dd5659f9d660 --- templates/lxc-system-manage.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/lxc-system-manage.j2 b/templates/lxc-system-manage.j2 index 3b48d1d7..21df4f39 100644 --- a/templates/lxc-system-manage.j2 +++ b/templates/lxc-system-manage.j2 @@ -95,7 +95,7 @@ function add_rules { if [ -n "$LXC_IPV6_ADDR" ] && [ -n "$LXC_IPV6_MASK" ] && [ -n "$LXC_IPV6_NETWORK" ]; then echo 1 > /proc/sys/net/ipv6/conf/all/forwarding echo 0 > /proc/sys/net/ipv6/conf/${LXC_BRIDGE}/autoconf - ip -6 addr add dev ${LXC_BRIDGE} ${LXC_IPV6_ADDR}/${LXC_IPV6_MASK} + ip -6 addr add dev ${LXC_BRIDGE} ${LXC_IPV6_ADDR}/${LXC_IPV6_MASK} || true if [ "$LXC_IPV6_NAT" = "true" ]; then ip6tables $USE_IPTABLES_LOCK -t nat -A POSTROUTING -s ${LXC_IPV6_NETWORK} ! -d ${LXC_IPV6_NETWORK} -j MASQUERADE fi