Project

General

Profile

« Previous | Next » 

Revision 33c06ef7

Added by Ermal LUÇI about 14 years ago

Add a new option to allow disabling of gateway monitoring. This gateways will always be reported as up.

View differences:

etc/inc/gwlb.inc
137 137
EOD;
138 138

  
139 139
	foreach($gateways_arr as $name => $gateway) {
140
		/* Do not monitor if such was requested */
141
		if (isset($gateway['monitor_disable']))
142
			continue;
140 143
		if (empty($gateway['monitor']) || !is_ipaddr($gateway['monitor'])) {
141 144
			if (is_ipaddr($gateway['gateway']))
142 145
				$gateway['monitor'] = $gateway['gateway'];
......
287 290
					$gateway['gateway'] = "dynamic";
288 291
				$gateway['dynamic'] = true;
289 292
			}
290
			if(empty($gateway['monitor']))
293
			if (isset($gateway['monitor_disable']))
294
				$gateway['monitor_disable'] = true;
295
			else if (empty($gateway['monitor']))
291 296
				$gateway['monitor'] = $gateway['gateway'];
292 297

  
293 298
			$gateway['friendlyiface'] = $gateway['interface'];
......
383 388
			if (isset($gwsttng['defaultgw'])) {
384 389
				$dfltgwfound = true;
385 390
				$dfltgwname = $gwname;
386
				if (stristr($gateways_status[$gwname]['status'], "down"))
391
				if (!isset($gwsttng['monitor_disable']) && stristr($gateways_status[$gwname]['status'], "down"))
387 392
					$dfltgwdown = true;
388 393
			}
389 394
			/* Keep a record of the last up gateway */
390
			if (empty($upgw) && !stristr($gateways_status[$gwname]['status'], "down"))
395
			if (empty($upgw) && (isset($gwsttng['monitor_disable']) || !stristr($gateways_status[$gwname]['status'], "down")))
391 396
				$upgw = $gwname;
392 397
			if ($dfltgwdown == true && !empty($upgw))
393 398
				break;
394 399
		}
395 400
		if ($dfltgwfound == false) {
396 401
			$gwname = convert_friendly_interface_to_friendly_descr("wan");
397
			if (stristr($gateways_status[$gwname]['status'], "down"))
402
			if (!empty($gateways_status[$gwname]) && stristr($gateways_status[$gwname]['status'], "down"))
398 403
				$dfltgwdown = true;
399 404
		}
400 405
		if ($dfltgwdown == true && !empty($upgw)) {
......
449 454
					} else
450 455
						/* Online add member */
451 456
						$tiers[$tier][] = $gwname;
452
				}
457
				} else if (isset($gateways_arr[$gwname]['monitor_disable']))
458
					$tiers[$tier][] = $gwname;
453 459
			}
454 460
			$tiers_count = count($tiers);
455 461
			if($tiers_count == 0) {

Also available in: Unified diff