Project

General

Profile

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