1 |
5b237745
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
system_routes.php
|
5 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
8450bc24
|
Scott Ullrich
|
|
7 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
8 |
|
|
All rights reserved.
|
9 |
8450bc24
|
Scott Ullrich
|
|
10 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
11 |
|
|
modification, are permitted provided that the following conditions are met:
|
12 |
8450bc24
|
Scott Ullrich
|
|
13 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
this list of conditions and the following disclaimer.
|
15 |
8450bc24
|
Scott Ullrich
|
|
16 |
5b237745
|
Scott Ullrich
|
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 |
8450bc24
|
Scott Ullrich
|
|
20 |
5b237745
|
Scott Ullrich
|
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 |
5b237745
|
Scott Ullrich
|
|
35 |
6b07c15a
|
Matthew Grooms
|
##|+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 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
43 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
44 |
|
|
require_once("filter.inc");
|
45 |
|
|
require_once("shaper.inc");
|
46 |
5b237745
|
Scott Ullrich
|
|
47 |
|
|
if (!is_array($config['staticroutes']['route']))
|
48 |
|
|
$config['staticroutes']['route'] = array();
|
49 |
|
|
|
50 |
|
|
$a_routes = &$config['staticroutes']['route'];
|
51 |
6fdea6a2
|
smos
|
$a_gateways = return_gateways_array(true, true);
|
52 |
79eaddf4
|
Renato Botelho
|
$changedesc = gettext("Static Routes") . ": ";
|
53 |
5b237745
|
Scott Ullrich
|
|
54 |
|
|
if ($_POST) {
|
55 |
|
|
|
56 |
|
|
$pconfig = $_POST;
|
57 |
|
|
|
58 |
|
|
if ($_POST['apply']) {
|
59 |
691dade5
|
Scott Ullrich
|
|
60 |
5b237745
|
Scott Ullrich
|
$retval = 0;
|
61 |
3851094f
|
Scott Ullrich
|
|
62 |
e8471084
|
Ermal
|
if (file_exists("{$g['tmp_path']}/.system_routes.apply")) {
|
63 |
bfe407e5
|
Warren Baker
|
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.system_routes.apply"));
|
64 |
e8471084
|
Ermal
|
foreach ($toapplylist as $toapply)
|
65 |
|
|
mwexec("{$toapply}");
|
66 |
|
|
|
67 |
|
|
@unlink("{$g['tmp_path']}/.system_routes.apply");
|
68 |
|
|
}
|
69 |
|
|
|
70 |
3851094f
|
Scott Ullrich
|
$retval = system_routing_configure();
|
71 |
|
|
$retval |= filter_configure();
|
72 |
13bbe450
|
Seth Mos
|
/* reconfigure our gateway monitor */
|
73 |
|
|
setup_gateways_monitor();
|
74 |
3851094f
|
Scott Ullrich
|
|
75 |
5b237745
|
Scott Ullrich
|
$savemsg = get_std_save_message($retval);
|
76 |
a368a026
|
Ermal Lu?i
|
if ($retval == 0)
|
77 |
|
|
clear_subsystem_dirty('staticroutes');
|
78 |
5b237745
|
Scott Ullrich
|
}
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
if ($_GET['act'] == "del") {
|
82 |
|
|
if ($a_routes[$_GET['id']]) {
|
83 |
40fb81a1
|
Carlos Eduardo Ramos
|
$changedesc .= gettext("removed route to") . " " . $a_routes[$_GET['id']['route']];
|
84 |
ad700f39
|
Seth Mos
|
if(is_ipaddrv6($a_routes[$_GET['id']]['network']))
|
85 |
|
|
$family = "-inet6";
|
86 |
|
|
mwexec("/sbin/route delete {$family} " . escapeshellarg($a_routes[$_GET['id']]['network']));
|
87 |
5b237745
|
Scott Ullrich
|
unset($a_routes[$_GET['id']]);
|
88 |
59d922dc
|
Bill Marquette
|
write_config($changedesc);
|
89 |
5b237745
|
Scott Ullrich
|
header("Location: system_routes.php");
|
90 |
|
|
exit;
|
91 |
|
|
}
|
92 |
|
|
}
|
93 |
7f43ca88
|
Scott Ullrich
|
|
94 |
a2927ebf
|
Vinicius Coque
|
$pgtitle = array(gettext("System"),gettext("Static Routes"));
|
95 |
b32dd0a6
|
jim-p
|
$shortcut_section = "routing";
|
96 |
02ca24c9
|
jim-p
|
|
97 |
7f43ca88
|
Scott Ullrich
|
include("head.inc");
|
98 |
|
|
|
99 |
5b237745
|
Scott Ullrich
|
?>
|
100 |
|
|
|
101 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
102 |
|
|
<?php include("fbegin.inc"); ?>
|
103 |
|
|
<form action="system_routes.php" method="post">
|
104 |
691dade5
|
Scott Ullrich
|
<input type="hidden" name="y1" value="1">
|
105 |
5b237745
|
Scott Ullrich
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
106 |
a368a026
|
Ermal Lu?i
|
<?php if (is_subsystem_dirty('staticroutes')): ?><p>
|
107 |
40fb81a1
|
Carlos Eduardo Ramos
|
<?php print_info_box_np(sprintf(gettext("The static route configuration has been changed.%sYou must apply the changes in order for them to take effect."), "<br>"));?><br>
|
108 |
5b237745
|
Scott Ullrich
|
<?php endif; ?>
|
109 |
0f282d7a
|
Scott Ullrich
|
|
110 |
5b237745
|
Scott Ullrich
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
111 |
d173230c
|
Seth Mos
|
<tr>
|
112 |
|
|
<td>
|
113 |
|
|
<?php
|
114 |
ba7ec830
|
Scott Ullrich
|
$tab_array = array();
|
115 |
a2927ebf
|
Vinicius Coque
|
$tab_array[0] = array(gettext("Gateways"), false, "system_gateways.php");
|
116 |
|
|
$tab_array[1] = array(gettext("Routes"), true, "system_routes.php");
|
117 |
|
|
$tab_array[2] = array(gettext("Groups"), false, "system_gateway_groups.php");
|
118 |
ba7ec830
|
Scott Ullrich
|
display_top_tabs($tab_array);
|
119 |
d173230c
|
Seth Mos
|
?>
|
120 |
8e830f0f
|
Scott Ullrich
|
</td></tr>
|
121 |
|
|
<tr>
|
122 |
|
|
<td>
|
123 |
|
|
<div id="mainarea">
|
124 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
125 |
5b237745
|
Scott Ullrich
|
<tr>
|
126 |
a2927ebf
|
Vinicius Coque
|
<td width="25%" class="listhdrr"><?=gettext("Network");?></td>
|
127 |
|
|
<td width="20%" class="listhdrr"><?=gettext("Gateway");?></td>
|
128 |
|
|
<td width="15%" class="listhdrr"><?=gettext("Interface");?></td>
|
129 |
|
|
<td width="30%" class="listhdr"><?=gettext("Description");?></td>
|
130 |
d415d821
|
Seth Mos
|
<td width="10%" class="list">
|
131 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
132 |
|
|
<tr>
|
133 |
18f7352b
|
Seth Mos
|
<td width="17"></td>
|
134 |
d415d821
|
Seth Mos
|
<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>
|
135 |
|
|
</tr>
|
136 |
|
|
</table>
|
137 |
|
|
</td>
|
138 |
|
|
</tr>
|
139 |
5b237745
|
Scott Ullrich
|
<tr>
|
140 |
d173230c
|
Seth Mos
|
<?php $i = 0; foreach ($a_routes as $route): ?>
|
141 |
bfe407e5
|
Warren Baker
|
<?php
|
142 |
|
|
if (isset($route['disabled'])) {
|
143 |
|
|
$textss = "<span class=\"gray\">";
|
144 |
|
|
$textse = "</span>";
|
145 |
|
|
} else
|
146 |
|
|
$textss = $textse = "";
|
147 |
|
|
?>
|
148 |
e68492cc
|
Bill Marquette
|
<td class="listlr" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
|
149 |
bfe407e5
|
Warren Baker
|
<?=$textss;?><?=strtolower($route['network']);?><?=$textse;?>
|
150 |
5b237745
|
Scott Ullrich
|
</td>
|
151 |
e68492cc
|
Bill Marquette
|
<td class="listr" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
|
152 |
bfe407e5
|
Warren Baker
|
<?=$textss;?>
|
153 |
d173230c
|
Seth Mos
|
<?php
|
154 |
3a78180e
|
Chris Buechler
|
echo htmlentities($a_gateways[$route['gateway']]['name']) . " - " . htmlentities($a_gateways[$route['gateway']]['gateway']);
|
155 |
d173230c
|
Seth Mos
|
?>
|
156 |
bfe407e5
|
Warren Baker
|
<?=$textse;?>
|
157 |
5b237745
|
Scott Ullrich
|
</td>
|
158 |
e68492cc
|
Bill Marquette
|
<td class="listr" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
|
159 |
bfe407e5
|
Warren Baker
|
<?=$textss;?>
|
160 |
d173230c
|
Seth Mos
|
<?php
|
161 |
a529aced
|
Ermal
|
echo convert_friendly_interface_to_friendly_descr($a_gateways[$route['gateway']]['friendlyiface']) . " ";
|
162 |
d173230c
|
Seth Mos
|
?>
|
163 |
bfe407e5
|
Warren Baker
|
<?=$textse;?>
|
164 |
5b237745
|
Scott Ullrich
|
</td>
|
165 |
e68492cc
|
Bill Marquette
|
<td class="listbg" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
|
166 |
bfe407e5
|
Warren Baker
|
<?=$textss;?><?=htmlspecialchars($route['descr']);?> <?=$textse;?>
|
167 |
5b237745
|
Scott Ullrich
|
</td>
|
168 |
18f7352b
|
Seth Mos
|
<td valign="middle" nowrap class="list">
|
169 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
170 |
|
|
<tr>
|
171 |
|
|
<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>
|
172 |
a2927ebf
|
Vinicius Coque
|
<td><a href="system_routes.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("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>
|
173 |
18f7352b
|
Seth Mos
|
</tr>
|
174 |
|
|
<tr>
|
175 |
|
|
<td width="17"></td>
|
176 |
|
|
<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>
|
177 |
|
|
</tr>
|
178 |
|
|
</table>
|
179 |
d173230c
|
Seth Mos
|
</td>
|
180 |
18f7352b
|
Seth Mos
|
</tr>
|
181 |
5b237745
|
Scott Ullrich
|
<?php $i++; endforeach; ?>
|
182 |
8450bc24
|
Scott Ullrich
|
<tr>
|
183 |
5b237745
|
Scott Ullrich
|
<td class="list" colspan="4"></td>
|
184 |
d415d821
|
Seth Mos
|
<td class="list">
|
185 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
186 |
|
|
<tr>
|
187 |
18f7352b
|
Seth Mos
|
<td width="17"></td>
|
188 |
d415d821
|
Seth Mos
|
<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>
|
189 |
|
|
</tr>
|
190 |
8e830f0f
|
Scott Ullrich
|
</table>
|
191 |
|
|
</td>
|
192 |
|
|
</tr>
|
193 |
d415d821
|
Seth Mos
|
</table>
|
194 |
8e830f0f
|
Scott Ullrich
|
</div>
|
195 |
|
|
</td>
|
196 |
|
|
</tr>
|
197 |
|
|
</table>
|
198 |
5b237745
|
Scott Ullrich
|
</form>
|
199 |
ea53e38f
|
Renato Botelho
|
<p><b><?=gettext("Note:");?></b> <?=gettext("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>
|
200 |
5b237745
|
Scott Ullrich
|
<?php include("fend.inc"); ?>
|
201 |
|
|
</body>
|
202 |
|
|
</html>
|