summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-12-27 10:47:44 -0200
committerRenato Botelho <renato@netgate.com>2016-12-27 10:47:44 -0200
commitac4e656aed7af011be7527df676002bccb6330f6 (patch)
treeca9f400db978fd79c4beecd56a6284abcf6bd576 /src
parent58b5c9579aac52471e903a0914bfb0ea34731af9 (diff)
parent45541aae63596ea28aa18c84b65946bce6adbffd (diff)
downloadpfsense-ac4e656aed7af011be7527df676002bccb6330f6.zip
pfsense-ac4e656aed7af011be7527df676002bccb6330f6.tar.gz
Merge pull request #3248 from phil-davis/ipaddressnopattern
Diffstat (limited to 'src')
-rw-r--r--src/usr/local/www/classes/Form/IpAddress.class.php27
-rw-r--r--src/usr/local/www/firewall_aliases_edit.php3
-rw-r--r--src/usr/local/www/firewall_nat_1to1_edit.php7
-rw-r--r--src/usr/local/www/firewall_nat_edit.php15
-rw-r--r--src/usr/local/www/firewall_nat_out_edit.php10
-rw-r--r--src/usr/local/www/firewall_rules_edit.php5
-rw-r--r--src/usr/local/www/services_dhcp.php8
-rw-r--r--src/usr/local/www/services_router_advertisements.php8
-rw-r--r--src/usr/local/www/system_routes_edit.php5
9 files changed, 60 insertions, 28 deletions
diff --git a/src/usr/local/www/classes/Form/IpAddress.class.php b/src/usr/local/www/classes/Form/IpAddress.class.php
index 9ab26d8..3e8c98f 100644
--- a/src/usr/local/www/classes/Form/IpAddress.class.php
+++ b/src/usr/local/www/classes/Form/IpAddress.class.php
@@ -30,17 +30,38 @@ class Form_IpAddress extends Form_Input
switch ($type) {
case "BOTH":
- $this->_attributes['pattern'] = '[a-fA-F0-9:.]*';
$this->_attributes['title'] = 'An IPv4 address like 1.2.3.4 or an IPv6 address like 1:2a:3b:ffff::1';
break;
case "V4":
- $this->_attributes['pattern'] = '[0-9.]*';
+ $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4';
break;
case "V6":
- $this->_attributes['pattern'] = '[a-fA-F0-9:.]*';
$this->_attributes['title'] = 'An IPv6 address like 1:2a:3b:ffff::1';
+
+ case "ALIASV4V6":
+ $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4 or an IPv6 address like 1:2a:3b:ffff::1 or an alias';
+ break;
+
+ case "ALIASV4":
+ $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4 or an alias';
+ break;
+
+ case "ALIASV6":
+ $this->_attributes['title'] = 'An IPv6 address like 1:2a:3b:ffff::1 or an alias';
+ break;
+
+ case "HOSTV4V6":
+ $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4 or an IPv6 address like 1:2a:3b:ffff::1 or a host name like myhost.example.com';
+ break;
+
+ case "HOSTV4":
+ $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4 or a host name like myhost.example.com';
+ break;
+
+ case "HOSTV6":
+ $this->_attributes['title'] = 'An IPv6 address like 1:2a:3b:ffff::1 or a host name like myhost.example.com';
break;
}
}
diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php
index bece596..de0e12b 100644
--- a/src/usr/local/www/firewall_aliases_edit.php
+++ b/src/usr/local/www/firewall_aliases_edit.php
@@ -707,7 +707,8 @@ while ($counter < count($addresses)) {
$group->add(new Form_IpAddress(
'address' . $counter,
$tab == 'port' ? 'Port':'Address',
- $address
+ $address,
+ 'ALIASV4V6'
))->addMask('address_subnet' . $counter, $address_subnet)->setWidth(4)->setPattern($pattern_str[$tab]);
$group->add(new Form_Input(
diff --git a/src/usr/local/www/firewall_nat_1to1_edit.php b/src/usr/local/www/firewall_nat_1to1_edit.php
index b127706..b71687d 100644
--- a/src/usr/local/www/firewall_nat_1to1_edit.php
+++ b/src/usr/local/www/firewall_nat_1to1_edit.php
@@ -490,7 +490,7 @@ $group->add(new Form_IpAddress(
'src',
null,
is_specialnet($pconfig['src']) ? '': $pconfig['src']
-))->addMask('srcmask', $pconfig['srcmask'], 31)->setHelp('Address/mask')->setPattern('[a-zA-Z0-9.:_]+');
+))->addMask('srcmask', $pconfig['srcmask'], 31)->setHelp('Address/mask');
$group->setHelp('Enter the internal (LAN) subnet for the 1:1 mapping. ' .
'The subnet size specified for the internal subnet will be applied to the external subnet.');
@@ -516,8 +516,9 @@ $group->add(new Form_Select(
$group->add(new Form_IpAddress(
'dst',
null,
- is_specialnet($pconfig['dst']) ? '': $pconfig['dst']
-))->addMask('dstmask', $pconfig['dstmask'], 31)->setHelp('Address/mask')->setPattern('[a-zA-Z0-9.:_]+');
+ is_specialnet($pconfig['dst']) ? '': $pconfig['dst'],
+ 'ALIASV4V6'
+))->addMask('dstmask', $pconfig['dstmask'], 31)->setHelp('Address/mask');
$group->setHelp('The 1:1 mapping will only be used for connections to or from the specified destination. Hint: this is usually "Any".');
diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php
index 03d603a..bcb8f98 100644
--- a/src/usr/local/www/firewall_nat_edit.php
+++ b/src/usr/local/www/firewall_nat_edit.php
@@ -738,8 +738,9 @@ $group->add(new Form_Select(
$group->add(new Form_IpAddress(
'src',
null,
- is_specialnet($pconfig['src']) ? '': $pconfig['src']
-))->setPattern('[.a-zA-Z0-9_:]+')->addMask('srcmask', $pconfig['srcmask'])->setHelp('Address/mask');
+ is_specialnet($pconfig['src']) ? '': $pconfig['src'],
+ 'ALIASV4V6'
+))->addMask('srcmask', $pconfig['srcmask'])->setHelp('Address/mask');
$section->add($group);
@@ -805,8 +806,9 @@ $group->add(new Form_Select(
$group->add(new Form_IpAddress(
'dst',
null,
- is_specialnet($pconfig['dst']) ? '': $pconfig['dst']
-))->setPattern('[.a-zA-Z0-9_:]+')->addMask('dstmask', $pconfig['dstmask'], 31)->setHelp('Address/mask');
+ is_specialnet($pconfig['dst']) ? '': $pconfig['dst'],
+ 'ALIASV4V6'
+))->addMask('dstmask', $pconfig['dstmask'], 31)->setHelp('Address/mask');
$section->add($group);
@@ -849,8 +851,9 @@ $section->add($group);
$section->addInput(new Form_IpAddress(
'localip',
'Redirect target IP',
- $pconfig['localip']
-))->setPattern('[.a-zA-Z0-9_:]+')->setHelp('Enter the internal IP address of the server on which to map the ports.' . '<br />' .
+ $pconfig['localip'],
+ 'ALIASV4V6'
+))->setHelp('Enter the internal IP address of the server on which to map the ports.' . '<br />' .
'e.g.: 192.168.1.12');
$group = new Form_Group('Redirect target port');
diff --git a/src/usr/local/www/firewall_nat_out_edit.php b/src/usr/local/www/firewall_nat_out_edit.php
index 3f47dc2..4c3bba9 100644
--- a/src/usr/local/www/firewall_nat_out_edit.php
+++ b/src/usr/local/www/firewall_nat_out_edit.php
@@ -496,8 +496,9 @@ $group->add(new Form_Select(
$group->add(new Form_IpAddress(
'source',
null,
- $pconfig['source']
-))->addMask('source_subnet', $pconfig['source_subnet'])->setHelp('Source network for the outbound NAT mapping.')->setPattern('[a-zA-Z0-9_.:]+');
+ $pconfig['source'],
+ 'ALIASV4V6'
+))->addMask('source_subnet', $pconfig['source_subnet'])->setHelp('Source network for the outbound NAT mapping.');
$group->add(new Form_Input(
'sourceport',
@@ -520,8 +521,9 @@ $group->add(new Form_Select(
$group->add(new Form_IpAddress(
'destination',
null,
- $pconfig['destination'] == "any" ? "":$pconfig['destination']
-))->addMask('destination_subnet', $pconfig['destination_subnet'])->setHelp('Destination network for the outbound NAT mapping.')->setPattern('[a-zA-Z0-9_.:]+');
+ $pconfig['destination'] == "any" ? "":$pconfig['destination'],
+ 'ALIASV4V6'
+))->addMask('destination_subnet', $pconfig['destination_subnet'])->setHelp('Destination network for the outbound NAT mapping.');
$group->add(new Form_Input(
'dstport',
diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php
index ac90126..5211255 100644
--- a/src/usr/local/www/firewall_rules_edit.php
+++ b/src/usr/local/www/firewall_rules_edit.php
@@ -1320,8 +1320,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);
diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php
index 27c64a8..bb31e60 100644
--- a/src/usr/local/www/services_dhcp.php
+++ b/src/usr/local/www/services_dhcp.php
@@ -1127,15 +1127,15 @@ $section->addInput(new Form_IpAddress(
'ntp1',
'NTP Server 1',
$pconfig['ntp1'],
- 'V4'
-))->setPattern('[.a-zA-Z0-9-]+');
+ 'HOSTV4'
+));
$section->addInput(new Form_IpAddress(
'ntp2',
'NTP Server 2',
$pconfig['ntp2'],
- 'V4'
-))->setPattern('[.a-zA-Z0-9-]+');
+ 'HOSTV4'
+));
// Advanced TFTP
$btnadv = new Form_Button(
diff --git a/src/usr/local/www/services_router_advertisements.php b/src/usr/local/www/services_router_advertisements.php
index 6cde67d..e369d37 100644
--- a/src/usr/local/www/services_router_advertisements.php
+++ b/src/usr/local/www/services_router_advertisements.php
@@ -407,7 +407,8 @@ foreach ($pconfig['subnets'] as $subnet) {
$group->add(new Form_IpAddress(
$address_name,
null,
- $address
+ $address,
+ 'V6'
))->addMask($bits_name, $subnet);
$group->add(new Form_Button(
@@ -439,8 +440,9 @@ for ($idx=1; $idx<=3; $idx++) {
$section->addInput(new Form_IpAddress(
'radns' . $idx,
'Server ' . $idx,
- $pconfig['radns' . $idx]
- ))->setPattern('[a-zA-Z0-9_.:]+')->setHelp(($idx < 3) ? '':'Leave blank to use the system default DNS servers - this interface\'s IP if DNS Forwarder or Resolver is enabled, otherwise the servers configured on the General page');
+ $pconfig['radns' . $idx],
+ 'ALIASV6'
+ ))->setHelp(($idx < 3) ? '':'Leave blank to use the system default DNS servers - this interface\'s IP if DNS Forwarder or Resolver is enabled, otherwise the servers configured on the General page');
}
$section->addInput(new Form_Input(
diff --git a/src/usr/local/www/system_routes_edit.php b/src/usr/local/www/system_routes_edit.php
index b86522e..7a52df9 100644
--- a/src/usr/local/www/system_routes_edit.php
+++ b/src/usr/local/www/system_routes_edit.php
@@ -245,8 +245,9 @@ $section = new Form_Section('Edit Route Entry');
$section->addInput(new Form_IpAddress(
'network',
'Destination network',
- $pconfig['network']
-))->addMask('network_subnet', $pconfig['network_subnet'])->setPattern('[.a-zA-Z0-9_:]+')->setHelp('Destination network for this static route');
+ $pconfig['network'],
+ 'ALIASV4V6'
+))->addMask('network_subnet', $pconfig['network_subnet'])->setHelp('Destination network for this static route');
$allGateways = array_combine(
array_map(function($g){ return $g['name']; }, $a_gateways),
OpenPOWER on IntegriCloud