diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-02-13 19:28:18 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-02-13 19:28:18 +0000 |
commit | f7ced886ec3c70db70930d436507d914ed468eec (patch) | |
tree | 181f244e6d34ec3d6b69d72149e857c38ddcff2c /etc/inc/vslb.inc | |
parent | 79379fa0a43e795763d2d9e56c40d04387408863 (diff) | |
download | pfsense-f7ced886ec3c70db70930d436507d914ed468eec.zip pfsense-f7ced886ec3c70db70930d436507d914ed468eec.tar.gz |
Handle a very unique edge case when using load balancing plus a dhcp wan. If the DHCP wan goes down, then when we add back the route freebsd will simply prefer the working wan.
Diffstat (limited to 'etc/inc/vslb.inc')
-rw-r--r-- | etc/inc/vslb.inc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/etc/inc/vslb.inc b/etc/inc/vslb.inc index 6dddff0..d107306 100644 --- a/etc/inc/vslb.inc +++ b/etc/inc/vslb.inc @@ -116,8 +116,18 @@ function slbd_configure() { /* Add static routes to the monitor IPs */ $int = convert_friendly_interface_to_real_interface_name($lbsvr_split[0]); $gateway = get_interface_gateway($int); - mwexec("/sbin/route delete -host {$lbsvr_split[1]} 1>/dev/null 2>&1"); - mwexec("/sbin/route add -host {$lbsvr_split[1]} {$gateway} 1> /dev/null 2>&1"); + $int_ip = find_interface_ip($int); + if($int_ip == "0.0.0.0") { + /* DHCP Corner case. If DHCP is down, we delete the route then + * there is a chance the monitor ip gateway will go out the link + * that is up. + */ + mwexec("/sbin/route delete -host {$lbsvr_split[1]} 1>/dev/null 2>&1"); + mwexec("/sbin/route add -host {$lbsvr_split[1]} 127.0.0.1 1> /dev/null 2>&1"); + } else { + mwexec("/sbin/route delete -host {$lbsvr_split[1]} 1>/dev/null 2>&1"); + mwexec("/sbin/route add -host {$lbsvr_split[1]} {$gateway} 1> /dev/null 2>&1"); + } } $slbdconf .= "\t:service-port=666:\\\n"; $slbdconf .= "\t:method=round-robin:\\\n"; |