Project

General

Profile

Download (22.5 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php 
2
/* $Id$ */
3
/*
4
	system_gateways_edit.php
5
	part of pfSense (http://pfsense.com)
6
	
7
	Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
8
	All rights reserved.
9
	
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12
	
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15
	
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19
	
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/*
32
	pfSense_MODULE:	routing
33
*/
34

    
35
##|+PRIV
36
##|*IDENT=page-system-gateways-editgateway
37
##|*NAME=System: Gateways: Edit Gateway page
38
##|*DESCR=Allow access to the 'System: Gateways: Edit Gateway' page.
39
##|*MATCH=system_gateways_edit.php*
40
##|-PRIV
41

    
42
require("guiconfig.inc");
43
require("pkg-utils.inc");
44

    
45
$a_gateways = return_gateways_array(true);
46
$a_gateways_arr = array();
47
foreach($a_gateways as $gw) {
48
	$a_gateways_arr[] = $gw;
49
}
50
$a_gateways = $a_gateways_arr;
51

    
52
if (!is_array($config['gateways']['gateway_item']))
53
        $config['gateways']['gateway_item'] = array();
54
        
55
$a_gateway_item = &$config['gateways']['gateway_item'];
56

    
57
$id = $_GET['id'];
58
if (isset($_POST['id']))
59
	$id = $_POST['id'];
60

    
61
if (isset($_GET['dup'])) {
62
	$id = $_GET['dup'];
63
}
64

    
65
if (isset($id) && $a_gateways[$id]) {
66
	$pconfig = array();
67
	$pconfig['name'] = $a_gateways[$id]['name'];
68
	$pconfig['weight'] = $a_gateways[$id]['weight'];
69
	$pconfig['interval'] = $a_gateways[$id]['interval'];
70
	$pconfig['interface'] = $a_gateways[$id]['interface'];
71
	$pconfig['friendlyiface'] = $a_gateways[$id]['friendlyiface'];
72
	if (isset($a_gateways[$id]['dynamic']))
73
		$pconfig['dynamic'] = true;
74
	$pconfig['gateway'] = $a_gateways[$id]['gateway'];
75
	$pconfig['defaultgw'] = isset($a_gateways[$id]['defaultgw']);
76
	$pconfig['latencylow'] = $a_gateway_item[$id]['latencylow'];
77
        $pconfig['latencyhigh'] = $a_gateway_item[$id]['latencyhigh'];
78
        $pconfig['losslow'] = $a_gateway_item[$id]['losslow'];
79
        $pconfig['losshigh'] = $a_gateway_item[$id]['losshigh'];
80
        $pconfig['down'] = $a_gateway_item[$id]['down'];
81
	$pconfig['monitor'] = $a_gateways[$id]['monitor'];
82
	$pconfig['monitor_disable'] = isset($a_gateways[$id]['monitor_disable']);
83
	$pconfig['descr'] = $a_gateways[$id]['descr'];
84
	$pconfig['attribute'] = $a_gateways[$id]['attribute'];
85
}
86

    
87
if (isset($_GET['dup'])) {
88
	unset($id);
89
	unset($pconfig['attribute']);
90
}
91

    
92
if ($_POST) {
93

    
94
	unset($input_errors);
95

    
96
	/* input validation */
97
	$reqdfields = explode(" ", "name interface");
98
	$reqdfieldsn = array(gettext("Name"), gettext("Interface"));
99

    
100
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
101

    
102
	if (! isset($_POST['name'])) {
103
		$input_errors[] = "A valid gateway name must be specified.";
104
	}
105
	if (! is_validaliasname($_POST['name'])) {
106
		$input_errors[] = gettext("The gateway name must not contain invalid characters.");
107
	}
108
	/* skip system gateways which have been automatically added */
109
	if (($_POST['gateway'] && (!is_ipaddr($_POST['gateway'])) && ($_POST['attribute'] != "system")) && ($_POST['gateway'] != "dynamic")) {
110
		$input_errors[] = gettext("A valid gateway IP address must be specified.");
111
	}
112

    
113
	if ($_POST['gateway'] && (is_ipaddr($_POST['gateway'])) && !$_REQUEST['isAjax']) {
114
		if(is_ipaddrv4($_POST['gateway'])) {
115
			$parent_ip = get_interface_ip($_POST['interface']);
116
			$parent_sn = get_interface_subnet($_POST['interface']);
117
			if(empty($parent_ip) || empty($parent_sn)) {
118
				$input_errors[] = gettext("You can not use a IPv6 Gateway Address on a IPv4 only interface.");
119
			} else {
120
				$subnet = gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn;
121
				if(!ip_in_subnet($_POST['gateway'], $subnet))
122
					$input_errors[] = sprintf(gettext("The gateway address %1\$s does not lie within the chosen interface's subnet '%2\$s'."), $_POST['gateway'],$subnet);
123
			}
124
		}
125
		if(is_ipaddrv6($_POST['gateway'])) {
126
			$parent_ip = get_interface_ipv6($_POST['interface']);
127
			$parent_sn = get_interface_subnetv6($_POST['interface']);
128
			if(empty($parent_ip) || empty($parent_sn)) {
129
				$input_errors[] = gettext("You can not use a IPv4 Gateway Address on a IPv6 only interface.");
130
			} else {
131
				$subnet = gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn;
132
				if(!ip_in_subnet($_POST['gateway'], $subnet))
133
					$input_errors[] = sprintf(gettext("The gateway address %1\$s does not lie within the chosen interface's subnet '%2\$s'."), $_POST['gateway'],$subnet);
134
			}
135
		}
136

    
137
		if (!empty($config['interfaces'][$_POST['interface']]['ipaddr'])) {
138
			if (is_ipaddr($config['interfaces'][$_POST['interface']]['ipaddr']) && (empty($_POST['gateway']) || $_POST['gateway'] == "dynamic"))
139
				$input_errors[] = gettext("Dynamic gateway values cannot be specified for interfaces with a static IPv4 configuration.");
140
		}
141
		if (!empty($config['interfaces'][$_POST['interface']]['ipaddrv6'])) {
142
			if (is_ipaddr($config['interfaces'][$_POST['interface']]['ipaddrv6']) && (empty($_POST['gateway']) || $_POST['gateway'] == "dynamic"))
143
				$input_errors[] = gettext("Dynamic gateway values cannot be specified for interfaces with a static IPv6 configuration.");
144
		}
145
	}
146
	if (($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") {
147
		$input_errors[] = gettext("A valid monitor IP address must be specified.");
148
	}
149
	if (($_POST['monitor'] <> "") && is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") {
150
		if(!validate_address_family($_POST['monitor'], $_POST['gateway'])) {
151
			$input_errors[] = gettext("The monitor address '{$_POST['monitor']}' is a different Address Family then gateway '{$_POST['gateway']}'.");
152
		}
153
	}
154

    
155
	if (isset($_POST['name'])) {
156
		/* check for overlaps */
157
		foreach ($a_gateways as $gateway) {
158
			if (isset($id) && ($a_gateways[$id]) && ($a_gateways[$id] === $gateway)) {
159
				if ($gateway['name'] != $_POST['name'])
160
					$input_errors[] = gettext("Changing name on a gateway is not allowed.");
161
				continue;
162
			}
163
			if($_POST['name'] <> "") {
164
				if (($gateway['name'] <> "") && ($_POST['name'] == $gateway['name']) && ($gateway['attribute'] != "system")) {
165
					$input_errors[] = sprintf(gettext('The gateway name "%s" already exists.'), $_POST['name']);
166
					break;
167
				}
168
			}
169
			if(is_ipaddr($_POST['gateway'])) {
170
				if (($gateway['gateway'] <> "") && ($_POST['gateway'] == $gateway['gateway']) && ($gateway['attribute'] != "system")) {
171
					$input_errors[] = sprintf(gettext('The gateway IP address "%s" already exists.'), $_POST['gateway']);
172
					break;
173
				}
174
			}
175
			if(is_ipaddr($_POST['monitor'])) {
176
				if (($gateway['monitor'] <> "") && ($_POST['monitor'] == $gateway['monitor']) && ($gateway['attribute'] != "system")) {
177
					$input_errors[] = sprintf(gettext('The monitor IP address "%s" is already in use. You must choose a different monitor IP.'), $_POST['monitor']);
178
					break;
179
				}
180
			}
181
		}
182
	}
183

    
184
	/* input validation */
185
        if($_POST['latencylow']) {
186
                if (! is_numeric($_POST['latencylow'])) {
187
                        $input_errors[] = gettext("The low latency watermark needs to be a numeric value.");
188
                }
189
        }
190

    
191
        if($_POST['latencyhigh']) {
192
                if (! is_numeric($_POST['latencyhigh'])) {
193
                        $input_errors[] = gettext("The high latency watermark needs to be a numeric value.");
194
                }
195
        }
196
        if($_POST['losslow']) {
197
                if (! is_numeric($_POST['losslow'])) {
198
                        $input_errors[] = gettext("The low loss watermark needs to be a numeric value.");
199
                }
200
        }
201
        if($_POST['losshigh']) {
202
                if (! is_numeric($_POST['losshigh'])) {
203
                        $input_errors[] = gettext("The high loss watermark needs to be a numeric value.");
204
                }
205
        }
206

    
207
        if(($_POST['latencylow']) && ($_POST['latencyhigh'])){
208
                if(($_POST['latencylow'] > $_POST['latencyhigh'])) {
209
                        $input_errors[] = gettext("The High latency watermark needs to be higher then the low latency watermark");
210
                }
211
        }
212

    
213
        if(($_POST['losslow']) && ($_POST['losshigh'])){
214
                if($_POST['losslow'] > $_POST['losshigh']) {
215
                        $input_errors[] = gettext("The High packet loss watermark needs to be higher then the low packet loss watermark");
216
                }
217
        }
218
	if($_POST['down']) {
219
                if (! is_numeric($_POST['down']) || $_POST['down'] < 1) {
220
                        $input_errors[] = gettext("The low latency watermark needs to be a numeric value.");
221
                }
222
        }
223

    
224
	if (!$input_errors) {
225
		$reloadif = "";
226
		$gateway = array();
227

    
228
		if (empty($_POST['interface']))
229
			$gateway['interface'] = $pconfig['friendlyiface'];
230
		else
231
			$gateway['interface'] = $_POST['interface'];
232
		if (is_ipaddr($_POST['gateway']))
233
			$gateway['gateway'] = $_POST['gateway'];
234
		else
235
			$gateway['gateway'] = "dynamic";
236
		$gateway['name'] = $_POST['name'];
237
		$gateway['weight'] = $_POST['weight'];
238
		$gateway['interval'] = $_POST['interval'];
239
		$gateway['descr'] = $_POST['descr'];
240
		if ($_POST['monitor_disable'] == "yes")
241
			$gateway['monitor_disable'] = true;
242
		else if (is_ipaddr($_POST['monitor']))
243
			$gateway['monitor'] = $_POST['monitor'];
244

    
245
		if ($_POST['defaultgw'] == "yes" || $_POST['defaultgw'] == "on") {
246
			$i = 0;
247
			/* remove the default gateway bits for all gateways with the same address family */
248
			foreach($a_gateway_item as $gw) {
249
				if(is_ipaddrv4($gateway['gateway']) && is_ipaddrv4($gw['gateway'])) {
250
					unset($config['gateways']['gateway_item'][$i]['defaultgw']);
251
					if ($gw['interface'] != $_POST['interface'] && $gw['defaultgw'])
252
						$reloadif = $gw['interface'];
253
				}
254
				if(is_ipaddrv6($gateway['gateway']) && is_ipaddrv6($gw['gateway'])) {
255
					unset($config['gateways']['gateway_item'][$i]['defaultgw']);
256
					if ($gw['interface'] != $_POST['interface'] && $gw['defaultgw'])
257
						$reloadif = $gw['interface'];
258
				}
259
				$i++;
260
			}
261
			$gateway['defaultgw'] = true;
262
		}
263

    
264
		if ($_POST['latencylow'])
265
			$gateway['latencylow'] = $_POST['latencylow'];
266
		if ($_POST['latencyhigh'])
267
               		$gateway['latencyhigh'] = $_POST['latencyhigh'];
268
		if ($_POST['losslow'])
269
              			$gateway['losslow'] = $_POST['losslow'];
270
		if ($_POST['losshigh'])
271
               		$gateway['losshigh'] = $_POST['losshigh'];
272
		if ($_POST['down'])
273
               		$gateway['down'] = $_POST['down'];
274

    
275
		/* when saving the manual gateway we use the attribute which has the corresponding id */
276
		if (isset($id) && $a_gateway_item[$id])
277
			$a_gateway_item[$id] = $gateway;
278
		else
279
			$a_gateway_item[] = $gateway;
280

    
281
		mark_subsystem_dirty('staticroutes');
282
	
283
		write_config();
284

    
285
		if($_REQUEST['isAjax']) {
286
			echo $_POST['name'];
287
			exit;
288
		} else if (!empty($reloadif))
289
			send_event("interface reconfigure {$reloadif}");
290
		
291
		header("Location: system_gateways.php");
292
		exit;
293
	} else {
294
		$pconfig = $_POST;
295
		if (empty($_POST['friendlyiface']))
296
			$pconfig['friendlyiface'] = $_POST['interface'];
297
	}
298
}
299

    
300

    
301
$pgtitle = array(gettext("System"),gettext("Gateways"),gettext("Edit gateway"));
302
$statusurl = "status_gateways.php";
303

    
304
include("head.inc");
305

    
306
?>
307

    
308
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
309
<?php include("fbegin.inc"); ?>
310
<script language="JavaScript">
311
function show_advanced_gateway() {
312
        document.getElementById("showadvgatewaybox").innerHTML='';
313
        aodiv = document.getElementById('showgatewayadv');
314
        aodiv.style.display = "block";
315
}
316
function monitor_change() {
317
        document.iform.monitor.disabled = document.iform.monitor_disable.checked;
318
}
319
</script>
320
<?php if ($input_errors) print_input_errors($input_errors); ?>
321
            <form action="system_gateways_edit.php" method="post" name="iform" id="iform">
322
	<?php
323

    
324
	/* If this is a system gateway we need this var */
325
	if(($pconfig['attribute'] == "system") || is_numeric($pconfig['attribute'])) {
326
		echo "<input type='hidden' name='attribute' id='attribute' value='{$pconfig['attribute']}' >\n";
327
	}
328
	echo "<input type='hidden' name='friendlyiface' id='friendlyiface' value='{$pconfig['friendlyiface']}' >\n";
329
	?>
330
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
331
				<tr>
332
					<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit gateway"); ?></td>
333
				</tr>	
334
                <tr> 
335
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
336
                  <td width="78%" class="vtable">
337
		 	<select name='interface' class='formselect' >
338

    
339
		<?php 
340
                      	$interfaces = get_configured_interface_with_descr(false, true);
341
			foreach ($interfaces as $iface => $ifacename) {
342
				echo "<option value=\"{$iface}\"";
343
				if ($iface == $pconfig['friendlyiface'])
344
					echo " selected";
345
				echo ">" . htmlspecialchars($ifacename) . "</option>";
346
			}
347
			if (is_package_installed("openbgpd") == 1) {
348
				echo "<option value=\"bgpd\"";
349
				if ($pconfig['interface'] == "bgpd") 
350
					echo " selected";
351
				echo ">" . gettext("Use BGPD") . "</option>";
352
			}
353
 		  ?>
354
                    </select> <br>
355
                    <span class="vexpl"><?=gettext("Choose which interface this gateway applies to."); ?></span></td>
356
                </tr>
357
                <tr>
358
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Name"); ?></td>
359
                  <td width="78%" class="vtable"> 
360
                    <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>"> 
361
                    <br> <span class="vexpl"><?=gettext("Gateway name"); ?></span></td>
362
                </tr>
363
		<tr>
364
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Gateway"); ?></td>
365
                  <td width="78%" class="vtable"> 
366
                    <input name="gateway" type="text" class="formfld host" id="gateway" size="28" value="<?php if ($pconfig['dynamic']) echo "dynamic"; else echo $pconfig['gateway']; ?>">
367
                    <br> <span class="vexpl"><?=gettext("Gateway IP address"); ?></span></td>
368
                </tr>
369
		<tr>
370
		  <td width="22%" valign="top" class="vncell"><?=gettext("Default Gateway"); ?></td>
371
		  <td width="78%" class="vtable">
372
			<input name="defaultgw" type="checkbox" id="defaultgw" value="yes" <?php if ($pconfig['defaultgw'] == true) echo "checked"; ?> />
373
			<strong><?=gettext("Default Gateway"); ?></strong><br />
374
			<?=gettext("This will select the above gateway as the default gateway"); ?>
375
		  </td>
376
		</tr>
377
		<tr>
378
		  <td width="22%" valign="top" class="vncell"><?=gettext("Disable Gateway Monitoring"); ?></td>
379
		  <td width="78%" class="vtable">
380
			<input name="monitor_disable" type="checkbox" id="monitor_disable" value="yes" <?php if ($pconfig['monitor_disable'] == true) echo "checked"; ?> onClick="monitor_change()" />
381
			<strong><?=gettext("Disable Gateway Monitoring"); ?></strong><br />
382
			<?=gettext("This will consider this gateway as always being up"); ?>
383
		  </td>
384
		</tr>
385
		<tr>
386
		  <td width="22%" valign="top" class="vncell"><?=gettext("Monitor IP"); ?></td>
387
		  <td width="78%" class="vtable">
388
			<?php
389
				if ($pconfig['gateway'] == $pconfig['monitor'])
390
					$monitor = "";
391
				else
392
					$monitor = htmlspecialchars($pconfig['monitor']);
393
			?>
394
			<input name="monitor" type="text" id="monitor" value="<?php echo $monitor; ?>" size="28" />
395
			<strong><?=gettext("Alternative monitor IP"); ?></strong> <br />
396
			<?=gettext("Enter an alternative address here to be used to monitor the link. This is used for the " .
397
			"quality RRD graphs as well as the load balancer entries. Use this if the gateway does not respond " .
398
			"to ICMP echo requests (pings)"); ?>.</strong>
399
			<br />
400
		  </td>
401
		</tr>
402
		<tr>
403
		  <td width="22%" valign="top" class="vncell"><?=gettext("Advanced");?></td>
404
		  <td width="78%" class="vtable">
405
			<?php $showbutton = (!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) || !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || (isset($pconfig['weight']) && $pconfig['weight'] > 1) || (isset($pconfig['interval']) && $pconfig['interval'])); ?>
406
			<div id="showadvgatewaybox" <? if ($showbutton) echo "style='display:none'"; ?>>
407
				<input type="button" onClick="show_advanced_gateway()" value="Advanced"></input> - Show advanced option</a>
408
			</div>
409
			<div id="showgatewayadv" <? if (!$showbutton) echo "style='display:none'"; ?>>
410
                        <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
411
			<tr>
412
                                <td width="22%" valign="top" class="vncellreq"><?=gettext("Weight");?></td>
413
                                <td width="78%" class="vtable">
414
					<select name='weight' class='formfldselect' id='weight'>
415
				<?php
416
					for ($i = 1; $i < 6; $i++) {
417
                                        	$selected = "";
418
                                        	if ($pconfig['weight'] == $i)
419
                                                	$selected = "selected";
420
                                        	echo "<option value='{$i}' {$selected} >{$i}</option>";
421
                                	}
422
				?>
423
					</select>
424
					<br /><?=gettext("Weight for this gateway when used in a Gateway Group.");?> <br />
425
		   		</td>
426
			</tr>
427
                        <tr>
428
                                <td width="22%" valign="top" class="vncellreq"><?=gettext("Latency thresholds");?></td>
429
                                <td width="78%" class="vtable">
430
                                <?=gettext("From");?>
431
                                    <input name="latencylow" type="text" class="formfld unknown" id="latencylow" size="2"
432
                                        value="<?=htmlspecialchars($pconfig['latencylow']);?>">
433
                                <?=gettext("To");?>
434
                                    <input name="latencyhigh" type="text" class="formfld unknown" id="latencyhigh" size="2"
435
                                        value="<?=htmlspecialchars($pconfig['latencyhigh']);?>">
436
                                    <br> <span class="vexpl"><?=gettext("These define the low and high water marks for latency in milliseconds. Default is 100/200.");?></span></td>
437
                                </td>
438
                        </tr>
439
                        <tr>
440
                                <td width="22%" valign="top" class="vncellreq"><?=gettext("Packet Loss thresholds");?></td>
441
                                <td width="78%" class="vtable">
442
                                <?=gettext("From");?>
443
                                    <input name="losslow" type="text" class="formfld unknown" id="losslow" size="2"
444
                                        value="<?=htmlspecialchars($pconfig['losslow']);?>">
445
                                <?=gettext("To");?>
446
                                    <input name="losshigh" type="text" class="formfld unknown" id="losshigh" size="2"
447
                                        value="<?=htmlspecialchars($pconfig['losshigh']);?>">
448
                                    <br> <span class="vexpl"><?=gettext("These define the low and high water marks for packet loss in %. Default is 10/20.");?></span></td>
449
                                </td>
450
                        </tr>
451
			<tr>
452
				<td width="22%" valign="top" class="vncellreq"><?=gettext("Frequency Probe");?></td>
453
				<td width="78%" class="vtable">
454
					<input name="interval" type="text" class="formfld unknown" id="interval" size="2"
455
						value="<?=htmlspecialchars($pconfig['interval']);?>">
456
					<br><span class="vexpl">
457
						<?=gettext("This defines how often that an icmp probe will be sent in seconds. Default is 1.");?><br/><br/>
458
						<?=gettext("NOTE: The quality graph is averaged over seconds, not intervals, so as the frequency probe is increased the accuracy of the quality graph is decreased.");?>
459
					</span></td>
460
				</td>
461
			</tr>
462
			<tr>
463
				<td width="22%" valign="top" class="vncellreq"><?=gettext("Down");?></td>
464
				<td width="78%" class="vtable">
465
					<input name="down" type="text" class="formfld unknown" id="down" size="2"
466
						value="<?=htmlspecialchars($pconfig['down']);?>">
467
					<br> <span class="vexpl"><?=gettext("This defines the number of bad probes before the alarm will fire. Default is 10.");?></span></td>
468
				</td>
469
			</tr>
470
			<tr>
471
				<td colspan="2">
472
					<?= gettext("NOTE: The total time before a gateway is down is the product of the Frequency Probe and the Down fields. By default this is 1*10=10 seconds."); ?><br/>
473
					<?php if (is_numeric($pconfig['interval']) || is_numeric($pconfig['down'])) {
474
						echo "<br/>";
475
						$interval = is_numeric($pconfig['interval']) ? $pconfig['interval'] : 1;
476
						$down = is_numeric($pconfig['down']) ? $pconfig['down'] : 10;
477
						echo gettext(sprintf("With the current configuration, the total time before this gateway would be considered down would be: %d*%d=%d seconds.", $interval, $down, $interval*$down));
478
					} ?>
479
				</td>
480
			</tr>
481
                        </table>
482
			</div>
483
		   </td>
484
		</tr>
485
		<tr>
486
                  <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
487
                  <td width="78%" class="vtable"> 
488
                    <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
489
                    <br> <span class="vexpl"><?=gettext("You may enter a description here for your reference (not parsed)"); ?>.</span></td>
490
                </tr>
491
                <tr>
492
                  <td width="22%" valign="top">&nbsp;</td>
493
                  <td width="78%"> 
494
                    <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input type="button" value="<?=gettext("Cancel");?>" class="formbtn"  onclick="history.back()">
495
                    <?php if (isset($id) && $a_gateways[$id]): ?>
496
                    <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
497
                    <?php endif; ?>
498
                  </td>
499
                </tr>
500
              </table>
501
</form>
502
<?php include("fend.inc"); ?>
503
<script language="JavaScript">
504
monitor_change();
505
</script>
506
</body>
507
</html>
(206-206/238)