Project

General

Profile

Download (7.61 KB) Statistics
| Branch: | Tag: | Revision:
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
44
if (!is_array($config['staticroutes']['route']))
45
	$config['staticroutes']['route'] = array();
46
47 d173230c Seth Mos
if (!is_array($config['gateways']['gateway_item']))
48
	$config['gateways']['gateway_item'] = array();
49
50 5b237745 Scott Ullrich
$a_routes = &$config['staticroutes']['route'];
51 d173230c Seth Mos
$a_gateways = &$config['gateways']['gateway_item'];
52 2b87adae Bill Marquette
$changedesc = "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
		$retval = system_routing_configure();
63
		$retval |= filter_configure();
64 13bbe450 Seth Mos
		/* reconfigure our gateway monitor */
65
		setup_gateways_monitor();
66 3851094f Scott Ullrich
67 5b237745 Scott Ullrich
		$savemsg = get_std_save_message($retval);
68 a368a026 Ermal Lu?i
		if ($retval == 0)
69
			clear_subsystem_dirty('staticroutes');
70 2b87adae Bill Marquette
	} else {
71
		if ($_POST['enablefastrouting'] == "") {
72
			/* Only update config if something changed */
73
			if (isset($config['staticroutes']['enablefastrouting'])) {
74
				$changedesc .= " disable fast routing";
75
				unset($config['staticroutes']['enablefastrouting']);
76
				write_config($changedesc);
77
			}
78
		} else {
79
			/* Only update config if something changed */
80
			if (!isset($config['staticroutes']['enablefastrouting'])) {
81
				$changedesc .= " enable fast routing";
82
				$config['staticroutes']['enablefastrouting'] = "enabled";
83
				write_config($changedesc);
84
			}
85
		}
86 5b237745 Scott Ullrich
	}
87
}
88
89
if ($_GET['act'] == "del") {
90
	if ($a_routes[$_GET['id']]) {
91 4fcae58f Scott Ullrich
		$changedesc .= "removed route to " . $a_routes[$_GET['id']['route']];
92 5b237745 Scott Ullrich
		unset($a_routes[$_GET['id']]);
93 59d922dc Bill Marquette
		write_config($changedesc);
94 a368a026 Ermal Lu?i
		mark_subsystem_dirty('staticroutes');
95 5b237745 Scott Ullrich
		header("Location: system_routes.php");
96
		exit;
97
	}
98
}
99 7f43ca88 Scott Ullrich
100 d88c6a9f Scott Ullrich
$pgtitle = array("System","Static Routes");
101 7f43ca88 Scott Ullrich
include("head.inc");
102
103 5b237745 Scott Ullrich
?>
104
105
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
106
<?php include("fbegin.inc"); ?>
107
<form action="system_routes.php" method="post">
108 691dade5 Scott Ullrich
<input type="hidden" name="y1" value="1">
109 5b237745 Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
110 a368a026 Ermal Lu?i
<?php if (is_subsystem_dirty('staticroutes')): ?><p>
111 5b237745 Scott Ullrich
<?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>
112
<?php endif; ?>
113 0f282d7a Scott Ullrich
114 5de92d20 Scott Ullrich
	     <?php if($config['system']['disablefilter'] <> "") :?>
115
	       <table width="100%" border="0" cellpadding="0" cellspacing="0">
116
117 691dade5 Scott Ullrich
		<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>
118 5de92d20 Scott Ullrich
119 0f282d7a Scott Ullrich
		<tr><td colspan=2><hr><input type="submit" value="Save"></td></tr>
120 5de92d20 Scott Ullrich
	       </table><br>
121 0831bc86 Scott Ullrich
	     <?php endif; ?>
122 0f282d7a Scott Ullrich
123 5b237745 Scott Ullrich
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
124 d173230c Seth Mos
		<tr>
125
		  <td>
126
<?php
127 ba7ec830 Scott Ullrich
		$tab_array = array();
128
		$tab_array[0] = array("Gateways", false, "system_gateways.php");
