From 12805cecc63ebaa9651b1a29d7fde1f973e35b0a Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 23 Nov 2009 17:07:25 -0500 Subject: Do not allow sync loops take #2 --- config/haproxy/haproxy.inc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc index e55eca59..11fd3782 100644 --- a/config/haproxy/haproxy.inc +++ b/config/haproxy/haproxy.inc @@ -255,8 +255,22 @@ function haproxy_do_xmlrpc_sync($sync_to_ip, $password) { return; // Do not allow syncing to self. - if(`/sbin/ifconfig -a | grep "$sync_to_ip"`) + $donotsync = false; + $lanip = find_interface_ip($config['interfaces']['lan']['if']); + if($lanip == $sync_to_ip) + $donotsync = true; + $wanip = find_interface_ip($config['interfaces']['wan']['if']); + if($wanip == $sync_to_ip) + $donotsync = true; + for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) { + $optip = find_interface_ip($config['interfaces']['opt' . $j]['if']); + if($optip == $sync_to_ip) + $donotsync = true; + } + if($donotsync) { + log_error("Disallowing sync loop for HAProxy sync."); return; + } $xmlrpc_sync_neighbor = $sync_to_ip; if($config['system']['webgui']['protocol'] != "") { -- cgit v1.2.3