diff options
-rw-r--r-- | src/usr/local/www/classes/Form/IpAddress.class.php | 17 | ||||
-rw-r--r-- | src/usr/local/www/firewall_rules_edit.php | 5 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/usr/local/www/classes/Form/IpAddress.class.php b/src/usr/local/www/classes/Form/IpAddress.class.php index 9a2cc16..0100526 100644 --- a/src/usr/local/www/classes/Form/IpAddress.class.php +++ b/src/usr/local/www/classes/Form/IpAddress.class.php @@ -77,6 +77,23 @@ class Form_IpAddress extends Form_Input $this->_attributes['title'] = 'An IPv6 address like 1:2a:3b:ffff::1'; $this->_attributes['onChange'] = 'javascript:this.value=this.value.toLowerCase();'; break; + + case "ALIASV4V6": + $this->_attributes['pattern'] = '[a-zA-Z0-9_.:]+'; + $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4 or an IPv6 address like 1:2a:3b:ffff::1 or an alias'; + $this->_attributes['onChange'] = 'javascript:if (this.value.indexOf(":") > -1) {this.value=this.value.toLowerCase();}'; + break; + + case "ALIASV4": + $this->_attributes['pattern'] = '[a-zA-Z0-9_.:]+'; + $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4 or an alias'; + break; + + case "ALIASV6": + $this->_attributes['pattern'] = '[a-zA-Z0-9_.:]+'; + $this->_attributes['title'] = 'An IPv6 address like 1:2a:3b:ffff::1 or an alias'; + $this->_attributes['onChange'] = 'javascript:if (this.value.indexOf(":") > -1) {this.value=this.value.toLowerCase();}'; + break; } } diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php index cbadfd8..92f1f53 100644 --- a/src/usr/local/www/firewall_rules_edit.php +++ b/src/usr/local/www/firewall_rules_edit.php @@ -1354,8 +1354,9 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) { $group->add(new Form_IpAddress( $type, $name .' Address', - $pconfig[$type] - ))->addMask($type .'mask', $pconfig[$type.'mask'])->setPattern('[a-zA-Z0-9_.:]+'); + $pconfig[$type], + 'ALIASV4V6' + ))->addMask($type .'mask', $pconfig[$type.'mask']); $section->add($group); |