Project

General

Profile

Download (7.33 KB) Statistics
| Branch: | Tag: | Revision:
1 2f35382a Seth Mos
<?php
2
/* $Id$ */
3
/*
4
	system_gateway_groups.php
5
	part of pfSense (http://pfsense.com)
6
7 6216690b smos
	Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
8 2f35382a 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 2f35382a Seth Mos
35 6b07c15a Matthew Grooms
##|+PRIV
36
##|*IDENT=page-system-gatewaygroups
37
##|*NAME=System: Gateway Groups page
38
##|*DESCR=Allow access to the 'System: Gateway Groups' page.
39
##|*MATCH=system_gateway_groups.php*
40
##|-PRIV
41
42 2f35382a Seth Mos
require("guiconfig.inc");
43 7a927e67 Scott Ullrich
require_once("functions.inc");
44
require_once("filter.inc");
45
require_once("shaper.inc");
46 2f35382a Seth Mos
47
if (!is_array($config['gateways']['gateway_group']))
48
	$config['gateways']['gateway_group'] = array();
49
50
$a_gateway_groups = &$config['gateways']['gateway_group'];
51 5ccd9857 Seth Mos
$a_gateways = &$config['gateways']['gateway_item'];
52 198afa09 Vinicius Coque
$changedesc = gettext("Gateway Groups") . ": ";
53 2f35382a Seth Mos
54
if ($_POST) {
55
56
	$pconfig = $_POST;
57
58
	if ($_POST['apply']) {
59
60
		$retval = 0;
61
62
		$retval = system_routing_configure();
63 98aea4c3 Ermal
		send_multiple_events(array("service reload dyndnsall", "service reload ipsecdns", "filter reload"));
64
65 33d72c67 Ermal
		/* reconfigure our gateway monitor */
66
		setup_gateways_monitor();
67 2f35382a Seth Mos
68
		$savemsg = get_std_save_message($retval);
69 a368a026 Ermal Lu?i
		if ($retval == 0)
70
			clear_subsystem_dirty('staticroutes');
71 2f35382a Seth Mos
	}
72
}
73
74
if ($_GET['act'] == "del") {
75
	if ($a_gateway_groups[$_GET['id']]) {
76 198afa09 Vinicius Coque
		$changedesc .= gettext("removed gateway group") . " {$_GET['id']}";
77 f78302e8 Ermal
		foreach ($config['filter']['rule'] as $idx => $rule) {
78
			if ($rule['gateway'] == $a_gateway_groups[$_GET['id']]['name'])
79
				unset($config['filter']['rule'][$idx]['gateway']);
80
		}
81 2f35382a Seth Mos
		unset($a_gateway_groups[$_GET['id']]);
82
		write_config($changedesc);
83 a368a026 Ermal Lu?i
		mark_subsystem_dirty('staticroutes');
84 2f35382a Seth Mos
		header("Location: system_gateway_groups.php");
85
		exit;
86
	}
87
}
88
89 198afa09 Vinicius Coque
$pgtitle = array(gettext("System"),gettext("Gateway Groups"));
90 b32dd0a6 jim-p
$shortcut_section = "gateway-groups";
91 02ca24c9 jim-p
92 2f35382a Seth Mos
include("head.inc");
93
94
?>
95
96
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
97
<?php include("fbegin.inc"); ?>
98 5ccd9857 Seth Mos
<form action="system_gateway_groups.php" method="post">
99 2f35382a Seth Mos
<input type="hidden" name="y1" value="1">
100
<?php if ($savemsg) print_info_box($savemsg); ?>
101 a368a026 Ermal Lu?i
<?php if (is_subsystem_dirty('staticroutes')): ?><p>
102 0e94685b Renato Botelho
<?php print_info_box_np(sprintf(gettext("The gateway configuration has been changed.%sYou must apply the changes in order for them to take effect."), "<br>"));?><br>
103 2f35382a Seth Mos
<?php endif; ?>
104
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
105
		<tr>
106
		  <td>
107
<?php
108
			$tab_array = array();
109 198afa09 Vinicius Coque
			$tab_array[0] = array(gettext("Gateways"), false, "system_gateways.php");
