1 |
259f606e
|
Pierre POMES
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
|
|
load_balancer_setting.php
|
5 |
|
|
part of pfSense (http://www.pfsense.com/)
|
6 |
|
|
|
7 |
|
|
Copyright (C) 2008 Bill Marquette <bill.marquette@gmail.com>.
|
8 |
|
|
Copyright (C) 2012 Pierre POMES <pierre.pomes@gmail.com>.
|
9 |
|
|
All rights reserved.
|
10 |
|
|
|
11 |
|
|
Redistribution and use in source and binary forms, with or without
|
12 |
|
|
modification, are permitted provided that the following conditions are met:
|
13 |
|
|
|
14 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
this list of conditions and the following disclaimer.
|
16 |
|
|
|
17 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
notice, this list of conditions and the following disclaimer in the
|
19 |
|
|
documentation and/or other materials provided with the distribution.
|
20 |
|
|
|
21 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
25 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
31 |
|
|
*/
|
32 |
|
|
/*
|
33 |
|
|
pfSense_MODULE: routing
|
34 |
|
|
*/
|
35 |
|
|
|
36 |
|
|
##|+PRIV
|
37 |
|
|
##|*IDENT=page-services-loadbalancer-setting
|
38 |
|
|
##|*NAME=Services: Load Balancer: setting page
|
39 |
|
|
##|*DESCR=Allow access to the 'Settings: Load Balancer: Settings' page.
|
40 |
|
|
##|*MATCH=load_balancer_setting.php*
|
41 |
|
|
##|-PRIV
|
42 |
|
|
|
43 |
|
|
require_once("guiconfig.inc");
|
44 |
|
|
require_once("functions.inc");
|
45 |
|
|
require_once("filter.inc");
|
46 |
|
|
require_once("shaper.inc");
|
47 |
|
|
require_once("util.inc");
|
48 |
|
|
|
49 |
|
|
if (!is_array($config['load_balancer']['setting'])) {
|
50 |
|
|
$config['load_balancer']['setting'] = array();
|
51 |
|
|
}
|
52 |
|
|
$lbsetting = &$config['load_balancer']['setting'];
|
53 |
|
|
|
54 |
|
|
if ($_POST) {
|
55 |
|
|
|
56 |
|
|
if ($_POST['apply']) {
|
57 |
|
|
$retval = 0;
|
58 |
|
|
$retval |= filter_configure();
|
59 |
|
|
$retval |= relayd_configure();
|
60 |
|
|
|
61 |
|
|
$savemsg = get_std_save_message($retval);
|
62 |
|
|
clear_subsystem_dirty('loadbalancer');
|
63 |
|
|
} else {
|
64 |
206aa9fc
|
Pierre POMES
|
unset($input_errors);
|
65 |
259f606e
|
Pierre POMES
|
$pconfig = $_POST;
|
66 |
206aa9fc
|
Pierre POMES
|
|
67 |
|
|
/* input validation */
|
68 |
|
|
if ($_POST['timeout'] && !is_numeric($_POST['timeout'])) {
|
69 |
|
|
$input_errors[] = gettext("Timeout must be a numeric value");
|
70 |
|
|
}
|
71 |
259f606e
|
Pierre POMES
|
|
72 |
206aa9fc
|
Pierre POMES
|
if ($_POST['interval'] && !is_numeric($_POST['interval'])) {
|
73 |
|
|
$input_errors[] = gettext("Interval must be a numeric value");
|
74 |
|
|
}
|
75 |
259f606e
|
Pierre POMES
|
|
76 |
206aa9fc
|
Pierre POMES
|
/* update config if user entry is valid */
|
77 |
|
|
if (!$input_errors) {
|
78 |
|
|
$lbsetting['timeout'] = $_POST['timeout'];
|
79 |
|
|
$lbsetting['interval'] = $_POST['interval'];
|
80 |
|
|
|
81 |
|
|
write_config();
|
82 |
|
|
mark_subsystem_dirty('loadbalancer');
|
83 |
|
|
}
|
84 |
259f606e
|
Pierre POMES
|
}
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Settings"));
|
88 |
|
|
$statusurl = "status_lb_pool.php";
|
89 |
|
|
$logurl = "diag_logs_relayd.php";
|
90 |
|
|
|
91 |
|
|
include("head.inc");
|
92 |
|
|
|
93 |
|
|
?>
|
94 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
95 |
|
|
<?php include("fbegin.inc"); ?>
|
96 |
|
|
<form action="load_balancer_setting.php" method="post">
|
97 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
98 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
99 |
|
|
<?php if (is_subsystem_dirty('loadbalancer')): ?><p>
|
100 |
|
|
<?php print_info_box_np(gettext("The load balancer configuration has been changed") . ".<br>" . gettext("You must apply the changes in order for them to take effect."));?><br>
|
101 |
|
|
<?php endif; ?>
|
102 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
103 |
|
|
<tr>
|
104 |
|
|
<td class="tabnavtbl">
|
105 |
|
|
<?php
|
106 |
|
|
/* active tabs */
|
107 |
|
|
$tab_array = array();
|
108 |
|
|
$tab_array[] = array(gettext("Pools"), false, "load_balancer_pool.php");
|
109 |
|
|
$tab_array[] = array(gettext("Virtual Servers"), false, "load_balancer_virtual_server.php");
|
110 |
|
|
$tab_array[] = array(gettext("Monitors"), false, "load_balancer_monitor.php");
|
111 |
|
|
$tab_array[] = array(gettext("Settings"), true, "load_balancer_setting.php");
|
112 |
|
|
display_top_tabs($tab_array);
|
113 |
|
|
?>
|
114 |
|
|
</td>
|
115 |
|
|
</tr>
|
116 |
|
|
<tr>
|
117 |
|
|
<td id="mainarea">
|
118 |
|
|
<div class="tabcont">
|
119 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
120 |
|
|
<tr>
|
121 |
|
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Relayd global settings"); ?></td>
|
122 |
|
|
</tr>
|
123 |
|
|
<tr>
|
124 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Pool member timeout") ; ?></td>
|
125 |
|
|
<td width="78%" class="vtable">
|
126 |
|
|
<input name="timeout" id="timeout" value="<?php if ($lbsetting['timeout'] <> "") echo $lbsetting['timeout']; ?>" class="formfld unknown">
|
127 |
|
|
<br />
|
128 |
|
|
<?=gettext("Set the global timeout in milliseconds for checks. Leave blank to use the default value of 1000 ms "); ?>
|
129 |
|
|
</td>
|
130 |
|
|
</tr>
|
131 |
|
|
<tr>
|
132 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Pool member check interval") ; ?></td>
|
133 |
|
|
<td width="78%" class="vtable">
|
134 |
|
|
<input name="interval" id="interval" value="<?php if ($lbsetting['interval'] <> "") echo $lbsetting['interval']; ?>" class="formfld unknown">
|
135 |
|
|
<br />
|
136 |
|
|
<?=gettext("Set the interval in seconds at which the member of a pool will be checked. Leave blank to use the default interval of 10 seconds"); ?>
|
137 |
|
|
</td>
|
138 |
|
|
</tr>
|
139 |
|
|
<tr>
|
140 |
|
|
<td width="22%" valign="top"> </td>
|
141 |
|
|
<td width="78%">
|
142 |
|
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
143 |
|
|
</td>
|
144 |
|
|
</tr>
|
145 |
|
|
</table>
|
146 |
|
|
</div>
|
147 |
|
|
</tr>
|
148 |
|
|
</table>
|
149 |
|
|
</form>
|
150 |
|
|
<?php include("fend.inc"); ?>
|
151 |
|
|
</body>
|
152 |
|
|
</html>
|