However, in both cases it apparently fails in the same exit path. It seems that the trapping is meant to call undo_network() on failure (which works), then undo_network() goes all the way to the end, and then the script just exits:
dnsmasq: failed to bind listening socket for fe80::188f:6ff:fe83:141: Address already in use
+ undo_network
+ [ -f /var/run/lxc/dnsmasq.pid ]
+ iptables -t nat -D POSTROUTING -s 10.0.3.0/24 -j MASQUERADE
[...]
+ echo * Failed to set up LXC network
* Failed to set up LXC network
root@ubuntu:~# echo $?
2
However, in both cases it apparently fails in the same exit path. It seems that the trapping is meant to call undo_network() on failure (which works), then undo_network() goes all the way to the end, and then the script just exits:
.0.3.1 --dhcp-range 10.0.3.2,10.0.3.254 --dhcp- lease-max= 253 --dhcp-no-override --except- interface= lo --interface=lxcbr0
dnsmasq: failed to bind listening socket for fe80::188f: 6ff:fe83: 141: Address already in use lxc/dnsmasq. pid ]
+ undo_network
+ [ -f /var/run/
+ iptables -t nat -D POSTROUTING -s 10.0.3.0/24 -j MASQUERADE
[...]
+ echo * Failed to set up LXC network
* Failed to set up LXC network
root@ubuntu:~# echo $?
2