1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
system_routes.php
|
5
|
part of m0n0wall (http://m0n0.ch/wall)
|
6
|
|
7
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
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-staticroutes
|
37
|
##|*NAME=System: Static Routes page
|
38
|
##|*DESCR=Allow access to the 'System: Static Routes' page.
|
39
|
##|*MATCH=system_routes.php*
|
40
|
##|-PRIV
|
41
|
|
42
|
require("guiconfig.inc");
|
43
|
require_once("functions.inc");
|
44
|
require_once("filter.inc");
|
45
|
require_once("shaper.inc");
|
46
|
|
47
|
if (!is_array($config['staticroutes']['route']))
|
48
|
$config['staticroutes']['route'] = array();
|
49
|
|
50
|
if (!is_array($config['gateways']['gateway_item']))
|
51
|
$config['gateways']['gateway_item'] = array();
|
52
|
|
53
|
$a_routes = &$config['staticroutes']['route'];
|
54
|
$a_gateways = &$config['gateways']['gateway_item'];
|
55
|
$changedesc = "Static Routes: ";
|
56
|
|
57
|
if ($_POST) {
|
58
|
|
59
|
$pconfig = $_POST;
|
60
|
|
61
|
if ($_POST['apply']) {
|
62
|
|
63
|
$retval = 0;
|
64
|
|
65
|
$retval = system_routing_configure();
|
66
|
$retval |= filter_configure();
|
67
|
/* reconfigure our gateway monitor */
|
68
|
setup_gateways_monitor();
|
69
|
|
70
|
$savemsg = get_std_save_message($retval);
|
71
|
if ($retval == 0)
|
72
|
clear_subsystem_dirty('staticroutes');
|
73
|
} else {
|
74
|
if ($_POST['enablefastrouting'] == "") {
|
75
|
/* Only update config if something changed */
|
76
|
if (isset($config['staticroutes']['enablefastrouting'])) {
|
77
|
$changedesc .= " disable fast routing";
|
78
|
unset($config['staticroutes']['enablefastrouting']);
|
79
|
write_config($changedesc);
|
80
|
}
|
81
|
} else {
|
82
|
/* Only update config if something changed */
|
83
|
if (!isset($config['staticroutes']['enablefastrouting'])) {
|
84
|
$changedesc .= " enable fast routing";
|
85
|
$config['staticroutes']['enablefastrouting'] = "enabled";
|
86
|
write_config($changedesc);
|
87
|
}
|
88
|
}
|
89
|
}
|
90
|
}
|
91
|
|
92
|
if ($_GET['act'] == "del") {
|
93
|
if ($a_routes[$_GET['id']]) {
|
94
|
$changedesc .= "removed route to " . $a_routes[$_GET['id']['route']];
|
95
|
unset($a_routes[$_GET['id']]);
|
96
|
write_config($changedesc);
|
97
|
mark_subsystem_dirty('staticroutes');
|
98
|
header("Location: system_routes.php");
|
99
|
exit;
|
100
|
}
|
101
|
}
|
102
|
|
103
|
$pgtitle = array("System","Static Routes");
|
104
|
include("head.inc");
|
105
|
|
106
|
?>
|
107
|
|
108
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
109
|
<?php include("fbegin.inc"); ?>
|
110
|
<form action="system_routes.php" method="post">
|
111
|
<input type="hidden" name="y1" value="1">
|
112
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
113
|
<?php if (is_subsystem_dirty('staticroutes')): ?><p>
|
114
|
<?php print_info_box_np("The static route configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
|
115
|
<?php endif; ?>
|
116
|
|
117
|
<?php if($config['system']['disablefilter'] <> "") :?>
|
118
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
119
|
|
120
|
<tr><td width="2%"><input type="checkbox" name="enablefastrouting" id="enablefastrouting" <?php if($config['staticroutes']['enablefastrouting'] == "enabled") echo " checked"; ?>></td><td><b>Enable fast routing</td></tr>
|
121
|
|
122
|
<tr><td colspan=2><hr><input type="submit" value="Save"></td></tr>
|
123
|
</table><br>
|
124
|
<?php endif; ?>
|
125
|
|
126
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
127
|
<tr>
|
128
|
<td>
|
129
|
<?php
|
130
|
$tab_array = array();
|
131
|
$tab_array[0] = array("Gateways", false, "system_gateways.php");
|
132
|
$tab_array[1] = array("Routes", true, "system_routes.php");
|
133
|
$tab_array[2] = array("Groups", false, "system_gateway_groups.php");
|
134
|
$tab_array[3] = array("Settings", false, "system_gateways_settings.php");
|
135
|
display_top_tabs($tab_array);
|
136
|
?>
|
137
|
</td></tr>
|
138
|
<tr>
|
139
|
<td>
|
140
|
<div id="mainarea">
|
141
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
142
|
<tr>
|
143
|
<td width="25%" class="listhdrr">Network</td>
|
144
|
<td width="20%" class="listhdrr">Gateway</td>
|
145
|
<td width="15%" class="listhdrr">Interface</td>
|
146
|
<td width="30%" class="listhdr">Description</td>
|
147
|
<td width="10%" class="list">
|
148
|
<table border="0" cellspacing="0" cellpadding="1">
|
149
|
<tr>
|
150
|
<td width="17"></td>
|
151
|
<td><a href="system_routes_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
152
|
</tr>
|
153
|
</table>
|
154
|
</td>
|
155
|
</tr>
|
156
|
<tr>
|
157
|
<?php $i = 0; foreach ($a_routes as $route): ?>
|
158
|
<td class="listlr" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
|
159
|
<?=strtolower($route['network']);?>
|
160
|
</td>
|
161
|
<td class="listr" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
|
162
|
<?php
|
163
|
echo $route['gateway'] . " ";
|
164
|
?>
|
165
|
</td>
|
166
|
<td class="listr" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
|
167
|
<?php
|
168
|
foreach($a_gateways as $gateway) {
|
169
|
if($gateway['name'] == $route['gateway']) {
|
170
|
echo strtoupper($gateway['interface']) . " ";
|
171
|
}
|
172
|
}
|
173
|
|
174
|
?>
|
175
|
</td>
|
176
|
<td class="listbg" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
|
177
|
<?=htmlspecialchars($route['descr']);?>
|
178
|
</td>
|
179
|
<td valign="middle" nowrap class="list">
|
180
|
<table border="0" cellspacing="0" cellpadding="1">
|
181
|
<tr>
|
182
|
<td><a href="system_routes_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
|
183
|
<td><a href="system_routes.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this route?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
|
184
|
</tr>
|
185
|
<tr>
|
186
|
<td width="17"></td>
|
187
|
<td><a href="system_routes_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
188
|
</tr>
|
189
|
</table>
|
190
|
</td>
|
191
|
</tr>
|
192
|
<?php $i++; endforeach; ?>
|
193
|
<tr>
|
194
|
<td class="list" colspan="4"></td>
|
195
|
<td class="list">
|
196
|
<table border="0" cellspacing="0" cellpadding="1">
|
197
|
<tr>
|
198
|
<td width="17"></td>
|
199
|
<td><a href="system_routes_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
200
|
</tr>
|
201
|
</table>
|
202
|
</td>
|
203
|
</tr>
|
204
|
</table>
|
205
|
</div>
|
206
|
</td>
|
207
|
</tr>
|
208
|
</table>
|
209
|
</form>
|
210
|
<p><b>Note:</b> Do not enter static routes for networks assigned on any interface of this firewall. Static routes are only used for networks reachable via a different router, and not reachable via your default gateway.</p>
|
211
|
<?php include("fend.inc"); ?>
|
212
|
</body>
|
213
|
</html>
|