1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
system_gateways.php
|
5
|
part of pfSense (http://pfsense.com)
|
6
|
|
7
|
Copyright (C) 2007 Seth Mos <seth.mos@xs4all.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
|
37
|
##|*NAME=System: Gateways page
|
38
|
##|*DESCR=Allow access to the 'System: Gateways' page.
|
39
|
##|*MATCH=system_gateways.php*
|
40
|
##|-PRIV
|
41
|
|
42
|
require("guiconfig.inc");
|
43
|
|
44
|
$a_gateways = return_gateways_array();
|
45
|
$a_gateways_arr = array();
|
46
|
foreach($a_gateways as $gw) {
|
47
|
$a_gateways_arr[] = $gw;
|
48
|
}
|
49
|
$a_gateways = $a_gateways_arr;
|
50
|
$changedesc = "Gateways: ";
|
51
|
|
52
|
if ($_POST) {
|
53
|
|
54
|
$pconfig = $_POST;
|
55
|
|
56
|
if ($_POST['apply']) {
|
57
|
|
58
|
$retval = 0;
|
59
|
|
60
|
$retval = system_routing_configure();
|
61
|
$retval |= filter_configure();
|
62
|
/* reconfigure our gateway monitor */
|
63
|
setup_gateways_monitor();
|
64
|
|
65
|
$savemsg = get_std_save_message($retval);
|
66
|
if ($retval == 0)
|
67
|
clear_subsystem_dirty('staticroutes');
|
68
|
}
|
69
|
}
|
70
|
|
71
|
if ($_GET['act'] == "del") {
|
72
|
if ($a_gateways[$_GET['id']]) {
|
73
|
/* remove the real entry */
|
74
|
$realid = $a_gateways[$_GET['id']]['attribute'];
|
75
|
$a_gateways = &$config['gateways']['gateway_item'];
|
76
|
|
77
|
$changedesc .= "removed gateway {$realid}";
|
78
|
unset($a_gateways[$realid]);
|
79
|
write_config($changedesc);
|
80
|
mark_subsystem_dirty('staticroutes');
|
81
|
header("Location: system_gateways.php");
|
82
|
exit;
|
83
|
}
|
84
|
}
|
85
|
|
86
|
|
87
|
$pgtitle = array("System","Gateways");
|
88
|
include("head.inc");
|
89
|
|
90
|
?>
|
91
|
|
92
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
93
|
<?php include("fbegin.inc"); ?>
|
94
|
<form action="system_gateways.php" method="post">
|
95
|
<input type="hidden" name="y1" value="1">
|
96
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
97
|
<?php if (is_subsystem_dirty('staticroutes')): ?><p>
|
98
|
<?php print_info_box_np("The gateway configuration has been changed.<br>You must apply the changes in order for them to take
|
99
|
effect.");?><br>
|
100
|
<?php endif; ?>
|
101
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
102
|
<tr>
|
103
|
<td>
|
104
|
<?php
|
105
|
$tab_array = array();
|
106
|
$tab_array[0] = array("Gateways", true, "system_gateways.php");
|
107
|
$tab_array[1] = array("Routes", false, "system_routes.php");
|
108
|
$tab_array[2] = array("Groups", false, "system_gateway_groups.php");
|
109
|
$tab_array[3] = array("Settings", false, "system_gateways_settings.php");
|
110
|
display_top_tabs($tab_array);
|
111
|
?>
|
112
|
</td></tr>
|
113
|
<tr>
|
114
|
<td>
|
115
|
<div id="mainarea">
|
116
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
117
|
<tr>
|
118
|
<td width="15%" class="listhdrr">Name</td>
|
119
|
<td width="15%" class="listhdrr">Interface</td>
|
120
|
<td width="20%" class="listhdrr">Gateway</td>
|
121
|
<td width="20%" class="listhdrr">Monitor IP</td>
|
122
|
<td width="30%" class="listhdr">Description</td>
|
123
|
<td width="10%" class="list">
|
124
|
<table border="0" cellspacing="0" cellpadding="1">
|
125
|
<tr>
|
126
|
<td width="17"></td>
|
127
|
<td><a href="system_gateways_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
128
|
</tr>
|
129
|
</table>
|
130
|
</td>
|
131
|
</tr>
|
132
|
<?php $i = 0; foreach ($a_gateways as $gateway): ?>
|
133
|
<tr>
|
134
|
<td class="listlr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
|
135
|
<?php
|
136
|
echo $gateway['name'];
|
137
|
if(isset($gateway['defaultgw'])) {
|
138
|
echo " <strong>(default)<strong>";
|
139
|
}
|
140
|
?>
|
141
|
|
142
|
</td>
|
143
|
<td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
|
144
|
<?php
|
145
|
echo htmlspecialchars(convert_real_interface_to_friendly_descr($gateway['interface']));
|
146
|
?>
|
147
|
</td>
|
148
|
<td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
|
149
|
<?php
|
150
|
if(isset($gateway['interfacegateway'])) {
|
151
|
echo strtoupper($gateway['interface']) . " ";
|
152
|
} else {
|
153
|
echo $gateway['gateway'] . " ";
|
154
|
}
|
155
|
?>
|
156
|
</td>
|
157
|
<td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
|
158
|
<?=htmlspecialchars($gateway['monitor']);?>
|
159
|
</td>
|
160
|
<td class="listbg" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
|
161
|
<?=htmlspecialchars($gateway['descr']);?>
|
162
|
</td>
|
163
|
<td valign="middle" nowrap class="list">
|
164
|
<table border="0" cellspacing="0" cellpadding="1">
|
165
|
<tr>
|
166
|
<td><a href="system_gateways_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
|
167
|
<td><a href="system_gateways.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this gateway?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
|
168
|
</tr>
|
169
|
<tr>
|
170
|
<td width="17"></td>
|
171
|
<td><a href="system_gateways_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
172
|
</tr>
|
173
|
</table>
|
174
|
|
175
|
</tr>
|
176
|
<?php $i++; endforeach; ?>
|
177
|
<tr>
|
178
|
<td class="list" colspan="5"></td>
|
179
|
<td class="list">
|
180
|
<table border="0" cellspacing="0" cellpadding="1">
|
181
|
<tr>
|
182
|
<td width="17"></td>
|
183
|
<td><a href="system_gateways_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
184
|
</tr>
|
185
|
</table>
|
186
|
</td>
|
187
|
</tr>
|
188
|
</table>
|
189
|
</div>
|
190
|
</td>
|
191
|
</tr>
|
192
|
</table>
|
193
|
</form>
|
194
|
<?php include("fend.inc"); ?>
|
195
|
</body>
|
196
|
</html>
|