summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/interfaces_gre_edit.php
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2015-09-21 19:02:51 -0500
committerChris Buechler <cmb@pfsense.org>2015-09-21 19:03:40 -0500
commita1f318f9c67f2d14ba857a62a6fc9dc1777e7a35 (patch)
treee3c684ca748968a518b09a0bacfc9f7bc9b5d653 /src/usr/local/www/interfaces_gre_edit.php
parentd62df86b7c65ca8de0c67053bf030954fdbc27af (diff)
downloadpfsense-a1f318f9c67f2d14ba857a62a6fc9dc1777e7a35.zip
pfsense-a1f318f9c67f2d14ba857a62a6fc9dc1777e7a35.tar.gz
interfaces_gre_edit.php - fix display of input errors, improve input
validation.
Diffstat (limited to 'src/usr/local/www/interfaces_gre_edit.php')
-rw-r--r--src/usr/local/www/interfaces_gre_edit.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/usr/local/www/interfaces_gre_edit.php b/src/usr/local/www/interfaces_gre_edit.php
index b0f06d8..b092ab1 100644
--- a/src/usr/local/www/interfaces_gre_edit.php
+++ b/src/usr/local/www/interfaces_gre_edit.php
@@ -83,7 +83,29 @@ if ($_POST) {
(!is_ipaddr($_POST['remote-addr']))) {
$input_errors[] = gettext("The tunnel local and tunnel remote fields must have valid IP addresses.");
}
+
+ if (!is_numericint($_POST['tunnel-remote-net'])) {
+ $input_errors[] = gettext("The GRE tunnel subnet must be an integer.");
+ }
+
+ if (is_ipaddrv4($_POST['tunnel-local-addr'])) {
+ if (!is_ipaddrv4($_POST['tunnel-remote-addr'])) {
+ $input_errors[] = gettext("The GRE Tunnel remote address must be IPv4 where tunnel local address is IPv4.");
+ }
+ if ($_POST['tunnel-remote-net'] > 32 || $_POST['tunnel-remote-net'] < 1) {
+ $input_errors[] = gettext("The GRE tunnel subnet must be an integer between 1 and 32.");
+ }
+ }
+ if (is_ipaddrv6($_POST['tunnel-local-addr'])) {
+ if (!is_ipaddrv6($_POST['tunnel-remote-addr'])) {
+ $input_errors[] = gettext("The GRE Tunnel remote address must be IPv6 where tunnel local address is IPv6.");
+ }
+ if ($_POST['tunnel-remote-net'] > 128 || $_POST['tunnel-remote-net'] < 1) {
+ $input_errors[] = gettext("The GRE tunnel subnet must be an integer between 1 and 128.");
+ }
+ }
+
foreach ($a_gres as $gre) {
if (isset($id) && ($a_gres[$id]) && ($a_gres[$id] === $gre)) {
continue;
@@ -143,6 +165,10 @@ function build_parent_list() {
$pgtitle = array(gettext("Interfaces"),gettext("GRE"),gettext("Edit"));
$shortcut_section = "interfaces";
include("head.inc");
+
+if ($input_errors)
+ print_input_errors($input_errors);
+
require_once('classes/Form.class.php');
$form = new Form();
@@ -176,7 +202,7 @@ $section->addInput(new Form_IpAddress(
$section->addInput(new Form_Select(
'tunnel-remote-net',
- 'GRE tunnel remote subnet',
+ 'GRE tunnel subnet',
$pconfig['tunnel-remote-net'],
array_combine(range(128, 1, -1), range(128, 1, -1))
))->setHelp('The subnet is used for determining the network that is tunnelled');
OpenPOWER on IntegriCloud