1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
load_balancer_setting.php
|
5
|
part of pfSense (https://www.pfsense.org/)
|
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
|
unset($input_errors);
|
65
|
$pconfig = $_POST;
|
66
|
|
67
|
/* input validation */
|
68
|
if ($_POST['timeout'] && !is_numeric($_POST['timeout'])) {
|
69
|
$input_errors[] = gettext("Timeout must be a numeric value");
|
70
|
}
|
71
|
|
72
|
if ($_POST['interval'] && !is_numeric($_POST['interval'])) {
|
73
|
$input_errors[] = gettext("Interval must be a numeric value");
|
74
|
}
|
75
|
|
76
|
if ($_POST['prefork']) {
|
77
|
if (!is_numeric($_POST['prefork'])) {
|
78
|
$input_errors[] = gettext("Prefork must be a numeric value");
|
79
|
} else {
|
80
|
if (($_POST['prefork']<=0) || ($_POST['prefork']>32)) {
|
81
|
$input_errors[] = gettext("Prefork value must be between 1 and 32");
|
82
|
}
|
83
|
}
|
84
|
}
|
85
|
|
86
|
/* update config if user entry is valid */
|
87
|
if (!$input_errors) {
|
88
|
$lbsetting['timeout'] = $_POST['timeout'];
|
89
|
$lbsetting['interval'] = $_POST['interval'];
|
90
|
$lbsetting['prefork'] = $_POST['prefork'];
|
91
|
|
92
|
write_config();
|
93
|
mark_subsystem_dirty('loadbalancer');
|
94
|
}
|
95
|
}
|
96
|
}
|
97
|
|
98
|
$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Settings"));
|
99
|
$shortcut_section = "relayd";
|
100
|
|
101
|
include("head.inc");
|
102
|
|
103
|
?>
|
104
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
105
|
<?php include("fbegin.inc"); ?>
|
106
|
<form action="load_balancer_setting.php" method="post">
|
107
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
108
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
109
|
<?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
|
110
|
<?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 />
|
111
|
<?php endif; ?>
|
112
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="load balancer settings">
|
113
|
<tr>
|
114
|
<td class="tabnavtbl">
|
115
|
<?php
|
116
|
/* active tabs */
|
117
|
$tab_array = array();
|
118
|
$tab_array[] = array(gettext("Pools"), false, "load_balancer_pool.php");
|
119
|
$tab_array[] = array(gettext("Virtual Servers"), false, "load_balancer_virtual_server.php");
|
120
|
$tab_array[] = array(gettext("Monitors"), false, "load_balancer_monitor.php");
|
121
|
$tab_array[] = array(gettext("Settings"), true, "load_balancer_setting.php");
|
122
|
display_top_tabs($tab_array);
|
123
|
?>
|
124
|
</td>
|
125
|
</tr>
|
126
|
<tr>
|
127
|
<td id="mainarea">
|
128
|
<div class="tabcont">
|
129
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
|
130
|
<tr>
|
131
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Relayd global settings"); ?></td>
|
132
|
</tr>
|
133
|
<tr>
|
134
|
<td width="22%" valign="top" class="vncell"><?=gettext("timeout") ; ?></td>
|
135
|
<td width="78%" class="vtable">
|
136
|
<input name="timeout" id="timeout" value="<?php if ($lbsetting['timeout'] <> "") echo $lbsetting['timeout']; ?>" class="formfld unknown" />
|
137
|
<br />
|
138
|
<?=gettext("Set the global timeout in milliseconds for checks. Leave blank to use the default value of 1000 ms "); ?>
|
139
|
</td>
|
140
|
</tr>
|
141
|
<tr>
|
142
|
<td width="22%" valign="top" class="vncell"><?=gettext("interval") ; ?></td>
|
143
|
<td width="78%" class="vtable">
|
144
|
<input name="interval" id="interval" value="<?php if ($lbsetting['interval'] <> "") echo $lbsetting['interval']; ?>" class="formfld unknown" />
|
145
|
<br />
|
146
|
<?=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"); ?>
|
147
|
</td>
|
148
|
</tr>
|
149
|
<tr>
|
150
|
<td width="22%" valign="top" class="vncell"><?=gettext("prefork") ; ?></td>
|
151
|
<td width="78%" class="vtable">
|
152
|
<input name="prefork" id="prefork" value="<?php if ($lbsetting['prefork'] <> "") echo $lbsetting['prefork']; ?>" class="formfld unknown" />
|
153
|
<br />
|
154
|
<?=gettext("Number of processes used by relayd for dns protocol. Leave blank to use the default value of 5 processes"); ?>
|
155
|
</td>
|
156
|
</tr>
|
157
|
<tr>
|
158
|
<td width="22%" valign="top"> </td>
|
159
|
<td width="78%">
|
160
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
161
|
</td>
|
162
|
</tr>
|
163
|
</table>
|
164
|
</div>
|
165
|
</td>
|
166
|
</tr>
|
167
|
</table>
|
168
|
</form>
|
169
|
<?php include("fend.inc"); ?>
|
170
|
</body>
|
171
|
</html>
|