129 c67a0d18 Seth Mos
		$tab_array[1] = array("Routes", true, "system_routes.php");
130 b059ef72 Seth Mos
		$tab_array[2] = array("Groups", false, "system_gateway_groups.php");
131 db7b006f Seth Mos
		$tab_array[3] = array("Settings", false, "system_gateways_settings.php");
132 ba7ec830 Scott Ullrich
		display_top_tabs($tab_array);
133 d173230c Seth Mos
?>
134 8e830f0f Scott Ullrich
</td></tr>
135
 <tr>
136
   <td>
137
	<div id="mainarea">
138
             <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
139 5b237745 Scott Ullrich
                <tr>
140
                  <td width="25%" class="listhdrr">Network</td>
141
                  <td width="20%" class="listhdrr">Gateway</td>
142 d173230c Seth Mos
                  <td width="15%" class="listhdrr">Interface</td>
143 5b237745 Scott Ullrich
                  <td width="30%" class="listhdr">Description</td>
144 d415d821 Seth Mos
                  <td width="10%" class="list">
145
			<table border="0" cellspacing="0" cellpadding="1">
146
			   <tr>
147 18f7352b Seth Mos
				<td width="17"></td>
148 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>
149
			   </tr>
150
			</table>
151
		  </td>
152
		</tr>
153 5b237745 Scott Ullrich
                <tr>
154 d173230c Seth Mos
			<?php $i = 0; foreach ($a_routes as $route): ?>
155 e68492cc Bill Marquette
                  <td class="listlr" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
156 d173230c Seth Mos
                    <?=strtolower($route['network']);?>
157 5b237745 Scott Ullrich
                  </td>
158 e68492cc Bill Marquette
                  <td class="listr" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
159 d173230c Seth Mos
			<?php
160
				echo $route['gateway'] . " ";
161
			?>
162 5b237745 Scott Ullrich
                  </td>
163 e68492cc Bill Marquette
                  <td class="listr" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
164 d173230c Seth Mos
			<?php
165
				foreach($a_gateways as $gateway) {
166
					if($gateway['name'] == $route['gateway']) {
167
						echo strtoupper($gateway['interface']) . " ";
168 fef3a8ef Scott Ullrich
					}
169 d173230c Seth Mos
				}
170
171
			?>
172 5b237745 Scott Ullrich
                  </td>
173 e68492cc Bill Marquette
                  <td class="listbg" ondblclick="document.location='system_routes_edit.php?id=<?=$i;?>';">
174 33300c73 Scott Ullrich
                    <?=htmlspecialchars($route['descr']);?>&nbsp;
175 5b237745 Scott Ullrich
                  </td>
176 18f7352b Seth Mos
                  <td valign="middle" nowrap class="list">
177
			<table border="0" cellspacing="0" cellpadding="1">
178
			   <tr>
179
				<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>
180
				<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>
181
			   </tr>
182
			   <tr>
183
				<td width="17"></td>
184
				<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>
185
			   </tr>
186
			</table>
187 d173230c Seth Mos
		  </td>
188 18f7352b Seth Mos
		</tr>
189 5b237745 Scott Ullrich
			  <?php $i++; endforeach; ?>
190 8450bc24 Scott Ullrich
                <tr>
191 5b237745 Scott Ullrich
                  <td class="list" colspan="4"></td>
192 d415d821 Seth Mos
                  <td class="list">
193
			<table border="0" cellspacing="0" cellpadding="1">
194
			   <tr>
195 18f7352b Seth Mos
				<td width="17"></td>
196 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>
197
			   </tr>
198 8e830f0f Scott Ullrich
		                    </table>
199
				  </td>
200
		                </tr>
201 d415d821 Seth Mos
			</table>
202 8e830f0f Scott Ullrich
			</div>
203
			</td>
204
		  </tr>
205
		</table>
206 5b237745 Scott Ullrich
            </form>
207 f3bfeeea Scott Ullrich
			<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>
208 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
209
</body>
210
</html>