Project

General

Profile

Download (22.6 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
			/* do not do a subnet match on a link local address, it's valid */
127
			if(! preg_match("/fe80::/", $_POST['gateway'])) {
128
				$parent_ip = get_interface_ipv6($_POST['interface']);
129
				$parent_sn = get_interface_subnetv6($_POST['interface']);
130
				if(empty($parent_ip) || empty($parent_sn)) {
131
					$input_errors[] = gettext("You can not use a IPv4 Gateway Address on a IPv6 only interface.");
132
				} else {
133
					$subnet = gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn;
134
					if(!ip_in_subnet($_POST['gateway'], $subnet))
135
						$input_errors[] = sprintf(gettext("The gateway address %1\$s does not lie within the chosen interface's subnet '%2\$s'."), $_POST['gateway'],$subnet);
136
				}
137
			}
138
		}
139

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

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

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

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

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

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

    
227
	if (!$input_errors) {
228
		$reloadif = "";
229
		$gateway = array();
230

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

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

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

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

    
284
		mark_subsystem_dirty('staticroutes');
285
	
286
		write_config();
287

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

    
303

    
304
$pgtitle = array(gettext("System"),gettext("Gateways"),gettext("Edit gateway"));
305
$statusurl = "status_gateways.php";
306

    
307
include("head.inc");
308

    
309
?>
310

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

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

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