From dd3b2e8e62f19d2c276a0b19a3b1267c4520dfcf Mon Sep 17 00:00:00 2001 From: Daniel Dowse Date: Wed, 3 Mar 2021 15:20:16 +0100 Subject: [PATCH] If dual stack ip6 gw will be last will be the last output line of netstat ... comand in _gateway --- usr/local/share/bastille/create.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr/local/share/bastille/create.sh b/usr/local/share/bastille/create.sh index 1562d600..abdb215f 100644 --- a/usr/local/share/bastille/create.sh +++ b/usr/local/share/bastille/create.sh @@ -383,7 +383,11 @@ create_jail() { if [ -n "${bastille_network_gateway}" ]; then _gateway="${bastille_network_gateway}" else - _gateway="$(netstat -rn | awk '/default/ {print $2}')" + if [ -z ${ip6} ]; then + _gateway="$(netstat -4rn | awk '/default/ {print $2}')" + else + _gateway="$(netstat -6rn | awk '/default/ {print $2}')" + fi fi fi bastille template "${NAME}" ${bastille_template_vnet} --arg BASE_TEMPLATE="${bastille_template_base}" --arg HOST_RESOLV_CONF="${bastille_resolv_conf}" --arg EPAIR="${uniq_epair}" --arg GATEWAY="${_gateway}" --arg IFCONFIG="${_ifconfig}"