Project

General

Profile

« Previous | Next » 

Revision f328ad12

Added by Seth Mos over 13 years ago

Fix for redmine ticket #1993. Allow saving multiple dynamic entries.
Make sure that return_gateways_status() also returns all gateways that have monitoring disabled as up.

View differences:

etc/inc/gwlb.inc
267 267
		$status[$target]['status'] = trim($info[8]);
268 268
	}
269 269

  
270
	/* tack on any gateways that have monitoring disabled */
271
	$gateways_arr = return_gateways_array();
272
	foreach($gateways_arr as $gwitem) {
273
		if(isset($gwitem['monitor_disable'])) {
274
			if(!is_ipaddr($gwitem['monitorip'])) {
275
				$realif = $gwitem['interface'];
276
				$tgtip = get_interface_gateway($realif);
277
				$srcip = find_interface_ip($realif);
278
			} else {
279
				$tgtip = $gwitem['monitorip'];
280
				$srcip = find_interface_ip($realif);
281
			}
282
			if($byname == true)
283
				$target = $gwitem['name'];
284
			else
285
				$target = $tgtip;
286

  
287
			$status[$target]['monitorip'] = $tgtip;
288
			$status[$target]['srcip'] = $srcip;
289
			$status[$target]['name'] = $gwitem['name'];
290
			$status[$target]['lastcheck'] = date('r');
291
			$status[$target]['delay'] = "0.0ms";
292
			$status[$target]['loss'] = "0.0%";
293
			$status[$target]['status'] = "none";
294
		}
295
	}
270 296
	return($status);
271 297
}
272 298

  
usr/local/www/system_gateways_edit.php
197 197
        }
198 198

  
199 199
	if (!$input_errors) {
200
		if (!($_POST['weight'] > 1 || $_POST['latencylow'] || $_POST['latencyhigh'] ||
201
		    $_POST['losslow'] || $_POST['losshigh'] || $_POST['down'] ||
202
		    $_POST['defaultgw'] || is_ipaddr($_POST['monitor']) || is_ipaddr($_POST['gateway']))) {
203
		/* Delete from config if gw is dynamic and user is not saving any additional gateway data that system doesn't know */
204
			if (isset($id) && $a_gateway_item[$id])
205
				unset($a_gateway_item[$id]);
206
			write_config();
207
			header("Location: system_gateways.php");
208
			exit;
209
		}
210

  
211

  
212 200
		$reloadif = "";
213 201
		$gateway = array();
214 202

  

Also available in: Unified diff