diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 20f049c2b6..4e19e2bcf9 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -162,6 +162,10 @@ EOD; $apingercfg .= "target \"{$gateway['monitor']}\" {\n"; $apingercfg .= " description \"{$gateway['name']}\"\n"; + $gwifip = find_interface_ip($gateway['interface']); + if (!is_ipaddr($gwifip)) + continue; //Skip this target + $apingercfg .= " srcip \"{$gwifip}\"\n"; $alarms = ""; $override = false; if (!empty($gwref['lowloss'])) { @@ -217,9 +221,7 @@ EOD; * route as this will break the routing table */ continue; } else { - if (!empty($gateway_status[$gateway['monitor']]) && $gateway_status[$gateway['monitor']]['status'] == "down") - ; /* This check makes sure that we do not delete previous routes. */ - else if ($gateway['gateway'] != "dynamic" && is_ipaddr($gateway['gateway'])) { + if ($gateway['gateway'] != "dynamic" && is_ipaddr($gateway['gateway'])) { mwexec("/sbin/route delete -host " . escapeshellarg($gateway['monitor'])); mwexec("/sbin/route add -host " . escapeshellarg($gateway['monitor']) . " " . escapeshellarg($gateway['gateway'])); @@ -393,7 +395,7 @@ function return_gateway_groups_array() { } else { $tiers[$tier][] = $gwname; } - } elseif (stristr($status['status'], "none")) { + } elseif ($status['status'] == "none")) { /* Online add member */ $tiers[$tier][] = $gwname; }