110
			$tab_array[1] = array(gettext("Routes"), false, "system_routes.php");
111
			$tab_array[2] = array(gettext("Groups"), true, "system_gateway_groups.php");
112 2f35382a Seth Mos
			display_top_tabs($tab_array);
113
?>
114
</td></tr>
115
 <tr>
116
   <td>
117
	<div id="mainarea">
118
             <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
119 313827fd jim-p
		<thead>
120 2f35382a Seth Mos
                <tr>
121 198afa09 Vinicius Coque
                  <td width="15%" class="listhdrr"><?=gettext("Group Name");?></td>
122
                  <td width="15%" class="listhdrr"><?=gettext("Gateways");?></td>
123
                  <td width="20%" class="listhdrr"><?=gettext("Priority");?></td>
124
                  <td width="30%" class="listhdr"><?=gettext("Description");?></td>
125 2f35382a Seth Mos
                  <td width="10%" class="list">
126
			<table border="0" cellspacing="0" cellpadding="1">
127
			   <tr>
128
				<td width="17"></td>
129
				<td><a href="system_gateway_groups_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
130
			   </tr>
131
			</table>
132
		  </td>
133
		</tr>
134 313827fd jim-p
		</thead>
135
		<tbody>
136 2f35382a Seth Mos
			  <?php $i = 0; foreach ($a_gateway_groups as $gateway_group): ?>
137
                <tr>
138
                  <td class="listlr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
139
                    <?php
140
			echo $gateway_group['name'];
141 8af8524e Ermal
		?>
142 2f35382a Seth Mos
                  </td>
143
                  <td class="listr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
144
                    <?php
145 5ccd9857 Seth Mos
			foreach($gateway_group['item'] as $item) {
146
				$itemsplit = explode("|", $item);
147 adc79e41 Scott Ullrich
				echo htmlspecialchars(strtoupper($itemsplit[0])) . "<br/>\n";
148 5ccd9857 Seth Mos
			}
149
		    ?>
150 2f35382a Seth Mos
                  </td>
151
                  <td class="listr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
152
		    <?php
153 5ccd9857 Seth Mos
			foreach($gateway_group['item'] as $item) {
154
				$itemsplit = explode("|", $item);
155
				echo "Tier ". htmlspecialchars($itemsplit[1]) . "<br/>\n";
156
			}
157
		    ?>
158 2f35382a Seth Mos
                  </td>
159
                  <td class="listbg" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
160 8af8524e Ermal
				<?=htmlspecialchars($gateway_group['descr']);?>&nbsp;
161 2f35382a Seth Mos
                  </td>
162
                  <td valign="middle" nowrap class="list">
163
			<table border="0" cellspacing="0" cellpadding="1">
164
			   <tr>
165
				<td><a href="system_gateway_groups_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
166 198afa09 Vinicius Coque
				<td><a href="system_gateway_groups.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this gateway group?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
167 2f35382a Seth Mos
			   </tr>
168
			   <tr>
169
				<td width="17"></td>
170
				<td><a href="system_gateway_groups_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
171
			   </tr>
172
			</table>
173
174
		</tr>
175
			  <?php $i++; endforeach; ?>
176
                <tr>
177 313827fd jim-p
		</tbody>
178
		<tfoot>
179 2f35382a Seth Mos
                  <td class="list" colspan="4"></td>
180
                  <td class="list">
181
			<table border="0" cellspacing="0" cellpadding="1">
182
			   <tr>
183
				<td width="17"></td>
184
				<td><a href="system_gateway_groups_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
185
			   </tr>
186
		                    </table>
187
				  </td>
188
		                </tr>
189
			</table>
190
			</div>
191
			</td>
192
		  </tr>
193 313827fd jim-p
		</tfoot>
194 2f35382a Seth Mos
		</table>
195
            </form>
196 313827fd jim-p
	<p><b><?=gettext("Note:");?></b>  <?=gettext("Remember to use these Gateway Groups in firewall rules in order to enable load balancing, failover, or policy-based routing. Without rules directing traffic into the Gateway Groups, they will not be used.");?></p>
197 2f35382a Seth Mos
<?php include("fend.inc"); ?>
198
</body>
199
</html>