summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/interfaces.inc6
-rw-r--r--src/etc/inc/openvpn.inc6
-rw-r--r--src/etc/inc/vpn.inc4
-rw-r--r--src/usr/local/bin/dhcpd_gather_stats.php14
-rw-r--r--src/usr/local/www/diag_confbak.php2
-rw-r--r--src/usr/local/www/diag_tables.php2
-rw-r--r--src/usr/local/www/firewall_nat_edit.php9
-rw-r--r--src/usr/local/www/jquery/pfSenseHelpers.js23
-rw-r--r--src/usr/local/www/services_dhcp_edit.php5
-rw-r--r--src/usr/local/www/services_dhcpv6.php2
-rw-r--r--src/usr/local/www/services_dnsmasq.php18
-rw-r--r--src/usr/local/www/services_ntpd_gps.php2
-rw-r--r--src/usr/local/www/services_pppoe_edit.php9
-rw-r--r--src/usr/local/www/services_wol.php2
-rw-r--r--src/usr/local/www/status_dhcp_leases.php4
-rw-r--r--src/usr/local/www/status_dhcpv6_leases.php6
-rw-r--r--src/usr/local/www/status_logs_filter_summary.php2
-rw-r--r--src/usr/local/www/status_queues.php2
-rw-r--r--src/usr/local/www/system.php8
-rw-r--r--src/usr/local/www/vpn_ipsec.php2
-rw-r--r--src/usr/local/www/vpn_ipsec_phase2.php2
-rw-r--r--src/usr/local/www/vpn_l2tp.php6
22 files changed, 56 insertions, 80 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index 2e1fce5..90e5168 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -3098,7 +3098,7 @@ function interface_mtu_wanted_for_pppoe($realif) {
continue;
}
- $ports = explode(',',$ppp['ports']);
+ $ports = explode(',', $ppp['ports']);
$mtu_wanted = 1500;
foreach ($ports as $pid => $port) {
if (get_real_interface($port) != $realif) {
@@ -3106,9 +3106,9 @@ function interface_mtu_wanted_for_pppoe($realif) {
}
if (!empty($ppp['mtu'])) {
- $mtus = explode(',',$ppp['mtu']);
+ $mtus = explode(',', $ppp['mtu']);
} else {
- $mtus == array();
+ $mtus = array();
}
// there is an MTU configured on the port in question
if (!empty($mtus[$pid])) {
diff --git a/src/etc/inc/openvpn.inc b/src/etc/inc/openvpn.inc
index 9dc83c5..c7810a6 100644
--- a/src/etc/inc/openvpn.inc
+++ b/src/etc/inc/openvpn.inc
@@ -1243,9 +1243,9 @@ function openvpn_resync_csc(& $settings) {
$csc_conf .= "ifconfig-push {$ip} " . gen_subnet_mask($mask) . "\n";
} else {
/* Because this is being pushed, the order from the client's point of view. */
- $baselong = ip2long32($ip) & gen_subnet_mask_long($mask);
- $serverip = long2ip32($baselong + 1);
- $clientip = long2ip32($baselong + 2);
+ $baselong = gen_subnetv4($ip, $mask);
+ $serverip = ip_after($baselong, 1);
+ $clientip = ip_after($baselong, 2);
$csc_conf .= "ifconfig-push {$clientip} {$serverip}\n";
}
}
diff --git a/src/etc/inc/vpn.inc b/src/etc/inc/vpn.inc
index 50f0b01..8aa3cbd 100644
--- a/src/etc/inc/vpn.inc
+++ b/src/etc/inc/vpn.inc
@@ -1588,7 +1588,7 @@ function vpn_pppoe_configure(&$pppoecfg) {
for ($i = 0; $i < $pppoecfg['n_pppoe_units']; $i++) {
- $clientip = long2ip32(ip2long($pppoecfg['remoteip']) + $i);
+ $clientip = ip_after($pppoecfg['remoteip'], $i);
if (isset($pppoecfg['radius']['radiusissueips']) && isset($pppoecfg['radius']['server']['enable'])) {
$issue_ip_type = "set ipcp ranges {$pppoecfg['localip']}/32 0.0.0.0/0";
@@ -1827,7 +1827,7 @@ EOD;
for ($i = 0; $i < $l2tpcfg['n_l2tp_units']; $i++) {
- $clientip = long2ip32(ip2long($l2tpcfg['remoteip']) + $i);
+ $clientip = ip_after($l2tpcfg['remoteip'], $i);
if (isset ($l2tpcfg['radius']['radiusissueips']) && isset ($l2tpcfg['radius']['enable'])) {
$issue_ip_type = "set ipcp ranges {$l2tpcfg['localip']}/32 0.0.0.0/0";
diff --git a/src/usr/local/bin/dhcpd_gather_stats.php b/src/usr/local/bin/dhcpd_gather_stats.php
index b16e887..8903559 100644
--- a/src/usr/local/bin/dhcpd_gather_stats.php
+++ b/src/usr/local/bin/dhcpd_gather_stats.php
@@ -187,23 +187,21 @@ if (is_array($config['dhcpd'][$argv[1]])) {
}
$ifcfgip = get_interface_ip($dhcpif);
$ifcfgsn = get_interface_subnet($dhcpif);
- $subnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
- $subnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
-
- $result['range'] = (ip2ulong($config['dhcpd'][$dhcpif]['range']['to'])) - (ip2ulong($config['dhcpd'][$dhcpif]['range']['from'])) ;
+ $subnet_start = gen_subnetv4($ifcfgip, $ifcfgsn);
+ $subnet_end = gen_subnetv4_max($ifcfgip, $ifcfgsn);
+
+ $result['range'] = (ip2ulong($config['dhcpd'][$dhcpif]['range']['to'])) - (ip2ulong($config['dhcpd'][$dhcpif]['range']['from']));
foreach ($leases as $data) {
- $lip = ip2ulong($data['ip']);
-
if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
continue;
if ($data['act'] != "static") {
- if (($lip >= ip2ulong($config['dhcpd'][$dhcpif]['range']['from'])) && ($lip <= ip2ulong($config['dhcpd'][$dhcpif]['range']['to']))) {
+ if (is_inrange_v4($data['ip'], $config['dhcpd'][$dhcpif]['range']['from'], $config['dhcpd'][$dhcpif]['range']['to'])) {
$result['active'] = $result['active'] + 1;
}
}
else {
- if (($lip >= $subnet_start) && ($lip <= $subnet_end)) {
+ if (is_inrange_v4($data['ip'], $subnet_start, $subnet_end)) {
$result['static'] = $result['static'] + 1;
}
}
diff --git a/src/usr/local/www/diag_confbak.php b/src/usr/local/www/diag_confbak.php
index a14bdcd..56afc59 100644
--- a/src/usr/local/www/diag_confbak.php
+++ b/src/usr/local/www/diag_confbak.php
@@ -208,7 +208,7 @@ print($form);
if (is_array($confvers)) {
?>
<div>
- <div class="infoblock_open">
+ <div class="infoblock blockopen">
<?=print_info_box(
gettext(
'To view the differences between an older configuration and a newer configuration, ' .
diff --git a/src/usr/local/www/diag_tables.php b/src/usr/local/www/diag_tables.php
index 1eaa306..a90442a 100644
--- a/src/usr/local/www/diag_tables.php
+++ b/src/usr/local/www/diag_tables.php
@@ -159,7 +159,7 @@ print $form;
if ($bogons || !empty($entries)) {
?>
<div>
- <div class="infoblock_open">
+ <div class="infoblock blockopen">
<?php
$last_updated = exec('/usr/bin/grep -i -m 1 -E "^# last updated" /etc/' . escapeshellarg($tablename) . '|cut -d"(" -f2|tr -d ")" ');
if ($last_updated != "") {
diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php
index 2018ac8..83e1cb1 100644
--- a/src/usr/local/www/firewall_nat_edit.php
+++ b/src/usr/local/www/firewall_nat_edit.php
@@ -834,7 +834,7 @@ $group->add(new Form_Select(
$group->add(new Form_Input(
'dstbeginport_cust',
null,
- 'number',
+ 'text',
is_numeric($pconfig['dstbeginport']) ? $pconfig['dstbeginport'] : null,
['min' => '1', 'max' => '65536']
))->setHelp('Custom');
@@ -849,7 +849,7 @@ $group->add(new Form_Select(
$group->add(new Form_Input(
'dstendport_cust',
null,
- 'number',
+ 'text',
is_numeric($pconfig['dstendport']) ? $pconfig['dstendport'] : null,
['min' => '1', 'max' => '65536']
))->setHelp('Custom');
@@ -883,7 +883,7 @@ $group->setHelp('Specify the port on the machine with the IP address entered abo
$group->add(new Form_Input(
'localbeginport_cust',
null,
- 'number',
+ 'text',
is_numeric($pconfig['localbeginport']) ? $pconfig['localbeginport'] : null,
['min' => '1', 'max' => '65536']
))->setHelp('Custom');
@@ -1284,9 +1284,10 @@ events.push(function() {
source: addressarray
});
- $('#dstbeginport_cust, #dstendport_cust, #srcbeginport_cust, #srcendport_cust, localbeginport_cust').autocomplete({
+ $('#dstbeginport_cust, #dstendport_cust, #srcbeginport_cust, #srcendport_cust, #localbeginport_cust').autocomplete({
source: customarray
});
+
});
//]]>
</script>
diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js
index f447b65..d9a599f 100644
--- a/src/usr/local/www/jquery/pfSenseHelpers.js
+++ b/src/usr/local/www/jquery/pfSenseHelpers.js
@@ -387,25 +387,30 @@ $('[id^=delete]').click(function(event) {
// "More information" handlers --------------------------------------------------------------------
// If there is an infoblock, automatically add an info icon that toggles its display
-// If there is n=more than one infoblock on a page, each must use a unique class suffic. e.g.: infoblock_01 or infoblock_open_19
-$('[class^="infoblock"], [class^="infoblock_open"]').each(function() {
- var classname = $(this).attr("class");
- var sfx = classname.substr(9);
+var sfx = 0;
- if (classname.indexOf("infoblock_open") == -1) {
+$('.infoblock').each(function() {
+ // If the block has the class "blockopen" it is initially open
+ if (! $(this).hasClass("blockopen")) {
$(this).hide();
+ } else {
+ $(this).removeClass("blockopen");
}
- $(this).before('<i class="fa fa-info-circle icon-pointer" style="color: #337AB7; font-size:20px; margin-left: 10px; margin-bottom: 10px;" id="showinfo' + sfx + '" title="More information"></i>');
+ // Add the "i" icon before the infoblock, incrementing the icon id for each block (in case there are multiple infoblocks on a page)
+ $(this).before('<i class="fa fa-info-circle icon-pointer" style="color: #337AB7; font-size:20px; margin-left: 10px; margin-bottom: 10px;" id="showinfo' + sfx.toString() + '" title="More information"></i>');
+ $(this).removeClass("infoblock");
+ $(this).addClass("infoblock" + sfx.toString());
+ sfx++;
});
// Show the help on clicking the info icon
$('[id^="showinfo"]').click(function() {
var id = $(this).attr("id");
- var target = "infoblock" + id.substr(8);
- $('.' + target).toggle();
+ $('.' + "infoblock" + id.substr(8)).toggle();
+ document.getSelection().removeAllRanges(); // Ensure the text is un-selected (Chrome browser quirk)
});
// ------------------------------------------------------------------------------------------------
@@ -448,4 +453,4 @@ $('.container .panel-heading a[data-toggle="collapse"]').each(function (idx, el)
updateWidgets();
}
});
-}); \ No newline at end of file
+});
diff --git a/src/usr/local/www/services_dhcp_edit.php b/src/usr/local/www/services_dhcp_edit.php
index 303833c..dfc11fb 100644
--- a/src/usr/local/www/services_dhcp_edit.php
+++ b/src/usr/local/www/services_dhcp_edit.php
@@ -238,10 +238,7 @@ if ($_POST) {
/* make sure it's not within the dynamic subnet */
if ($_POST['ipaddr']) {
- $dynsubnet_start = ip2ulong($config['dhcpd'][$if]['range']['from']);
- $dynsubnet_end = ip2ulong($config['dhcpd'][$if]['range']['to']);
- if ((ip2ulong($_POST['ipaddr']) >= $dynsubnet_start) &&
- (ip2ulong($_POST['ipaddr']) <= $dynsubnet_end)) {
+ if (is_inrange_v4($_POST['ipaddr'], $config['dhcpd'][$if]['range']['from'], $config['dhcpd'][$if]['range']['to'])) {
$input_errors[] = sprintf(gettext("The IP address must not be within the DHCP range for this interface."));
}
diff --git a/src/usr/local/www/services_dhcpv6.php b/src/usr/local/www/services_dhcpv6.php
index 84c299d..dc58ba2 100644
--- a/src/usr/local/www/services_dhcpv6.php
+++ b/src/usr/local/www/services_dhcpv6.php
@@ -888,7 +888,7 @@ $section->addInput(new Form_Input(
print($form);
?>
-<div class="infoblock_open">
+<div class="infoblock blockopen">
<?php
print_info_box(gettext('The DNS servers entered in ') . '<a href="system.php">' . gettext(' System: General setup') . '</a>' .
gettext(' (or the ') . '<a href="services_dnsmasq.php"/>' . gettext('DNS forwarder') . '</a>, ' . gettext('if enabled) ') .
diff --git a/src/usr/local/www/services_dnsmasq.php b/src/usr/local/www/services_dnsmasq.php
index c46ffa7..72fbc50 100644
--- a/src/usr/local/www/services_dnsmasq.php
+++ b/src/usr/local/www/services_dnsmasq.php
@@ -342,7 +342,7 @@ $section->addInput(new Form_Textarea(
$form->add($section);
print($form);
?>
-<div class="infoblock_open_01">
+<div class="infoblock blockopen">
<?php
print_info_box(sprintf("If the DNS forwarder is enabled, the DHCP".
" service (if enabled) will automatically serve the LAN IP".
@@ -433,7 +433,7 @@ endforeach;
</a>
</nav>
-<div class="infoblock_open_02">
+<div class="infoblock blockopen">
<?php
print_info_box(gettext("Entries in this section override individual results from the forwarders.") .
gettext("Use these for changing DNS results or for adding custom DNS records."), 'info', false);
@@ -487,19 +487,7 @@ endforeach;
</a>
</nav>
-<script type="text/javascript">
-//<![CDATA[
-events.push(function() {
- // On clicking the "Apply" button, submit the main form, not the little form the button lives in
-// $('[name=apply]').prop('type', 'button');
-
-// $('[name=apply]').click(function() {
-// $('form:last').submit();
-// });
-// });
-//]]>
-</script>
-<div class="infoblock_open_03">
+<div class="infoblock blockopen">
<?php
print_info_box(gettext("Entries in this area override an entire domain, and subdomains, by specifying an".
" authoritative DNS server to be queried for that domain."), 'info', false);
diff --git a/src/usr/local/www/services_ntpd_gps.php b/src/usr/local/www/services_ntpd_gps.php
index 5b68470..f319d45 100644
--- a/src/usr/local/www/services_ntpd_gps.php
+++ b/src/usr/local/www/services_ntpd_gps.php
@@ -380,7 +380,7 @@ $btnadvgps->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText(
'GPS Initialization',
- $btnadvgps . '&nbsp' . 'Show GPS Initialization commands'
+ $btnadvgps . '&nbsp;' . 'Show GPS Initialization commands'
));
$section->addInput(new Form_Textarea(
diff --git a/src/usr/local/www/services_pppoe_edit.php b/src/usr/local/www/services_pppoe_edit.php
index e34fcb0..9f37039 100644
--- a/src/usr/local/www/services_pppoe_edit.php
+++ b/src/usr/local/www/services_pppoe_edit.php
@@ -160,17 +160,12 @@ if ($_POST) {
if (!is_numericint($_POST['n_pppoe_units']) || $_POST['n_pppoe_units'] > 255) {
$input_errors[] = gettext("Number of PPPoE users must be between 1 and 255");
}
- if (!is_numeric($_POST['pppoe_subnet']) ||
- $_POST['pppoe_subnet'] < 0 ||
- $_POST['pppoe_subnet'] > 32) {
+ if (!is_numericint($_POST['pppoe_subnet']) || $_POST['pppoe_subnet'] > 32) {
$input_errors[] = gettext("Subnet mask must be an interger between 0 and 32");
}
$_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $_POST['pppoe_subnet']);
- $subnet_start = ip2ulong($_POST['remoteip']);
- $subnet_end = ip2ulong($_POST['remoteip']) + $_POST['pppoe_subnet'] - 1;
- if ((ip2ulong($_POST['localip']) >= $subnet_start) &&
- (ip2ulong($_POST['localip']) <= $subnet_end)) {
+ if (is_inrange_v4($_POST['localip'], $_POST['remoteip'], ip_after($_POST['remoteip'], $_POST['pppoe_subnet'] - 1))) {
$input_errors[] = gettext("The specified server address lies in the remote subnet.");
}
if ($_POST['localip'] == get_interface_ip($_POST['interface'])) {
diff --git a/src/usr/local/www/services_wol.php b/src/usr/local/www/services_wol.php
index 606234f..a139000 100644
--- a/src/usr/local/www/services_wol.php
+++ b/src/usr/local/www/services_wol.php
@@ -146,7 +146,7 @@ if ($_GET['act'] == "del") {
$pgtitle = array(gettext("Services"), gettext("Wake on LAN"));
include("head.inc");
?>
-<div class="infoblock_open">
+<div class="infoblock blockopen">
<?php
print_info_box(gettext('This service can be used to wake up (power on) computers by sending special') . ' "' . gettext('Magic Packets') . '"<br />' .
gettext('The NIC in the computer that is to be woken up must support Wake on LAN and must be properly configured (WOL cable, BIOS settings).'),
diff --git a/src/usr/local/www/status_dhcp_leases.php b/src/usr/local/www/status_dhcp_leases.php
index 2ebbe88..b0c4b86 100644
--- a/src/usr/local/www/status_dhcp_leases.php
+++ b/src/usr/local/www/status_dhcp_leases.php
@@ -394,15 +394,13 @@ foreach ($leases as $data):
$icon = 'fa-times-circle-o';
}
- $lip = ip2ulong($data['ip']);
-
if ($data['act'] != "static") {
$dlsc=0;
foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) {
if (!is_array($dhcpifconf['range'])) {
continue;
}
- if (($lip >= ip2ulong($dhcpifconf['range']['from'])) && ($lip <= ip2ulong($dhcpifconf['range']['to']))) {
+ if (is_inrange_v4($data['ip'], $dhcpifconf['range']['from'], $dhcpifconf['range']['to'])) {
$data['if'] = $dhcpif;
$dhcp_leases_subnet_counter[$dlsc]['dhcpif'] = $dhcpif;
$dhcp_leases_subnet_counter[$dlsc]['from'] = $dhcpifconf['range']['from'];
diff --git a/src/usr/local/www/status_dhcpv6_leases.php b/src/usr/local/www/status_dhcpv6_leases.php
index e8259d4..e665049 100644
--- a/src/usr/local/www/status_dhcpv6_leases.php
+++ b/src/usr/local/www/status_dhcpv6_leases.php
@@ -119,11 +119,11 @@ function leasecmp($a, $b) {
function adjust_gmt($dt) {
global $config;
- $dhcpv6leaseinlocaltime == "no";
+ $dhcpv6leaseinlocaltime = "no";
if (is_array($config['dhcpdv6'])) {
$dhcpdv6 = $config['dhcpdv6'];
- foreach ($dhcpdv6 as $dhcpv6leaseinlocaltime) {
- $dhcpv6leaseinlocaltime = $dhcpv6leaseinlocaltime['dhcpv6leaseinlocaltime'];
+ foreach ($dhcpdv6 as $dhcpdv6params) {
+ $dhcpv6leaseinlocaltime = $dhcpdv6params['dhcpv6leaseinlocaltime'];
if ($dhcpv6leaseinlocaltime == "yes") {
break;
}
diff --git a/src/usr/local/www/status_logs_filter_summary.php b/src/usr/local/www/status_logs_filter_summary.php
index 9830167..416bcd8 100644
--- a/src/usr/local/www/status_logs_filter_summary.php
+++ b/src/usr/local/www/status_logs_filter_summary.php
@@ -157,7 +157,7 @@ print("<br />");
$infomsg = sprintf(gettext('This is a summary of the last %1$s lines of the firewall log (Max %2$s).'), $gotlines, $lines);
?>
<div>
- <div class="infoblock_open">
+ <div class="infoblock blockopen">
<?=print_info_box($infomsg, 'info', false);?>
</div>
</div>
diff --git a/src/usr/local/www/status_queues.php b/src/usr/local/www/status_queues.php
index 64ade5d..47a5e21 100644
--- a/src/usr/local/www/status_queues.php
+++ b/src/usr/local/www/status_queues.php
@@ -212,7 +212,7 @@ else: ?>
</tbody>
</table>
<br />
- <div class="infoblock_open">
+ <div class="infoblock blockopen">
<?php
print_info_box(gettext("Queue graphs take 5 seconds to sample data"), 'info');
?>
diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php
index a69cb78..cb84861 100644
--- a/src/usr/local/www/system.php
+++ b/src/usr/local/www/system.php
@@ -406,7 +406,7 @@ for ($i=1; $i<5; $i++) {
$group->add(new Form_Select(
'dns' . $i . 'gw',
- null,
+ 'Gateway',
$pconfig['dns' . $i . 'gw'],
$options
))->setHelp(($i == 4) ? 'Gateway':null);;
@@ -427,7 +427,7 @@ $section->addInput(new Form_Checkbox(
'DNS server override',
'Allow DNS server list to be overridden by DHCP/PPP on WAN',
$pconfig['dnsallowoverride']
-))->setHelp(sprintf(gettext('If this option is set, %s will use DNS servers'.
+))->setHelp(sprintf(gettext('If this option is set, %s will use DNS servers '.
'assigned by a DHCP/PPP server on WAN for its own purposes (including '.
'the DNS forwarder). However, they will not be assigned to DHCP and PPTP '.
'VPN clients.'), $g['product_name']));
@@ -437,9 +437,9 @@ $section->addInput(new Form_Checkbox(
'Disable DNS forwarder',
'Do not use the DNS Forwarder as a DNS server for the firewall',
$pconfig['dnslocalhost']
-))->setHelp('By default localhost (127.0.0.1) will be used as the first DNS'.
+))->setHelp('By default localhost (127.0.0.1) will be used as the first DNS '.
'server where the DNS Forwarder or DNS Resolver is enabled and set to '.
- 'listen on Localhost, so system can use the local DNS service to perform'.
+ 'listen on Localhost, so system can use the local DNS service to perform '.
'lookups. Checking this box omits localhost from the list of DNS servers.');
$form->add($section);
diff --git a/src/usr/local/www/vpn_ipsec.php b/src/usr/local/www/vpn_ipsec.php
index 27034b7..56f2cf6 100644
--- a/src/usr/local/www/vpn_ipsec.php
+++ b/src/usr/local/www/vpn_ipsec.php
@@ -263,8 +263,6 @@ $tab_array[] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.ph
display_top_tabs($tab_array);
?>
-<script type="text/javascript" src="/javascript/row_toggle.js"></script>
-
<?php
if ($savemsg) {
print_info_box($savemsg, 'success');
diff --git a/src/usr/local/www/vpn_ipsec_phase2.php b/src/usr/local/www/vpn_ipsec_phase2.php
index 336739b..e00be54 100644
--- a/src/usr/local/www/vpn_ipsec_phase2.php
+++ b/src/usr/local/www/vpn_ipsec_phase2.php
@@ -659,7 +659,7 @@ foreach ($p2_ealgos as $algo => $algodata) {
$group->add(new Form_Select(
'keylen_' . $algo,
null,
- $keylen == $pconfig["keylen_".$algo],
+ $pconfig["keylen_".$algo],
['auto' => 'Auto'] + $list
));
}
diff --git a/src/usr/local/www/vpn_l2tp.php b/src/usr/local/www/vpn_l2tp.php
index 588ada8..12102ef 100644
--- a/src/usr/local/www/vpn_l2tp.php
+++ b/src/usr/local/www/vpn_l2tp.php
@@ -135,11 +135,7 @@ if ($_POST) {
if (!$input_errors) {
$_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $_POST['l2tp_subnet']);
- $subnet_start = ip2ulong($_POST['remoteip']);
- $subnet_end = ip2ulong($_POST['remoteip']) + $_POST['n_l2tp_units'] - 1;
-
- if ((ip2ulong($_POST['localip']) >= $subnet_start) &&
- (ip2ulong($_POST['localip']) <= $subnet_end)) {
+ if (is_inrange_v4($_POST['localip'], $_POST['remoteip'], ip_after($_POST['remoteip'], $_POST['n_l2tp_units'] - 1))) {
$input_errors[] = gettext("The specified server address lies in the remote subnet.");
}
if ($_POST['localip'] == get_interface_ip("lan")) {
OpenPOWER on IntegriCloud