Project

General

Profile

Download (6.68 KB) Statistics
| Branch: | Tag: | Revision:
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
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
10

    
11
	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
		unset($input_errors);
67
		$pconfig = $_POST;
68
	
69
		/* input validation */
70
		if ($_POST['timeout'] && !is_numeric($_POST['timeout'])) {
71
			$input_errors[] = gettext("Timeout must be a numeric value");
72
		}
73

    
74
                if ($_POST['interval'] && !is_numeric($_POST['interval'])) {
75
			$input_errors[] = gettext("Interval must be a numeric value");
76
                }
77

    
78
		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
		/* update config if user entry is valid */
89
		if (!$input_errors) {
90
			$lbsetting['timeout'] = $_POST['timeout'];
91
			$lbsetting['interval'] = $_POST['interval'];
92
			$lbsetting['prefork'] = $_POST['prefork'];
93

    
94
        		write_config();
95
        		mark_subsystem_dirty('loadbalancer');
96
		}
97
	}
98
}
99

    
100
$pgtitle = array(gettext("Services"),gettext("Load Balancer"),gettext("Settings"));
101
$shortcut_section = "relayd";
102

    
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
<?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
112
<?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
<?php endif; ?>
114
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="load balancer settings">
115
   <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
            <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
132
              <tr>
133
                 <td colspan="2" valign="top" class="listtopic"><?=gettext("Relayd global settings"); ?></td>
134
              </tr>
135
	      <tr>
136
	         <td width="22%" valign="top" class="vncell"><?=gettext("timeout") ; ?></td>
137
                 <td width="78%" class="vtable">
138
                   <input name="timeout" id="timeout" value="<?php if ($lbsetting['timeout'] <> "") echo $lbsetting['timeout']; ?>" class="formfld unknown" />
139
                   <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
	         <td width="22%" valign="top" class="vncell"><?=gettext("interval") ; ?></td>
145
                 <td width="78%" class="vtable">
146
                   <input name="interval" id="interval" value="<?php if ($lbsetting['interval'] <> "") echo $lbsetting['interval']; ?>" class="formfld unknown" />
147
                   <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
             </tr>
151
              <tr>
152
                 <td width="22%" valign="top" class="vncell"><?=gettext("prefork") ; ?></td>
153
                 <td width="78%" class="vtable">
154
                   <input name="prefork" id="prefork" value="<?php if ($lbsetting['prefork'] <> "") echo $lbsetting['prefork']; ?>" class="formfld unknown" />
155
                   <br />
156
                   <?=gettext("Number of processes used by relayd for dns protocol. Leave blank to use the default value of 5 processes"); ?>
157
                </td>
158
             </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
      </td>
168
  </tr>
169
</table>
170
</form>
171
<?php include("fend.inc"); ?>
172
</body>
173
</html>
(122-122/252)