1 |
d173230c
|
Seth Mos
|
<?php
|
2 |
124aee67
|
Chris Buechler
|
/* $Id$ */
|
3 |
d173230c
|
Seth Mos
|
/*
|
4 |
|
|
system_gateways_edit.php
|
5 |
|
|
part of pfSense (http://pfsense.com)
|
6 |
|
|
|
7 |
6216690b
|
smos
|
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
|
8 |
d173230c
|
Seth Mos
|
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 |
1d333258
|
Scott Ullrich
|
/*
|
32 |
|
|
pfSense_MODULE: routing
|
33 |
|
|
*/
|
34 |
d173230c
|
Seth Mos
|
|
35 |
6b07c15a
|
Matthew Grooms
|
##|+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 |
124aee67
|
Chris Buechler
|
require("guiconfig.inc");
|
43 |
4666b787
|
Ermal Lu?i
|
require("pkg-utils.inc");
|
44 |
d173230c
|
Seth Mos
|
|
45 |
124aee67
|
Chris Buechler
|
$a_gateways = return_gateways_array();
|
46 |
87f0be87
|
Chris Buechler
|
$a_gateways_arr = array();
|
47 |
|
|
foreach($a_gateways as $gw) {
|
48 |
|
|
$a_gateways_arr[] = $gw;
|
49 |
|
|
}
|
50 |
|
|
$a_gateways = $a_gateways_arr;
|
51 |
d173230c
|
Seth Mos
|
|
52 |
616e1956
|
Seth Mos
|
if (!is_array($config['gateways']['gateway_item']))
|
53 |
|
|
$config['gateways']['gateway_item'] = array();
|
54 |
|
|
|
55 |
|
|
$a_gateway_item = &$config['gateways']['gateway_item'];
|
56 |
|
|
|
57 |
87f0be87
|
Chris Buechler
|
$id = $_GET['id'];
|
58 |
|
|
if (isset($_POST['id']))
|
59 |
d173230c
|
Seth Mos
|
$id = $_POST['id'];
|
60 |
|
|
|
61 |
|
|
if (isset($_GET['dup'])) {
|
62 |
|
|
$id = $_GET['dup'];
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
if (isset($id) && $a_gateways[$id]) {
|
66 |
e90db2b4
|
Ermal Lu?i
|
$pconfig['name'] = $a_gateways[$id]['name'];
|
67 |
5f53260a
|
Ermal
|
$pconfig['weight'] = $a_gateways[$id]['weight'];
|
68 |
e90db2b4
|
Ermal Lu?i
|
$pconfig['interface'] = $a_gateways[$id]['interface'];
|
69 |
883c53c9
|
Ermal Lu?i
|
$pconfig['friendlyiface'] = $a_gateways[$id]['friendlyiface'];
|
70 |
e90db2b4
|
Ermal Lu?i
|
$pconfig['gateway'] = $a_gateways[$id]['gateway'];
|
71 |
883c53c9
|
Ermal Lu?i
|
$pconfig['defaultgw'] = isset($a_gateways[$id]['defaultgw']);
|
72 |
023920e7
|
Ermal
|
$pconfig['latencylow'] = $a_gateway_item[$id]['latencylow'];
|
73 |
|
|
$pconfig['latencyhigh'] = $a_gateway_item[$id]['latencyhigh'];
|
74 |
|
|
$pconfig['losslow'] = $a_gateway_item[$id]['losslow'];
|
75 |
|
|
$pconfig['losshigh'] = $a_gateway_item[$id]['losshigh'];
|
76 |
|
|
$pconfig['down'] = $a_gateway_item[$id]['down'];
|
77 |
a2532739
|
Ermal Lu?i
|
if (isset($a_gateways[$id]['dynamic']))
|
78 |
|
|
$pconfig['dynamic'] = true;
|
79 |
3dd81dea
|
jim-p
|
if(($a_gateways[$id]['monitor'] <> "") && ($a_gateways[$id]['attribute'] != "system") && ($a_gateways[$id]['gateway'] != "dynamic")) {
|
80 |
883c53c9
|
Ermal Lu?i
|
$pconfig['monitor'] = $a_gateways[$id]['monitor'];
|
81 |
616e1956
|
Seth Mos
|
} else {
|
82 |
|
|
$pconfig['monitor'] == "";
|
83 |
|
|
}
|
84 |
e90db2b4
|
Ermal Lu?i
|
$pconfig['descr'] = $a_gateways[$id]['descr'];
|
85 |
|
|
$pconfig['attribute'] = $a_gateways[$id]['attribute'];
|
86 |
d173230c
|
Seth Mos
|
}
|
87 |
|
|
|
88 |
124aee67
|
Chris Buechler
|
if (isset($_GET['dup'])) {
|
89 |
d173230c
|
Seth Mos
|
unset($id);
|
90 |
124aee67
|
Chris Buechler
|
unset($pconfig['attribute']);
|
91 |
|
|
}
|
92 |
d173230c
|
Seth Mos
|
|
93 |
|
|
if ($_POST) {
|
94 |
|
|
|
95 |
|
|
unset($input_errors);
|
96 |
|
|
|
97 |
|
|
/* input validation */
|
98 |
883c53c9
|
Ermal Lu?i
|
$reqdfields = explode(" ", "name");
|
99 |
4af9c6a2
|
Vinicius Coque
|
$reqdfieldsn = array(gettext("Name"));
|
100 |
883c53c9
|
Ermal Lu?i
|
|
101 |
d173230c
|
Seth Mos
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
102 |
883c53c9
|
Ermal Lu?i
|
|
103 |
d173230c
|
Seth Mos
|
if (! isset($_POST['name'])) {
|
104 |
|
|
$input_errors[] = "A valid gateway name must be specified.";
|
105 |
|
|
}
|
106 |
31ace93c
|
Seth Mos
|
if (! is_validaliasname($_POST['name'])) {
|
107 |
df152a88
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("The gateway name must not contain invalid characters.");
|
108 |
31ace93c
|
Seth Mos
|
}
|
109 |
87f0be87
|
Chris Buechler
|
/* skip system gateways which have been automatically added */
|
110 |
d52b71c7
|
Ermal Lu?i
|
if (($_POST['gateway'] && (!is_ipaddr($_POST['gateway'])) && ($_POST['attribute'] != "system")) && ($_POST['gateway'] != "dynamic")) {
|
111 |
df152a88
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid gateway IP address must be specified.");
|
112 |
87f0be87
|
Chris Buechler
|
}
|
113 |
15a13dab
|
Scott Ullrich
|
|
114 |
|
|
if ($_POST['gateway'] && (is_ipaddr($_POST['gateway'])) && ($pconfig['attribute'] != "system") && !$_REQUEST['isAjax']) {
|
115 |
b29b1a33
|
Chris Buechler
|
$parent_ip = get_interface_ip($_POST['interface']);
|
116 |
e227df57
|
Ermal Lu?i
|
if (is_ipaddr($parent_ip)) {
|
117 |
|
|
$parent_sn = get_interface_subnet($_POST['interface']);
|
118 |
|
|
if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn)) {
|
119 |
181b29ca
|
Vinicius Coque
|
$input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']);
|
120 |
e227df57
|
Ermal Lu?i
|
}
|
121 |
e7d3b8f4
|
Seth Mos
|
}
|
122 |
|
|
}
|
123 |
883c53c9
|
Ermal Lu?i
|
if (($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") {
|
124 |
df152a88
|
Carlos Eduardo Ramos
|
$input_errors[] = gettext("A valid monitor IP address must be specified.");
|
125 |
d173230c
|
Seth Mos
|
}
|
126 |
|
|
|
127 |
8b060357
|
Seth Mos
|
if (isset($_POST['name'])) {
|
128 |
31ace93c
|
Seth Mos
|
/* check for overlaps */
|
129 |
|
|
foreach ($a_gateways as $gateway) {
|
130 |
2328dcc5
|
Seth Mos
|
if (isset($id) && ($a_gateways[$id]) && ($a_gateways[$id] === $gateway)) {
|
131 |
31ace93c
|
Seth Mos
|
continue;
|
132 |
|
|
}
|
133 |
2328dcc5
|
Seth Mos
|
if($_POST['name'] <> "") {
|
134 |
883c53c9
|
Ermal Lu?i
|
if (($gateway['name'] <> "") && ($_POST['name'] == $gateway['name']) && ($gateway['attribute'] != "system")) {
|
135 |
0e94685b
|
Renato Botelho
|
$input_errors[] = sprintf(gettext('The gateway name "%s" already exists.'), $_POST['name']);
|
136 |
2328dcc5
|
Seth Mos
|
break;
|
137 |
|
|
}
|
138 |
|
|
}
|
139 |
|
|
if(is_ipaddr($_POST['gateway'])) {
|
140 |
883c53c9
|
Ermal Lu?i
|
if (($gateway['gateway'] <> "") && ($_POST['gateway'] == $gateway['gateway']) && ($gateway['attribute'] != "system")) {
|
141 |
0e94685b
|
Renato Botelho
|
$input_errors[] = sprintf(gettext('The gateway IP address "%s" already exists.'), $_POST['gateway']);
|
142 |
2328dcc5
|
Seth Mos
|
break;
|
143 |
|
|
}
|
144 |
31ace93c
|
Seth Mos
|
}
|
145 |
2328dcc5
|
Seth Mos
|
if(is_ipaddr($_POST['monitor'])) {
|
146 |
883c53c9
|
Ermal Lu?i
|
if (($gateway['monitor'] <> "") && ($_POST['monitor'] == $gateway['monitor']) && ($gateway['attribute'] != "system")) {
|
147 |
0e94685b
|
Renato Botelho
|
$input_errors[] = sprintf(gettext('The monitor IP address "%s" is already in use. You must choose a different monitor IP.'), $_POST['monitor']);
|
148 |
2328dcc5
|
Seth Mos
|
break;
|
149 |
|
|
}
|
150 |
31ace93c
|
Seth Mos
|
}
|
151 |
d173230c
|
Seth Mos
|
}
|
152 |
|
|
}
|
153 |
|
|
|
154 |
023920e7
|
Ermal
|
/* input validation */
|
155 |
|
|
if($_POST['latencylow']) {
|
156 |
|
|
if (! is_numeric($_POST['latencylow'])) {
|
157 |
|
|
$input_errors[] = gettext("The low latency watermark needs to be a numeric value.");
|
158 |
|
|
}
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
if($_POST['latencyhigh']) {
|
162 |
|
|
if (! is_numeric($_POST['latencyhigh'])) {
|
163 |
|
|
$input_errors[] = gettext("The high latency watermark needs to be a numeric value.");
|
164 |
|
|
}
|
165 |
|
|
}
|
166 |
|
|
if($_POST['losslow']) {
|
167 |
|
|
if (! is_numeric($_POST['losslow'])) {
|
168 |
|
|
$input_errors[] = gettext("The low loss watermark needs to be a numeric value.");
|
169 |
|
|
}
|
170 |
|
|
}
|
171 |
|
|
if($_POST['losshigh']) {
|
172 |
|
|
if (! is_numeric($_POST['losshigh'])) {
|
173 |
|
|
$input_errors[] = gettext("The high loss watermark needs to be a numeric value.");
|
174 |
|
|
}
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
if(($_POST['latencylow']) && ($_POST['latencyhigh'])){
|
178 |
|
|
if(($_POST['latencylow'] > $_POST['latencyhigh'])) {
|
179 |
|
|
$input_errors[] = gettext("The High latency watermark needs to be higher then the low latency watermark");
|
180 |
|
|
}
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
if(($_POST['losslow']) && ($_POST['losshigh'])){
|
184 |
|
|
if($_POST['losslow'] > $_POST['losshigh']) {
|
185 |
|
|
$input_errors[] = gettext("The High packet loss watermark needs to be higher then the low packet loss watermark");
|
186 |
|
|
}
|
187 |
|
|
}
|
188 |
|
|
if($_POST['down']) {
|
189 |
|
|
if (! is_numeric($_POST['down']) || $_POST['down'] < 1) {
|
190 |
|
|
$input_errors[] = gettext("The low latency watermark needs to be a numeric value.");
|
191 |
|
|
}
|
192 |
|
|
}
|
193 |
|
|
|
194 |
d173230c
|
Seth Mos
|
if (!$input_errors) {
|
195 |
c6d1c7de
|
Ermal
|
$reloadif = false;
|
196 |
5a5447ab
|
Ermal
|
$save = false;
|
197 |
|
|
if ($_POST['weight'] > 1 || $_POST['latencylow'] || $_POST['latencyhigh'] || $_POST['losslow'] || $_POST['losshigh'] || $_POST['down'] ||
|
198 |
|
|
$_POST['defaultgw'])
|
199 |
|
|
$save = true;
|
200 |
124aee67
|
Chris Buechler
|
/* if we are processing a system gateway only save the monitorip */
|
201 |
5a5447ab
|
Ermal
|
if (!$save && empty($_POST['interface']) && empty($_POST['gateway'])) {
|
202 |
883c53c9
|
Ermal Lu?i
|
if (is_ipaddr($_POST['monitor'])) {
|
203 |
|
|
if (empty($_POST['interface']))
|
204 |
c6d1c7de
|
Ermal
|
$interface = $pconfig['friendlyiface'];
|
205 |
883c53c9
|
Ermal Lu?i
|
else
|
206 |
|
|
$interface = $_POST['interface'];
|
207 |
|
|
$config['interfaces'][$interface]['monitorip'] = $_POST['monitor'];
|
208 |
|
|
}
|
209 |
|
|
/* when dynamic gateway is not anymore a default the entry is no more needed. */
|
210 |
|
|
if (isset($id) && $a_gateway_item[$id]) {
|
211 |
|
|
unset($a_gateway_item[$id]);
|
212 |
|
|
}
|
213 |
|
|
} else {
|
214 |
124aee67
|
Chris Buechler
|
|
215 |
883c53c9
|
Ermal Lu?i
|
/* Manual gateways are handled differently */
|
216 |
|
|
/* rebuild the array with the manual entries only */
|
217 |
124aee67
|
Chris Buechler
|
|
218 |
|
|
$gateway = array();
|
219 |
7bed8222
|
Ermal
|
if ($_POST['attribute'] == "system") {
|
220 |
|
|
$gateway['interface'] = $pconfig['friendlyiface'];
|
221 |
|
|
$gateway['gateway'] = "dynamic";
|
222 |
|
|
} else {
|
223 |
|
|
$gateway['interface'] = $_POST['interface'];
|
224 |
|
|
$gateway['gateway'] = $_POST['gateway'];
|
225 |
|
|
}
|
226 |
124aee67
|
Chris Buechler
|
$gateway['name'] = $_POST['name'];
|
227 |
5f53260a
|
Ermal
|
$gateway['weight'] = $_POST['weight'];
|
228 |
124aee67
|
Chris Buechler
|
$gateway['descr'] = $_POST['descr'];
|
229 |
616e1956
|
Seth Mos
|
if(is_ipaddr($_POST['monitor'])) {
|
230 |
|
|
$gateway['monitor'] = $_POST['monitor'];
|
231 |
|
|
} else {
|
232 |
|
|
unset($gateway['monitor']);
|
233 |
|
|
}
|
234 |
b547deb6
|
Scott Ullrich
|
if ($_POST['defaultgw'] == "yes" or $_POST['defaultgw'] == "on") {
|
235 |
87f0be87
|
Chris Buechler
|
$i = 0;
|
236 |
883c53c9
|
Ermal Lu?i
|
foreach($a_gateway_item as $gw) {
|
237 |
|
|
unset($config['gateways']['gateway_item'][$i]['defaultgw']);
|
238 |
124aee67
|
Chris Buechler
|
$i++;
|
239 |
|
|
}
|
240 |
87f0be87
|
Chris Buechler
|
$gateway['defaultgw'] = true;
|
241 |
c0f5182c
|
Ermal Lu?i
|
$reloadif = true;
|
242 |
87f0be87
|
Chris Buechler
|
} else {
|
243 |
|
|
unset($gateway['defaultgw']);
|
244 |
124aee67
|
Chris Buechler
|
}
|
245 |
|
|
|
246 |
023920e7
|
Ermal
|
if ($_POST['latencylow'])
|
247 |
|
|
$gateway['latencylow'] = $_POST['latencylow'];
|
248 |
|
|
if ($_POST['latencyhigh'])
|
249 |
|
|
$gateway['latencyhigh'] = $_POST['latencyhigh'];
|
250 |
|
|
if ($_POST['losslow'])
|
251 |
|
|
$gateway['losslow'] = $_POST['losslow'];
|
252 |
|
|
if ($_POST['losshigh'])
|
253 |
|
|
$gateway['losshigh'] = $_POST['losshigh'];
|
254 |
|
|
if ($_POST['down'])
|
255 |
|
|
$gateway['down'] = $_POST['down'];
|
256 |
|
|
|
257 |
124aee67
|
Chris Buechler
|
/* when saving the manual gateway we use the attribute which has the corresponding id */
|
258 |
883c53c9
|
Ermal Lu?i
|
if (isset($id) && $a_gateway_item[$id]) {
|
259 |
|
|
$a_gateway_item[$id] = $gateway;
|
260 |
124aee67
|
Chris Buechler
|
} else {
|
261 |
883c53c9
|
Ermal Lu?i
|
$a_gateway_item[] = $gateway;
|
262 |
124aee67
|
Chris Buechler
|
}
|
263 |
|
|
}
|
264 |
e4749e66
|
Seth Mos
|
system_resolvconf_generate();
|
265 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('staticroutes');
|
266 |
d173230c
|
Seth Mos
|
|
267 |
|
|
write_config();
|
268 |
|
|
|
269 |
ad862220
|
Charlie
|
if($_REQUEST['isAjax']) {
|
270 |
|
|
echo $_POST['name'];
|
271 |
|
|
exit;
|
272 |
c0f5182c
|
Ermal Lu?i
|
} else if ($reloadif == true)
|
273 |
|
|
interface_configure($_POST['interface']);
|
274 |
ad862220
|
Charlie
|
|
275 |
d173230c
|
Seth Mos
|
header("Location: system_gateways.php");
|
276 |
|
|
exit;
|
277 |
5313aea5
|
Ermal Lu?i
|
} else {
|
278 |
883c53c9
|
Ermal Lu?i
|
$pconfig = $_POST;
|
279 |
5313aea5
|
Ermal Lu?i
|
if (empty($_POST['friendlyiface']))
|
280 |
|
|
$pconfig['friendlyiface'] = $_POST['interface'];
|
281 |
|
|
}
|
282 |
d173230c
|
Seth Mos
|
}
|
283 |
|
|
|
284 |
2328dcc5
|
Seth Mos
|
|
285 |
df152a88
|
Carlos Eduardo Ramos
|
$pgtitle = array(gettext("System"),gettext("Gateways"),gettext("Edit gateway"));
|
286 |
02ca24c9
|
jim-p
|
$statusurl = "status_gateways.php";
|
287 |
|
|
|
288 |
d173230c
|
Seth Mos
|
include("head.inc");
|
289 |
|
|
|
290 |
|
|
?>
|
291 |
|
|
|
292 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
293 |
|
|
<?php include("fbegin.inc"); ?>
|
294 |
883c53c9
|
Ermal Lu?i
|
<script language="JavaScript">
|
295 |
|
|
function enable_change(obj) {
|
296 |
|
|
if (document.iform.gateway.disabled) {
|
297 |
|
|
if (obj.checked)
|
298 |
|
|
document.iform.interface.disabled=false;
|
299 |
|
|
else
|
300 |
|
|
document.iform.interface.disabled=true;
|
301 |
|
|
}
|
302 |
|
|
|
303 |
|
|
}
|
304 |
023920e7
|
Ermal
|
function show_advanced_gateway() {
|
305 |
|
|
document.getElementById("showadvgatewaybox").innerHTML='';
|
306 |
|
|
aodiv = document.getElementById('showgatewayadv');
|
307 |
|
|
aodiv.style.display = "block";
|
308 |
|
|
}
|
309 |
883c53c9
|
Ermal Lu?i
|
</script>
|
310 |
d173230c
|
Seth Mos
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
311 |
|
|
<form action="system_gateways_edit.php" method="post" name="iform" id="iform">
|
312 |
124aee67
|
Chris Buechler
|
<?php
|
313 |
e9df5769
|
Seth Mos
|
|
314 |
|
|
/* If this is a system gateway we need this var */
|
315 |
124aee67
|
Chris Buechler
|
if(($pconfig['attribute'] == "system") || is_numeric($pconfig['attribute'])) {
|
316 |
|
|
echo "<input type='hidden' name='attribute' id='attribute' value='{$pconfig['attribute']}' >\n";
|
317 |
|
|
}
|
318 |
883c53c9
|
Ermal Lu?i
|
echo "<input type='hidden' name='friendlyiface' id='friendlyiface' value='{$pconfig['friendlyiface']}' >\n";
|
319 |
124aee67
|
Chris Buechler
|
?>
|
320 |
d173230c
|
Seth Mos
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
321 |
56d4e7fb
|
Scott Ullrich
|
<tr>
|
322 |
df152a88
|
Carlos Eduardo Ramos
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit gateway"); ?></td>
|
323 |
56d4e7fb
|
Scott Ullrich
|
</tr>
|
324 |
d173230c
|
Seth Mos
|
<tr>
|
325 |
df152a88
|
Carlos Eduardo Ramos
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
|
326 |
d173230c
|
Seth Mos
|
<td width="78%" class="vtable">
|
327 |
d9a2ff01
|
Ermal Lu?i
|
<select name="interface" class="formselect" <?php if ($pconfig['dynamic'] == true && $pconfig['attribute'] == "system") echo "disabled"; ?>>
|
328 |
883c53c9
|
Ermal Lu?i
|
<?php
|
329 |
|
|
$interfaces = get_configured_interface_with_descr(false, true);
|
330 |
|
|
foreach ($interfaces as $iface => $ifacename) {
|
331 |
|
|
echo "<option value=\"{$iface}\"";
|
332 |
|
|
if ($iface == $pconfig['friendlyiface'])
|
333 |
|
|
echo " selected";
|
334 |
|
|
echo ">" . htmlspecialchars($ifacename) . "</option>";
|
335 |
|
|
}
|
336 |
|
|
if (is_package_installed("openbgpd") == 1) {
|
337 |
|
|
echo "<option value=\"bgpd\"";
|
338 |
|
|
if ($pconfig['interface'] == "bgpd")
|
339 |
|
|
echo " selected";
|
340 |
df152a88
|
Carlos Eduardo Ramos
|
echo ">" . gettext("Use BGPD") . "</option>";
|
341 |
883c53c9
|
Ermal Lu?i
|
}
|
342 |
|
|
?>
|
343 |
d173230c
|
Seth Mos
|
</select> <br>
|
344 |
df152a88
|
Carlos Eduardo Ramos
|
<span class="vexpl"><?=gettext("Choose which interface this gateway applies to."); ?></span></td>
|
345 |
d173230c
|
Seth Mos
|
</tr>
|
346 |
|
|
<tr>
|
347 |
df152a88
|
Carlos Eduardo Ramos
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Name"); ?></td>
|
348 |
d173230c
|
Seth Mos
|
<td width="78%" class="vtable">
|
349 |
|
|
<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>">
|
350 |
df152a88
|
Carlos Eduardo Ramos
|
<br> <span class="vexpl"><?=gettext("Gateway name"); ?></span></td>
|
351 |
d173230c
|
Seth Mos
|
</tr>
|
352 |
|
|
<tr>
|
353 |
df152a88
|
Carlos Eduardo Ramos
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Gateway"); ?></td>
|
354 |
d173230c
|
Seth Mos
|
<td width="78%" class="vtable">
|
355 |
41d98471
|
jim-p
|
<input name="gateway" type="text" class="formfld host" id="gateway" size="40" value="<?php if ($pconfig['dynamic']) echo "dynamic"; else echo $pconfig['gateway']; ?>" <?php if ($pconfig['dynamic'] && $pconfig['attribute'] == "system") echo "disabled"; ?>>
|
356 |
df152a88
|
Carlos Eduardo Ramos
|
<br> <span class="vexpl"><?=gettext("Gateway IP address"); ?></span></td>
|
357 |
d173230c
|
Seth Mos
|
</tr>
|
358 |
|
|
<tr>
|
359 |
df152a88
|
Carlos Eduardo Ramos
|
<td width="22%" valign="top" class="vncell"><?=gettext("Default Gateway"); ?></td>
|
360 |
d173230c
|
Seth Mos
|
<td width="78%" class="vtable">
|
361 |
883c53c9
|
Ermal Lu?i
|
<input name="defaultgw" type="checkbox" id="defaultgw" value="yes" <?php if ($pconfig['defaultgw'] == true) echo "checked"; ?> onclick="enable_change(this)" />
|
362 |
df152a88
|
Carlos Eduardo Ramos
|
<strong><?=gettext("Default Gateway"); ?></strong><br />
|
363 |
|
|
<?=gettext("This will select the above gateway as the default gateway"); ?>
|
364 |
d173230c
|
Seth Mos
|
</td>
|
365 |
|
|
</tr>
|
366 |
|
|
<tr>
|
367 |
df152a88
|
Carlos Eduardo Ramos
|
<td width="22%" valign="top" class="vncell"><?=gettext("Monitor IP"); ?></td>
|
368 |
d173230c
|
Seth Mos
|
<td width="78%" class="vtable">
|
369 |
616e1956
|
Seth Mos
|
<?php
|
370 |
3dd81dea
|
jim-p
|
if(($pconfig['attribute'] == "system") && ($pconfig['gateway'] == "dynamic") && ($pconfig['monitor'] == "")) {
|
371 |
616e1956
|
Seth Mos
|
$monitor = "";
|
372 |
|
|
} else {
|
373 |
|
|
$monitor = htmlspecialchars($pconfig['monitor']);
|
374 |
|
|
}
|
375 |
|
|
?>
|
376 |
|
|
<input name="monitor" type="text" id="monitor" value="<?php echo $monitor; ?>" />
|
377 |
df152a88
|
Carlos Eduardo Ramos
|
<strong><?=gettext("Alternative monitor IP"); ?></strong> <br />
|
378 |
e88ace75
|
Chris Buechler
|
<?=gettext("Enter an alternative address here to be used to monitor the link. This is used for the " .
|
379 |
0e94685b
|
Renato Botelho
|
"quality RRD graphs as well as the load balancer entries. Use this if the gateway does not respond " .
|
380 |
|
|
"to ICMP echo requests (pings)"); ?>.</strong>
|
381 |
d173230c
|
Seth Mos
|
<br />
|
382 |
|
|
</td>
|
383 |
|
|
</tr>
|
384 |
5f53260a
|
Ermal
|
<tr>
|
385 |
023920e7
|
Ermal
|
<td width="22%" valign="top" class="vncell"><?=gettext("Advanced");?></td>
|
386 |
5f53260a
|
Ermal
|
<td width="78%" class="vtable">
|
387 |
023920e7
|
Ermal
|
<div id="showadvgatewaybox" <? if (!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) || !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || (isset($pconfig['weight']) && $pconfig['weight'] > 1)) echo "style='display:none'"; ?>>
|
388 |
|
|
<input type="button" onClick="show_advanced_gateway()" value="Advanced"></input> - Show advanced option</a>
|
389 |
|
|
</div>
|
390 |
|
|
<div id="showgatewayadv" <? if (empty($pconfig['latencylow']) && empty($pconfig['latencyhigh']) && empty($pconfig['losslow']) && empty($pconfig['losshigh']) && (empty($pconfig['weight']) || $pconfig['weight'] == 1)) echo "style='display:none'"; ?>>
|
391 |
|
|
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
|
392 |
|
|
<tr>
|
393 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Weight");?></td>
|
394 |
|
|
<td width="78%" class="vtable">
|
395 |
|
|
<select name='weight' class='formfldselect' id='weight'>
|
396 |
|
|
<?php
|
397 |
|
|
for ($i = 1; $i < 6; $i++) {
|
398 |
|
|
$selected = "";
|
399 |
|
|
if ($pconfig['weight'] == $i)
|
400 |
|
|
$selected = "selected";
|
401 |
|
|
echo "<option value='{$i}' {$selected} >{$i}</option>";
|
402 |
|
|
}
|
403 |
|
|
?>
|
404 |
|
|
</select>
|
405 |
|
|
<br /><?=gettext("Weight for this gateway when used in a Gateway Group.");?> <br />
|
406 |
|
|
</td>
|
407 |
|
|
</tr>
|
408 |
|
|
<tr>
|
409 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Latency thresholds");?></td>
|
410 |
|
|
<td width="78%" class="vtable">
|
411 |
|
|
<?=gettext("From");?>
|
412 |
|
|
<input name="latencylow" type="text" class="formfld unknown" id="latencylow" size="2"
|
413 |
|
|
value="<?=htmlspecialchars($pconfig['latencylow']);?>">
|
414 |
|
|
<?=gettext("To");?>
|
415 |
|
|
<input name="latencyhigh" type="text" class="formfld unknown" id="latencyhigh" size="2"
|
416 |
|
|
value="<?=htmlspecialchars($pconfig['latencyhigh']);?>">
|
417 |
|
|
<br> <span class="vexpl"><?=gettext("These define the low and high water marks for latency in milliseconds.");?></span></td>
|
418 |
|
|
</td>
|
419 |
|
|
</tr>
|
420 |
|
|
<tr>
|
421 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Packet Loss thresholds");?></td>
|
422 |
|
|
<td width="78%" class="vtable">
|
423 |
|
|
<?=gettext("From");?>
|
424 |
|
|
<input name="losslow" type="text" class="formfld unknown" id="losslow" size="2"
|
425 |
|
|
value="<?=htmlspecialchars($pconfig['losslow']);?>">
|
426 |
|
|
<?=gettext("To");?>
|
427 |
|
|
<input name="losshigh" type="text" class="formfld unknown" id="losshigh" size="2"
|
428 |
|
|
value="<?=htmlspecialchars($pconfig['losshigh']);?>">
|
429 |
|
|
<br> <span class="vexpl"><?=gettext("These define the low and high water marks for packet loss in %.");?></span></td>
|
430 |
|
|
</td>
|
431 |
|
|
</tr>
|
432 |
|
|
<tr>
|
433 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Down");?></td>
|
434 |
|
|
<td width="78%" class="vtable">
|
435 |
|
|
<input name="down" type="text" class="formfld unknown" id="down" size="2"
|
436 |
|
|
value="<?=htmlspecialchars($pconfig['down']);?>">
|
437 |
|
|
<br> <span class="vexpl"><?=gettext("This defines the down time for the alarm to fire, in seconds.");?></span></td>
|
438 |
|
|
</td>
|
439 |
|
|
</tr>
|
440 |
|
|
</table>
|
441 |
|
|
</div>
|
442 |
5f53260a
|
Ermal
|
</td>
|
443 |
|
|
</tr>
|
444 |
d173230c
|
Seth Mos
|
<tr>
|
445 |
df152a88
|
Carlos Eduardo Ramos
|
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
|
446 |
d173230c
|
Seth Mos
|
<td width="78%" class="vtable">
|
447 |
|
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
|
448 |
0e94685b
|
Renato Botelho
|
<br> <span class="vexpl"><?=gettext("You may enter a description here for your reference (not parsed)"); ?>.</span></td>
|
449 |
d173230c
|
Seth Mos
|
</tr>
|
450 |
|
|
<tr>
|
451 |
|
|
<td width="22%" valign="top"> </td>
|
452 |
|
|
<td width="78%">
|
453 |
bfb0b9dc
|
Vinicius Coque
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input type="button" value="<?=gettext("Cancel");?>" class="formbtn" onclick="history.back()">
|
454 |
d173230c
|
Seth Mos
|
<?php if (isset($id) && $a_gateways[$id]): ?>
|
455 |
|
|
<input name="id" type="hidden" value="<?=$id;?>">
|
456 |
|
|
<?php endif; ?>
|
457 |
|
|
</td>
|
458 |
|
|
</tr>
|
459 |
|
|
</table>
|
460 |
|
|
</form>
|
461 |
|
|
<?php include("fend.inc"); ?>
|
462 |
|
|
<script language="JavaScript">
|
463 |
883c53c9
|
Ermal Lu?i
|
enable_change(document.iform.defaultgw);
|
464 |
d173230c
|
Seth Mos
|
</script>
|
465 |
|
|
</body>
|
466 |
|
|
</html>
|