1 |
94ac0ffc
|
Bill Marquette
|
<?php
|
2 |
577c9191
|
Bill Marquette
|
/* $Id$ */
|
3 |
94ac0ffc
|
Bill Marquette
|
/*
|
4 |
|
|
load_balancer_pool.php
|
5 |
|
|
part of pfSense (http://www.pfsense.com/)
|
6 |
|
|
|
7 |
|
|
Copyright (C) 2005 Bill Marquette <bill.marquette@gmail.com>.
|
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 |
|
|
require("guiconfig.inc");
|
33 |
|
|
|
34 |
a9c6f68a
|
Bill Marquette
|
if (!is_array($config['load_balancer']['lbpool'])) {
|
35 |
|
|
$config['load_balancer']['lbpool'] = array();
|
36 |
94ac0ffc
|
Bill Marquette
|
}
|
37 |
a9c6f68a
|
Bill Marquette
|
$a_pool = &$config['load_balancer']['lbpool'];
|
38 |
94ac0ffc
|
Bill Marquette
|
|
39 |
|
|
if ($_POST) {
|
40 |
|
|
$pconfig = $_POST;
|
41 |
|
|
|
42 |
|
|
if ($_POST['apply']) {
|
43 |
|
|
$retval = 0;
|
44 |
920b3bb0
|
Scott Ullrich
|
|
45 |
|
|
config_lock();
|
46 |
|
|
$retval |= filter_configure();
|
47 |
|
|
$retval |= slbd_configure();
|
48 |
|
|
config_unlock();
|
49 |
|
|
|
50 |
94ac0ffc
|
Bill Marquette
|
$savemsg = get_std_save_message($retval);
|
51 |
|
|
//unlink_if_exists($d_poolconfdirty_path);
|
52 |
|
|
}
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
if ($_GET['act'] == "del") {
|
56 |
|
|
if ($a_pool[$_GET['id']]) {
|
57 |
|
|
/* make sure no virtual servers reference this entry */
|
58 |
|
|
if (is_array($config['load_balancer']['virtual_server'])) {
|
59 |
|
|
foreach ($config['load_balancer']['virtual_server'] as $vs) {
|
60 |
|
|
if ($vs['pool'] == $a_pool[$_GET['id']]['name']) {
|
61 |
|
|
$input_errors[] = "This entry cannot be deleted because it is still referenced by at least one virtual server.";
|
62 |
|
|
break;
|
63 |
|
|
}
|
64 |
|
|
}
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
if (!$input_errors) {
|
68 |
|
|
unset($a_pool[$_GET['id']]);
|
69 |
|
|
write_config();
|
70 |
|
|
touch($d_poolconfdirty_path);
|
71 |
|
|
header("Location: load_balancer_pool.php");
|
72 |
|
|
exit;
|
73 |
|
|
}
|
74 |
|
|
}
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
$pgtitle = "Load Balancer: Pool";
|
78 |
|
|
include("head.inc");
|
79 |
|
|
|
80 |
|
|
?>
|
81 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
82 |
|
|
<?php include("fbegin.inc"); ?>
|
83 |
|
|
<p class="pgtitle"><?=$pgtitle?></p>
|
84 |
|
|
<form action="load_balancer_pool.php" method="post">
|
85 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
86 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
87 |
|
|
<?php if (file_exists($d_vipconfdirty_path)): ?><p>
|
88 |
|
|
<?php print_info_box_np("The load balancer configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
|
89 |
|
|
<?php endif; ?>
|
90 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
91 |
|
|
<tr><td class="tabnavtbl">
|
92 |
|
|
<?php
|
93 |
|
|
/* active tabs */
|
94 |
|
|
$tab_array = array();
|
95 |
|
|
$tab_array[] = array("Pools", true, "load_balancer_pool.php");
|
96 |
|
|
$tab_array[] = array("Virtual Servers", false, "load_balancer_virtual_server.php");
|
97 |
|
|
display_top_tabs($tab_array);
|
98 |
|
|
?>
|
99 |
|
|
</td></tr>
|
100 |
|
|
<tr>
|
101 |
|
|
<td>
|
102 |
|
|
<div id="mainarea">
|
103 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
104 |
|
|
<tr>
|
105 |
|
|
<td width="10%" class="listhdrr">Name</td>
|
106 |
7ede6f64
|
Scott Ullrich
|
<td width="25%" class="listhdrr">Servers/Gateways</td>
|
107 |
94ac0ffc
|
Bill Marquette
|
<td width="10%" class="listhdrr">Port</td>
|
108 |
|
|
<td width="15%" class="listhdrr">Monitor</td>
|
109 |
|
|
<td width="30%" class="listhdr">Description</td>
|
110 |
|
|
<td width="10%" class="list"></td>
|
111 |
|
|
</tr>
|
112 |
|
|
<?php $i = 0; foreach ($a_pool as $vipent): ?>
|
113 |
|
|
<tr>
|
114 |
|
|
<td class="listlr" ondblclick="document.location='load_balancer_pool_edit.php?id=<?=$i;?>';">
|
115 |
|
|
<?=$vipent['name'];?>
|
116 |
|
|
</td>
|
117 |
|
|
<td class="listlr" align="center" ondblclick="document.location='load_balancer_pool_edit.php?id=<?=$i;?>';">
|
118 |
|
|
<?php foreach ($vipent['servers'] as $server): ?>
|
119 |
|
|
<?=$server;?><br>
|
120 |
|
|
<?php endforeach; ?>
|
121 |
|
|
</td>
|
122 |
|
|
<td class="listlr" ondblclick="document.location='load_balancer_pool_edit.php?id=<?=$i;?>';">
|
123 |
|
|
<?=$vipent['port'];?>
|
124 |
|
|
</td>
|
125 |
|
|
<td class="listlr" ondblclick="document.location='load_balancer_pool_edit.php?id=<?=$i;?>';">
|
126 |
|
|
<?=$vipent['monitor'];?>
|
127 |
|
|
</td>
|
128 |
|
|
<td class="listbg" ondblclick="document.location='load_balancer_pool_edit.php?id=<?=$i;?>';">
|
129 |
d90212f3
|
Bill Marquette
|
<font color="#FFFFFF"><?=$vipent['desc'];?></font>
|
130 |
94ac0ffc
|
Bill Marquette
|
</td>
|
131 |
|
|
<td class="list" nowrap>
|
132 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
133 |
|
|
<tr>
|
134 |
|
|
<td valign="middle"><a href="load_balancer_pool_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
|
135 |
|
|
<td valign="middle"><a href="load_balancer_pool.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this entry?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
|
136 |
|
|
</tr>
|
137 |
|
|
</table>
|
138 |
|
|
</td>
|
139 |
|
|
</tr>
|
140 |
|
|
<?php $i++; endforeach; ?>
|
141 |
|
|
<tr>
|
142 |
|
|
<td class="list" colspan="5"></td>
|
143 |
|
|
<td class="list">
|
144 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
145 |
|
|
<tr>
|
146 |
|
|
<td valign="middle"><a href="load_balancer_pool_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
147 |
|
|
</tr>
|
148 |
|
|
</table>
|
149 |
|
|
</td>
|
150 |
|
|
</tr>
|
151 |
|
|
</table>
|
152 |
|
|
</div>
|
153 |
|
|
</table>
|
154 |
|
|
</form>
|
155 |
|
|
<?php include("fend.inc"); ?>
|
156 |
|
|
</body>
|
157 |
|
|
</html>
|