summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-10-29 07:05:30 -0200
committerRenato Botelho <garga@FreeBSD.org>2013-10-29 07:06:05 -0200
commit6721d6d0443bd7e697bd6ca33f470c801608df7e (patch)
tree95298639678905022619992d54ceadc2bd494395
parent9aca73906007b79ae47dc2493fd9b04fde95189a (diff)
downloadpfsense-6721d6d0443bd7e697bd6ca33f470c801608df7e.zip
pfsense-6721d6d0443bd7e697bd6ca33f470c801608df7e.tar.gz
Define dynamic gateway for GRE interfaces and do not user to define IP address to the interface. Fixes #3280
-rw-r--r--etc/inc/gwlb.inc4
-rw-r--r--etc/inc/interfaces.inc20
-rwxr-xr-xusr/local/www/interfaces.php5
3 files changed, 28 insertions, 1 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 012b288..92b90f3 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -483,6 +483,8 @@ function return_gateways_array($disabled = false, $localhost = false) {
default:
if (substr($ifcfg['if'], 0, 4) == "ovpn")
$ctype = "VPNv4";
+ else if (substr($ifcfg['if'], 0, 3) == "gre")
+ $ctype = "GREv4";
break;
}
$ctype = "_". strtoupper($ctype);
@@ -553,6 +555,8 @@ function return_gateways_array($disabled = false, $localhost = false) {
default:
if (substr($ifcfg['if'], 0, 4) == "ovpn")
$ctype = "VPNv6";
+ else if (substr($ifcfg['if'], 0, 3) == "gre")
+ $ctype = "GREv6";
break;
}
$ctype = "_". strtoupper($ctype);
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 2ede93e..42c173d 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -4922,7 +4922,7 @@ function get_interfaces_with_gateway() {
$ints[$ifdescr] = $ifdescr;
break;
default:
- if (substr($ifname['if'], 0, 4) == "ovpn" ||
+ if (preg_match('/^(ovpn|gre)/', $ifname['if']) ||
!empty($ifname['gateway']))
$ints[$ifdescr] = $ifdescr;
break;
@@ -4948,6 +4948,15 @@ function interface_has_gateway($friendly) {
default:
if (substr($ifname['if'], 0, 4) == "ovpn")
return true;
+ if (substr($ifname['if'], 0, 3) == "gre" &&
+ is_array($config['gres']['gre'])) {
+ foreach ($config['gres']['gre'] as $gre) {
+ if ($gre['greif'] != $ifname['if'])
+ continue;
+ if (is_ipaddrv4($gre['tunnel-remote-addr']))
+ return true;
+ }
+ }
if (!empty($ifname['gateway']))
return true;
break;
@@ -4973,6 +4982,15 @@ function interface_has_gatewayv6($friendly) {
default:
if (substr($ifname['if'], 0, 4) == "ovpn")
return true;
+ if (substr($ifname['if'], 0, 3) == "gre" &&
+ is_array($config['gres']['gre'])) {
+ foreach ($config['gres']['gre'] as $gre) {
+ if ($gre['greif'] != $ifname['if'])
+ continue;
+ if (is_ipaddrv6($gre['tunnel-remote-addr']))
+ return true;
+ }
+ }
if (!empty($ifname['gatewayv6']))
return true;
break;
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index ae9a668..874eb2d 100755
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -458,6 +458,11 @@ if ($_POST['apply']) {
} else if ($_POST) {
unset($input_errors);
+
+ if (substr($wancfg['if'], 0, 3) == "gre" &&
+ ($_POST['type'] != "none" || $_POST['type'] != "none"))
+ $input_errors[] = gettext("You cannot set an IPv4 or IPv6 address to a GRE interface");
+
$pconfig = $_POST;
if (is_numeric("0x" . $_POST['track6-prefix-id--hex']))
$pconfig['track6-prefix-id'] = intval($_POST['track6-prefix-id--hex'], 16);
OpenPOWER on IntegriCloud