bastille
bastille copied to clipboard
Wrong gateway chosen on create vnet jail
[MANDATORY] Describe the bug [MANDATORY]
On dual network stack host creating a vnet jail results to having the ipv6 gateway assigned. Creating a second or more jails afterwards results in created without a "defaultrouter" in rc.conf Stopping all jails.
[MANDATORY] Bastille and FreeBSD version (paste bastille -v && freebsd-version -kru
output)
0.8.20210115
12.2-RELEASE-p1
12.2-RELEASE-p1
12.2-RELEASE-p1
[MANDATORY] How did you install bastille? (port/pkg/git) pkg
[optional] Steps to reproduce?
bastille create vnet alcatraz0 12.2-RELEASE 10.0.1.10/24 em0 [...creation...with ipv6 as defaultrouter in rc.conf] bastille create vnet alcatraz1 12.2-RELEASE 10.0.1.11/24 em0 [...no defaultrouter in rc.conf] bastille stop alcatraz0 bastille stop alcatraz1 bastille create vnet alcatraz2 12.2-RELEASE 10.0.1.12/24 em0 [...creation...with ipv6 as defaultrouter in rc.conf] bastille create vnet alcatraz3 12.2-RELEASE 10.0.1.13/24 em0 [...no defaultrouter in rc.conf] [and so on..]
[optional] Expected behavior
Choose the correct default gateway.
[optional] Screenshots
[optional] Note
The Problem seems to be around Line 386
...(netstat -rn | awk '/default/ {print $2}) ...
I can provide a fix if you think this is the problem, too.
The auto-detection is not always perfect. Gateway can be defined in the bastille.conf
using the bastille_network_gateway=aa.bb.cc.dd
will be used to override auto-detection.
In addition, there is also the problem, that there is no logic to set the IPv6 default gateway with sysrc: https://github.com/BastilleBSD/bastille/blob/master/usr/local/share/bastille/templates/default/vnet/Bastillefile