diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-10-29 07:05:30 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-10-29 07:05:44 -0200 |
commit | bb6291e0204ffe2828fe9c9425bdae9c8541fe54 (patch) | |
tree | 217b898c9ddfafc2f037c57ca32d2406df8e40a5 /etc | |
parent | d3ad6cf012e51d820c03e08f05e56986c5682f1e (diff) | |
download | pfsense-bb6291e0204ffe2828fe9c9425bdae9c8541fe54.zip pfsense-bb6291e0204ffe2828fe9c9425bdae9c8541fe54.tar.gz |
Define dynamic gateway for GRE interfaces and do not user to define IP address to the interface. Fixes #3280
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/gwlb.inc | 4 | ||||
-rw-r--r-- | etc/inc/interfaces.inc | 20 |
2 files changed, 23 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 7178a61..7ec1e06 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -4622,7 +4622,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; @@ -4648,6 +4648,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; @@ -4673,6 +4682,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; |