summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2015-09-08 09:36:36 -0400
committerStephen Beaver <sbeaver@netgate.com>2015-09-08 09:38:05 -0400
commitcddc70a20177dd4d2d622f6dd8e9e08f181774c8 (patch)
tree3584ff54c82897d7c6a9d90a60eb8a63da104a27 /src/usr
parent1167a8c539d72f70c564d02763af0d678330f5bf (diff)
downloadpfsense-cddc70a20177dd4d2d622f6dd8e9e08f181774c8.zip
pfsense-cddc70a20177dd4d2d622f6dd8e9e08f181774c8.tar.gz
Fixed #5102
javascript revised to accommodate VPN masks
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/local/www/classes/Form/IpAddress.class.php18
-rw-r--r--src/usr/local/www/jquery/pfSense.js11
-rw-r--r--src/usr/local/www/vpn_ipsec_phase2.php6
3 files changed, 12 insertions, 23 deletions
diff --git a/src/usr/local/www/classes/Form/IpAddress.class.php b/src/usr/local/www/classes/Form/IpAddress.class.php
index e45cc38..f071c1b 100644
--- a/src/usr/local/www/classes/Form/IpAddress.class.php
+++ b/src/usr/local/www/classes/Form/IpAddress.class.php
@@ -38,31 +38,19 @@ class Form_IpAddress extends Form_Input
$this->_attributes['pattern'] = '[a-f0-9:.]*';
}
- public function addMask($name, $value, $max = 128)
+ // $min is provided to allow for VPN masks in which '0' is valid
+ public function addMask($name, $value, $max = 128, $min = 1)
{
$this->_mask = new Form_Select(
$name,
null,
$value,
- array_combine(range($max, 1), range($max, 1))
+ array_combine(range($max, $min), range($max, $min))
);
return $this;
}
- // Masks on vpn_ipsec* pages allow a mask of '0'
- public function addVPNMask($name, $value, $max = 128)
- {
- $this->_mask = new Form_Select(
- $name,
- null,
- $value,
- array_combine(range($max, 0), range($max, 0))
- );
-
- return $this;
- }
-
public function setIsRepeated()
{
if (isset($this->_mask))
diff --git a/src/usr/local/www/jquery/pfSense.js b/src/usr/local/www/jquery/pfSense.js
index ffd56dc..d1c9f65 100644
--- a/src/usr/local/www/jquery/pfSense.js
+++ b/src/usr/local/www/jquery/pfSense.js
@@ -95,9 +95,10 @@ $(function() {
});
})();
+ // Automatically change IpAddress mask selectors to 128/32 options for IPv6/IPvd addresses
$('span.pfIpMask + select').each(function (idx, select){
var input = $(select).prevAll('input[type=text]');
-
+
input.on('change', function(e){
var isV6 = (input.val().indexOf(':') != -1), min = 0, max = 128;
if (!isV6)
@@ -106,11 +107,11 @@ $(function() {
if (input.val() == "")
return;
- while (select.options.length > max)
+ // Eat all of the options with a value greater than max. We don't want them to be available
+ while (select.options[0].value > max)
select.remove(0);
-
- if (select.options.length < max)
- {
+
+ if (select.options.length < max) {
for (var i=select.options.length; i<=max; i++)
select.options.add(new Option(i, i), 0);
}
diff --git a/src/usr/local/www/vpn_ipsec_phase2.php b/src/usr/local/www/vpn_ipsec_phase2.php
index 80c0734..330d870 100644
--- a/src/usr/local/www/vpn_ipsec_phase2.php
+++ b/src/usr/local/www/vpn_ipsec_phase2.php
@@ -532,7 +532,7 @@ $group->add(new Form_IpAddress(
'localid_address',
null,
$pconfig['localid_address']
-))->setHelp('Address')->addVPNMask(localid_netbits, $pconfig['localid_netbits']);
+))->setHelp('Address')->addMask(localid_netbits, $pconfig['localid_netbits'], 128, 0);
$section->add($group);
@@ -557,7 +557,7 @@ $group->add(new Form_IpAddress(
'natlocalid_address',
null,
$pconfig['localid_address']
-))->setHelp('Address')->addVPNMask(natlocalid_netbits, $pconfig['natlocalid_netbits']);
+))->setHelp('Address')->addMask(natlocalid_netbits, $pconfig['natlocalid_netbits'], 128, 0);
$group->setHelp('If NAT/BINAT is required on this network specify the address to be translated');
$section->add($group);
@@ -576,7 +576,7 @@ $group->add(new Form_IpAddress(
'remoteid_address',
null,
$pconfig['remoteid_address']
-))->setHelp('Address')->addVPNMask(remoteid_netbits, $pconfig['remoteid_netbits']);
+))->setHelp('Address')->addMask(remoteid_netbits, $pconfig['remoteid_netbits'], 128, 0);
$section->add($group);
OpenPOWER on IntegriCloud