From 0891d12fd22a3a9e76cab9632a4fad94cbaf922a Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Tue, 21 Jun 2016 14:29:08 -0400 Subject: Fixed #6498 by providing new address type argument to Form_IpAddress(). In this case it is specified as "V6". (cherry picked from commit 3e4adb7139b4cddbb06a2aba7e0727d1762b35ee) --- src/usr/local/www/classes/Form/IpAddress.class.php | 18 +++++++++++++++--- src/usr/local/www/firewall_nat_npt_edit.php | 6 ++++-- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'src/usr') diff --git a/src/usr/local/www/classes/Form/IpAddress.class.php b/src/usr/local/www/classes/Form/IpAddress.class.php index be2f4c1..72f885f 100644 --- a/src/usr/local/www/classes/Form/IpAddress.class.php +++ b/src/usr/local/www/classes/Form/IpAddress.class.php @@ -31,11 +31,23 @@ class Form_IpAddress extends Form_Input { protected $_mask; - public function __construct($name, $title, $value) + public function __construct($name, $title, $value, $type = "BOTH") { parent::__construct($name, $title, 'text', $value); - $this->_attributes['pattern'] = '[a-f0-9:.]*'; + switch ($type) { + case "BOTH": + $this->_attributes['pattern'] = '[a-f0-9:.]*'; + break; + + case "V4": + $this->_attributes['pattern'] = '[a-f0-9.]*'; + break; + + case "V6": + $this->_attributes['pattern'] = '[a-f0-9:]*'; + break; + } } // $min is provided to allow for VPN masks in which '0' is valid @@ -58,7 +70,7 @@ class Form_IpAddress extends Form_Input return parent::setIsRepeated(); } - + protected function _getInput() { $input = parent::_getInput(); diff --git a/src/usr/local/www/firewall_nat_npt_edit.php b/src/usr/local/www/firewall_nat_npt_edit.php index 907b55a..4ce89be 100644 --- a/src/usr/local/www/firewall_nat_npt_edit.php +++ b/src/usr/local/www/firewall_nat_npt_edit.php @@ -245,7 +245,8 @@ $section->addInput(new Form_Checkbox( $section->addInput(new Form_IpAddress( 'src', 'Address', - $pconfig['src'] + $pconfig['src'], + 'V6' ))->addMask('srcmask', $pconfig['srcmask'])->setHelp('Internal (LAN) ULA IPv6 Prefix for the Network Prefix translation. ' . 'The prefix size specified for the internal IPv6 prefix will be applied to the external prefix.'); @@ -259,7 +260,8 @@ $section->addInput(new Form_Checkbox( $section->addInput(new Form_IpAddress( 'dst', 'Address', - $pconfig['dst'] + $pconfig['dst'], + 'V6' ))->addMask('dstmask', $pconfig['dstmask'])->setHelp('Global Unicast routable IPv6 prefix'); $section->addInput(new Form_Input( -- cgit v1.1