Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
4497a242
Commit
4497a242
authored
May 20, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
system: split lb and pf sticky connection setting; closes #691
parent
003f6f93
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
18 deletions
+33
-18
vslb.inc
src/etc/inc/vslb.inc
+1
-1
load_balancer_setting.php
src/www/load_balancer_setting.php
+27
-3
system_advanced_firewall.php
src/www/system_advanced_firewall.php
+5
-14
No files found.
src/etc/inc/vslb.inc
View file @
4497a242
...
@@ -220,7 +220,7 @@ function relayd_configure($kill_first = false)
...
@@ -220,7 +220,7 @@ function relayd_configure($kill_first = false)
$conf
.=
" listen on
{
$ip
}
port
{
$src_port
}
\n
"
;
$conf
.=
" listen on
{
$ip
}
port
{
$src_port
}
\n
"
;
$conf
.=
" forward to <
{
$vs_a
[
$i
][
'poolname'
]
}
> port
{
$dest_port
}
{
$check_a
[
$pools
[
$vs_a
[
$i
][
'poolname'
]][
'monitor'
]]
}
\n
"
;
$conf
.=
" forward to <
{
$vs_a
[
$i
][
'poolname'
]
}
> port
{
$dest_port
}
{
$check_a
[
$pools
[
$vs_a
[
$i
][
'poolname'
]][
'monitor'
]]
}
\n
"
;
if
(
isset
(
$config
[
'
system
'
][
'lb_use_sticky'
]))
{
if
(
isset
(
$config
[
'
load_balancer'
][
'setting
'
][
'lb_use_sticky'
]))
{
$conf
.=
" sticky-address
\n
"
;
$conf
.=
" sticky-address
\n
"
;
}
}
...
...
src/www/load_balancer_setting.php
View file @
4497a242
...
@@ -48,6 +48,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
...
@@ -48,6 +48,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig
[
'timeout'
]
=
!
empty
(
$config
[
'load_balancer'
][
'setting'
][
'timeout'
])
?
$config
[
'load_balancer'
][
'setting'
][
'timeout'
]
:
null
;
$pconfig
[
'timeout'
]
=
!
empty
(
$config
[
'load_balancer'
][
'setting'
][
'timeout'
])
?
$config
[
'load_balancer'
][
'setting'
][
'timeout'
]
:
null
;
$pconfig
[
'interval'
]
=
!
empty
(
$config
[
'load_balancer'
][
'setting'
][
'interval'
])
?
$config
[
'load_balancer'
][
'setting'
][
'interval'
]
:
null
;
$pconfig
[
'interval'
]
=
!
empty
(
$config
[
'load_balancer'
][
'setting'
][
'interval'
])
?
$config
[
'load_balancer'
][
'setting'
][
'interval'
]
:
null
;
$pconfig
[
'prefork'
]
=
!
empty
(
$config
[
'load_balancer'
][
'setting'
][
'prefork'
])
?
$config
[
'load_balancer'
][
'setting'
][
'prefork'
]
:
null
;
$pconfig
[
'prefork'
]
=
!
empty
(
$config
[
'load_balancer'
][
'setting'
][
'prefork'
])
?
$config
[
'load_balancer'
][
'setting'
][
'prefork'
]
:
null
;
$pconfig
[
'lb_use_sticky'
]
=
isset
(
$config
[
'load_balancer'
][
'setting'
][
'lb_use_sticky'
]);
}
elseif
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
}
elseif
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
$pconfig
=
$_POST
;
$pconfig
=
$_POST
;
$input_errors
=
array
();
$input_errors
=
array
();
...
@@ -78,6 +79,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
...
@@ -78,6 +79,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$config
[
'load_balancer'
][
'setting'
][
'timeout'
]
=
$pconfig
[
'timeout'
];
$config
[
'load_balancer'
][
'setting'
][
'timeout'
]
=
$pconfig
[
'timeout'
];
$config
[
'load_balancer'
][
'setting'
][
'interval'
]
=
$pconfig
[
'interval'
];
$config
[
'load_balancer'
][
'setting'
][
'interval'
]
=
$pconfig
[
'interval'
];
$config
[
'load_balancer'
][
'setting'
][
'prefork'
]
=
$pconfig
[
'prefork'
];
$config
[
'load_balancer'
][
'setting'
][
'prefork'
]
=
$pconfig
[
'prefork'
];
if
(
!
empty
(
$pconfig
[
'lb_use_sticky'
]))
{
$config
[
'load_balancer'
][
'setting'
][
'lb_use_sticky'
]
=
true
;
}
elseif
(
isset
(
$config
[
'load_balancer'
][
'setting'
][
'lb_use_sticky'
]))
{
unset
(
$config
[
'load_balancer'
][
'setting'
][
'lb_use_sticky'
]);
}
write_config
();
write_config
();
mark_subsystem_dirty
(
'loadbalancer'
);
mark_subsystem_dirty
(
'loadbalancer'
);
header
(
"Location: load_balancer_setting.php"
);
header
(
"Location: load_balancer_setting.php"
);
...
@@ -116,7 +124,7 @@ include("head.inc");
...
@@ -116,7 +124,7 @@ include("head.inc");
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td><a
id=
"help_for_timeout"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"
t
imeout"
)
;
?>
</td>
<td><a
id=
"help_for_timeout"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"
T
imeout"
)
;
?>
</td>
<td>
<td>
<input
type=
"text"
name=
"timeout"
id=
"timeout"
value=
"
<?=
$pconfig
[
'timeout'
];
?>
"
/>
<input
type=
"text"
name=
"timeout"
id=
"timeout"
value=
"
<?=
$pconfig
[
'timeout'
];
?>
"
/>
<div
class=
"hidden"
for=
"help_for_timeout"
>
<div
class=
"hidden"
for=
"help_for_timeout"
>
...
@@ -125,7 +133,7 @@ include("head.inc");
...
@@ -125,7 +133,7 @@ include("head.inc");
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td><a
id=
"help_for_interval"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"
i
nterval"
)
;
?>
</td>
<td><a
id=
"help_for_interval"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"
I
nterval"
)
;
?>
</td>
<td>
<td>
<input
type=
"text"
name=
"interval"
id=
"interval"
value=
"
<?=
$pconfig
[
'interval'
];
?>
"
/>
<input
type=
"text"
name=
"interval"
id=
"interval"
value=
"
<?=
$pconfig
[
'interval'
];
?>
"
/>
<div
class=
"hidden"
for=
"help_for_interval"
>
<div
class=
"hidden"
for=
"help_for_interval"
>
...
@@ -134,7 +142,7 @@ include("head.inc");
...
@@ -134,7 +142,7 @@ include("head.inc");
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td><a
id=
"help_for_prefork"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"
p
refork"
)
;
?>
</td>
<td><a
id=
"help_for_prefork"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"
P
refork"
)
;
?>
</td>
<td>
<td>
<input
type=
"text"
name=
"prefork"
id=
"prefork"
value=
"
<?=
$pconfig
[
'prefork'
];
?>
"
/>
<input
type=
"text"
name=
"prefork"
id=
"prefork"
value=
"
<?=
$pconfig
[
'prefork'
];
?>
"
/>
<div
class=
"hidden"
for=
"help_for_prefork"
>
<div
class=
"hidden"
for=
"help_for_prefork"
>
...
@@ -142,6 +150,22 @@ include("head.inc");
...
@@ -142,6 +150,22 @@ include("head.inc");
</div>
</div>
</td>
</td>
</tr>
</tr>
<tr>
<td><a
id=
"help_for_lb_use_sticky"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Sticky connections"
);
?>
</td>
<td>
<input
name=
"lb_use_sticky"
type=
"checkbox"
id=
"lb_use_sticky"
value=
"yes"
<?=
!
empty
(
$pconfig
[
'lb_use_sticky'
])
?
'checked="checked"'
:
''
;
?>
/>
<strong>
<?=
gettext
(
"Use sticky connections"
);
?>
</strong><br
/>
<div
class=
"hidden"
for=
"help_for_lb_use_sticky"
>
<?=
gettext
(
"Successive connections will be redirected to the servers "
.
"in a round-robin manner with connections from the same "
.
"source being sent to the same web server. This 'sticky "
.
"connection' will exist as long as there are states that "
.
"refer to this connection. Once the states expire, so will "
.
"the sticky connection. Further connections from that host "
.
"will be redirected to the next web server in the round-robin."
);
?>
</div>
</td>
</tr>
<tr>
<tr>
<td>
</td>
<td>
</td>
<td>
<td>
...
...
src/www/system_advanced_firewall.php
View file @
4497a242
...
@@ -108,16 +108,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
...
@@ -108,16 +108,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$input_errors
[]
=
gettext
(
"The Reflection timeout must be an integer."
);
$input_errors
[]
=
gettext
(
"The Reflection timeout must be an integer."
);
}
}
if
(
count
(
$input_errors
)
==
0
)
{
if
(
count
(
$input_errors
)
==
0
)
{
$need_relayd_restart
=
false
;
if
(
!
empty
(
$pconfig
[
'lb_use_sticky'
]))
{
if
(
!
empty
(
$pconfig
[
'lb_use_sticky'
]))
{
if
(
!
isset
(
$config
[
'system'
][
'lb_use_sticky'
]))
{
$config
[
'system'
][
'lb_use_sticky'
]
=
true
;
$config
[
'system'
][
'lb_use_sticky'
]
=
true
;
$need_relayd_restart
=
true
;
}
}
elseif
(
isset
(
$config
[
'system'
][
'lb_use_sticky'
]))
{
}
elseif
(
isset
(
$config
[
'system'
][
'lb_use_sticky'
]))
{
unset
(
$config
[
'system'
][
'lb_use_sticky'
]);
unset
(
$config
[
'system'
][
'lb_use_sticky'
]);
$need_relayd_restart
=
true
;
}
}
if
(
!
empty
(
$pconfig
[
'srctrack'
]))
{
if
(
!
empty
(
$pconfig
[
'srctrack'
]))
{
...
@@ -269,9 +264,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
...
@@ -269,9 +264,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
configure_cron
();
configure_cron
();
filter_configure
();
filter_configure
();
if
(
$need_relayd_restart
)
{
relayd_configure
();
}
}
}
}
}
...
@@ -462,7 +454,7 @@ include("head.inc");
...
@@ -462,7 +454,7 @@ include("head.inc");
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<th
colspan=
"2"
valign=
"top"
class=
"listtopic"
>
<?=
gettext
(
'
Load Balancing
'
)
?>
</th>
<th
colspan=
"2"
valign=
"top"
class=
"listtopic"
>
<?=
gettext
(
'
Multi-WAN
'
)
?>
</th>
</tr>
</tr>
<tr>
<tr>
<td><a
id=
"help_for_lb_use_sticky"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Sticky connections"
);
?>
</td>
<td><a
id=
"help_for_lb_use_sticky"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Sticky connections"
);
?>
</td>
...
@@ -472,16 +464,15 @@ include("head.inc");
...
@@ -472,16 +464,15 @@ include("head.inc");
<div
class=
"hidden"
for=
"help_for_lb_use_sticky"
>
<div
class=
"hidden"
for=
"help_for_lb_use_sticky"
>
<?=
gettext
(
"Successive connections will be redirected to the servers "
.
<?=
gettext
(
"Successive connections will be redirected to the servers "
.
"in a round-robin manner with connections from the same "
.
"in a round-robin manner with connections from the same "
.
"source being sent to the same
web server
. This 'sticky "
.
"source being sent to the same
gateway
. This 'sticky "
.
"connection' will exist as long as there are states that "
.
"connection' will exist as long as there are states that "
.
"refer to this connection. Once the states expire, so will "
.
"refer to this connection. Once the states expire, so will "
.
"the sticky connection. Further connections from that host "
.
"the sticky connection. Further connections from that host "
.
"will be redirected to the next web server in the round "
.
"will be redirected to the next gateway in the round-robin."
);
?>
"robin. Changing this option will restart the Load Balancing service."
);
?>
</div><br/>
</div><br/>
<input
placeholder=
"
<?=
gettext
(
"Source tracking timeout"
);
?>
"
title=
"
<?=
gettext
(
"Source tracking timeout"
);
?>
"
name=
"srctrack"
id=
"srctrack"
type=
"text"
value=
"
<?=
!
empty
(
$pconfig
[
'srctrack'
])
?
$pconfig
[
'srctrack'
]
:
""
;
?>
"
/>
<input
placeholder=
"
<?=
gettext
(
"Source tracking timeout"
);
?>
"
title=
"
<?=
gettext
(
"Source tracking timeout"
);
?>
"
name=
"srctrack"
id=
"srctrack"
type=
"text"
value=
"
<?=
!
empty
(
$pconfig
[
'srctrack'
])
?
$pconfig
[
'srctrack'
]
:
""
;
?>
"
/>
<div
class=
"hidden"
for=
"help_for_lb_use_sticky"
>
<div
class=
"hidden"
for=
"help_for_lb_use_sticky"
>
<?=
gettext
(
"Set the source tracking timeout for sticky connections. "
.
<?=
gettext
(
"Set the source tracking timeout for sticky connections
in seconds
. "
.
"By default this is 0, so source tracking is removed as soon as the state expires. "
.
"By default this is 0, so source tracking is removed as soon as the state expires. "
.
"Setting this timeout higher will cause the source/destination relationship to persist for longer periods of time."
);
?>
"Setting this timeout higher will cause the source/destination relationship to persist for longer periods of time."
);
?>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment