summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@dds.nl>2011-08-26 13:12:08 +0200
committerSeth Mos <seth.mos@dds.nl>2011-08-26 13:12:08 +0200
commit2feb85af000bcf0ba4f9777b0f41c5dc7286b202 (patch)
tree81183be241a5fd813642359913d4db7a99973e2d
parent7671c94009e66222ff13628e70d427366bb66283 (diff)
downloadpfsense-2feb85af000bcf0ba4f9777b0f41c5dc7286b202.zip
pfsense-2feb85af000bcf0ba4f9777b0f41c5dc7286b202.tar.gz
Add a interface_has_gatewayv6() function to determine if a interface has a IPv6 gateway.
Implement that function return_gateways_array() to prevent ghost entries
-rw-r--r--etc/inc/gwlb.inc7
-rw-r--r--etc/inc/interfaces.inc22
2 files changed, 25 insertions, 4 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 8ed9529..95b4711 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -371,7 +371,7 @@ function return_gateways_array($disabled = false) {
/* Process/add dynamic v6 gateways. */
foreach($iflist as $ifname => $friendly ) {
- if(! interface_has_gateway($ifname))
+ if(! interface_has_gatewayv6($ifname))
continue;
if (empty($config['interfaces'][$ifname]))
@@ -412,7 +412,6 @@ function return_gateways_array($disabled = false) {
$gateway['descr'] = "Interface {$friendly} Dynamic Gateway";
$gateways_arr[$gateway['name']] = $gateway;
}
-
return($gateways_arr);
}
@@ -623,7 +622,7 @@ function get_interface_gateway($interface, &$dynamic = false) {
}
// for dynamic interfaces we handle them through the $interface_router file.
- if (!is_ipaddr($gw) && !is_ipaddr($gwcfg['ipaddr'])) {
+ if (!is_ipaddrv4($gw) && !is_ipaddrv4($gwcfg['ipaddr'])) {
$realif = get_real_interface($interface);
if (file_exists("{$g['tmp_path']}/{$realif}_router")) {
$gw = trim(file_get_contents("{$g['tmp_path']}/{$realif}_router"), " \n");
@@ -653,7 +652,7 @@ function get_interface_gateway_v6($interface, &$dynamic = false) {
}
// for dynamic interfaces we handle them through the $interface_router file.
- if (!is_ipaddrv6($gw) && !is_ipaddr($gwcfg['ipaddrv6'])) {
+ if (!is_ipaddrv6($gw) && !is_ipaddrv6($gwcfg['ipaddrv6'])) {
$realif = get_real_interface($interface);
if (file_exists("{$g['tmp_path']}/{$realif}_routerv6")) {
$gw = trim(file_get_contents("{$g['tmp_path']}/{$realif}_routerv6"), " \n");
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 7d0d021..344d3aa 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -3871,6 +3871,28 @@ function interface_has_gateway($friendly) {
return false;
}
+/* return true if interface has a gateway */
+function interface_has_gatewayv6($friendly) {
+ global $config;
+
+ if (!empty($config['interfaces'][$friendly])) {
+ $ifname = &$config['interfaces'][$friendly];
+ switch ($ifname['ipaddrv6']) {
+ case "dhcp6":
+ return true;
+ break;
+ default:
+ if (substr($ifname['if'], 0, 5) == "ovpnc")
+ return true;
+ if (!empty($ifname['gatewayv6']))
+ return true;
+ break;
+ }
+ }
+
+ return false;
+}
+
/****f* interfaces/is_altq_capable
* NAME
* is_altq_capable - Test if interface is capable of using ALTQ
OpenPOWER on IntegriCloud