summaryrefslogtreecommitdiffstats
path: root/etc/inc/gwlb.inc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-09-03 16:52:07 +0000
committerErmal <eri@pfsense.org>2013-09-03 16:52:43 +0000
commit32a9eb1873d67ae581ba084ee9fcbf079215ecce (patch)
tree75ee87c37f2863a8b02879da829f0d8d5b48fe39 /etc/inc/gwlb.inc
parent243680e54daea3fa26134450f5be8277e25e091a (diff)
downloadpfsense-32a9eb1873d67ae581ba084ee9fcbf079215ecce.zip
pfsense-32a9eb1873d67ae581ba084ee9fcbf079215ecce.tar.gz
Bring back static routes to fix issues reported on Ticext #3179
Diffstat (limited to 'etc/inc/gwlb.inc')
-rw-r--r--etc/inc/gwlb.inc24
1 files changed, 24 insertions, 0 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 1adc751..e61d8da 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -162,6 +162,18 @@ EOD;
$gwifip = find_interface_ip($gateway['interface'], true);
if (!is_ipaddrv4($gwifip))
continue; //Skip this target
+
+ /*
+ * If the gateway is the same as the monitor we do not add a
+ * route as this will break the routing table.
+ * Add static routes for each gateway with their monitor IP
+ * not strictly necessary but is a added level of protection.
+ */
+ if (is_ipaddrv4($gateway['gateway']) && $gateway['monitor'] != $gateway['gateway']) {
+ log_error("Removing static route for monitor {$gateway['monitor']} and adding a new route through {$gateway['gateway']}");
+ mwexec("/sbin/route change -host " . escapeshellarg($gateway['monitor']) .
+ " " . escapeshellarg($gateway['gateway']), true);
+ }
} else if (is_ipaddrv6($gateway['gateway'])) {
/* link locals really need a different src ip */
if(is_linklocal($gateway['gateway'])) {
@@ -173,6 +185,18 @@ EOD;
$gateway['monitor'] .= "%{$gateway['interface']}";
if (!is_ipaddrv6($gwifip))
continue; //Skip this target
+
+ /*
+ * If the gateway is the same as the monitor we do not add a
+ * route as this will break the routing table.
+ * Add static routes for each gateway with their monitor IP
+ * not strictly necessary but is a added level of protection.
+ */
+ if (is_ipaddrv6($gateway['gateway']) && $gateway['monitor'] != $gateway['gateway']) {
+ log_error("Removing static route for monitor {$gateway['monitor']} and adding a new route through {$gateway['gateway']}");
+ mwexec("/sbin/route change -host -inet6 " . escapeshellarg($gateway['monitor']) .
+ " " . escapeshellarg($gateway['gateway']), true);
+ }
} else
continue;
OpenPOWER on IntegriCloud