From a5c664cde55f633a97bdba419454fdb8eabd4d34 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Sun, 28 Dec 2025 08:39:03 -0700 Subject: [PATCH] Fix subnet if set manually --- usr/local/share/bastille/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/local/share/bastille/common.sh b/usr/local/share/bastille/common.sh index 9ff19c5f..f846411f 100644 --- a/usr/local/share/bastille/common.sh +++ b/usr/local/share/bastille/common.sh @@ -373,12 +373,12 @@ validate_ip() { if [ "${vnet_jail}" -eq 1 ]; then if [ -z "${subnet}" ]; then subnet="64" - ip6="${ip6}/${subnet}" elif ! echo "${subnet}" | grep -Eq '^[0-9]+$'; then error_exit "[ERROR]: Invalid subnet: /${subnet}" elif [ "${subnet}" -lt 1 ] || [ "${subnet}" -gt 128 ]; then error_exit "[ERROR]: Invalid subnet: /${subnet}" fi + ip6="${ip6}/${subnet}" fi info "\nValid IP: ${ip6}" export IP6_ADDR="${ip6}" @@ -393,12 +393,12 @@ validate_ip() { if [ "${vnet_jail}" -eq 1 ]; then if [ -z "${subnet}" ]; then subnet="24" - ip4="${ip4}/${subnet}" elif ! echo "${subnet}" | grep -Eq '^[0-9]+$'; then error_exit "[ERROR]: Invalid subnet: /${subnet}" elif [ "${subnet}" -lt 1 ] || [ "${subnet}" -gt 32 ]; then error_exit "[ERROR]: Invalid subnet: /${subnet}" fi + ip4="${ip4}/${subnet}" fi if echo "${ip4}" | grep -Eq '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))?$'; then test_ip=$(echo "${ip4}" | cut -d / -f1)