diff options
author | Adam Warner <me@adamwarner.co.uk> | 2020-11-30 21:58:23 +0300 |
---|---|---|
committer | Adam Warner <me@adamwarner.co.uk> | 2020-11-30 21:58:23 +0300 |
commit | e004d27b28bf3da43101948903c56a7cf66be4eb (patch) | |
tree | bba7efbbe18ec907ca8b257fd6267b07e0485981 /advanced/Scripts/webpage.sh | |
parent | e432fae95607c6d28c3bdb9fb97e0e817f6cbc86 (diff) |
Fix processing of CONDITIONAL_FORWARDING_REVERSE
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
Diffstat (limited to 'advanced/Scripts/webpage.sh')
-rwxr-xr-x | advanced/Scripts/webpage.sh | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/advanced/Scripts/webpage.sh b/advanced/Scripts/webpage.sh index 15471ad4..7cf0ae75 100755 --- a/advanced/Scripts/webpage.sh +++ b/advanced/Scripts/webpage.sh @@ -217,6 +217,11 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 if [[ "${CONDITIONAL_FORWARDING}" == true ]]; then # Convert legacy "conditional forwarding" to rev-server configuration + delete_setting "REV_SERVER" + delete_setting "REV_SERVER_DOMAIN" + delete_setting "REV_SERVER_TARGET" + delete_setting "REV_SERVER_CIDR" + REV_SERVER=true add_setting "REV_SERVER" "true" @@ -226,7 +231,17 @@ trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC68345710423 REV_SERVER_TARGET="${CONDITIONAL_FORWARDING_IP}" add_setting "REV_SERVER_TARGET" "${REV_SERVER_TARGET}" - REV_SERVER_CIDR="${CONDITIONAL_FORWARDING_REVERSE}" + search="in-addr.arpa" + if [[ "$CONDITIONAL_FORWARDING_REVERSE" == *"$search" ]];then + arrRev=(${CONDITIONAL_FORWARDING_REVERSE//./ }) + case ${#arrRev[@]} in + 6 ) REV_SERVER_CIDR="${arrRev[3]}.${arrRev[2]}.${arrRev[1]}.${arrRev[0]}/32";; + 5 ) REV_SERVER_CIDR="${arrRev[2]}.${arrRev[1]}.${arrRev[0]}.0/24";; + 4 ) REV_SERVER_CIDR="${arrRev[1]}.${arrRev[0]}.0.0/16";; + 3 ) REV_SERVER_CIDR="${arrRev[0]}.0.0.0/8";; + esac + fi + if [ -z "${REV_SERVER_CIDR}" ]; then # Convert existing input to /24 subnet (preserves legacy behavior) # This sed converts "192.168.1.2" to "192.168.1.0/24" |