From 87657b952897932518033d7c97c05f314cb14a06 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 12 Dec 2014 21:04:46 +0545 Subject: [PATCH] rc.initial.setlanip fix validation of CIDR within range Currently this allows the user to input any number for the CIDR. I happened to try 44 for an IPv4 CIDR when playing. This fixes that little bug - I think it is good to commit that first/separately so it can be identified apart from the other (y/n) checking/handling I am working on. Better to have separate commits for distinct bugs. --- etc/rc.initial.setlanip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/rc.initial.setlanip b/etc/rc.initial.setlanip index f49cac2962..430270da1e 100755 --- a/etc/rc.initial.setlanip +++ b/etc/rc.initial.setlanip @@ -284,7 +284,7 @@ function console_configure_ip_address($version) { echo "\n" . sprintf(gettext("Enter the new %s %s subnet bit count:"), $upperifname, $label_IPvX) . "\n> "; $intbits = chop(fgets($fp)); - $intbits_ok = is_numeric($intbits) && (($intbits >= 1) || ($intbits <= $maxbits)); + $intbits_ok = is_numeric($intbits) && (($intbits >= 1) && ($intbits <= $maxbits)); $restart_dhcpd = true; if ($version === 4 && $intbits < $maxbits) {