Fix IP Regex

Refined IP regex to only match IPs within the IPv4 spec.
This commit is contained in:
Luke Browning 2020-12-18 22:45:49 -05:00 committed by GitHub
parent 8d57810fb9
commit 030c2e587c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,7 +254,7 @@ function installQuestions () {
IP_RANGE="10.8.0.0" IP_RANGE="10.8.0.0"
;; ;;
2) 2)
until [[ "$IP_RANGE" =~ ^([0-9]{1,3}\.){3}0$ ]]; do until [[ "$IP_RANGE" =~ ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}0$ ]]; do
read -rp "Custom IP [x.x.x.0]: " -e -i 10.8.0.0 IP_RANGE read -rp "Custom IP [x.x.x.0]: " -e -i 10.8.0.0 IP_RANGE
done done
;; ;;