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
f13453d6
Commit
f13453d6
authored
Jul 09, 2015
by
Ad Schellevis
Committed by
Franco Fichtner
Jul 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) cleanups vslb.inc
parent
2d48ceec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
89 deletions
+60
-89
vslb.inc
src/etc/inc/vslb.inc
+21
-89
load_balancer_virtual_server.php
src/www/load_balancer_virtual_server.php
+39
-0
No files found.
src/etc/inc/vslb.inc
View file @
f13453d6
...
...
@@ -111,38 +111,6 @@ class SendMonitor extends Monitor {
}
}
function
echo_lbaction
(
$action
)
{
global
$config
;
// Index actions by name
$actions_a
=
array
();
for
(
$i
=
0
;
isset
(
$config
[
'load_balancer'
][
'lbaction'
][
$i
]);
$i
++
)
$actions_a
[
$config
[
'load_balancer'
][
'lbaction'
][
$i
][
'name'
]]
=
$config
[
'load_balancer'
][
'lbaction'
][
$i
];
$ret
=
""
;
$ret
.=
"
{
$actions_a
[
$action
][
'direction'
]
}
{
$actions_a
[
$action
][
'type'
]
}
{
$actions_a
[
$action
][
'action'
]
}
"
;
switch
(
$actions_a
[
$action
][
'action'
])
{
case
'append'
:
$ret
.=
"
\"
{
$actions_a
[
$action
][
'options'
][
'value'
]
}
\"
to
\"
{
$actions_a
[
$action
][
'options'
][
'akey'
]
}
\"
"
;
break
;
case
'change'
:
$ret
.=
"
\"
{
$actions_a
[
$action
][
'options'
][
'akey'
]
}
\"
to
\"
{
$actions_a
[
$action
][
'options'
][
'value'
]
}
\"
"
;
break
;
case
'expect'
:
$ret
.=
"
\"
{
$actions_a
[
$action
][
'options'
][
'value'
]
}
\"
from
\"
{
$actions_a
[
$action
][
'options'
][
'akey'
]
}
\"
"
;
break
;
case
'filter'
:
$ret
.=
"
\"
{
$actions_a
[
$action
][
'options'
][
'value'
]
}
\"
from
\"
{
$actions_a
[
$action
][
'options'
][
'akey'
]
}
\"
"
;
break
;
case
'hash'
:
$ret
.=
"
\"
{
$actions_a
[
$action
][
'options'
][
'akey'
]
}
\"
"
;
break
;
case
'log'
:
$ret
.=
"
\"
{
$actions_a
[
$action
][
'options'
][
'akey'
]
}
\"
"
;
break
;
}
return
$ret
;
}
function
relayd_configure
(
$kill_first
=
false
)
{
global
$config
,
$g
;
...
...
@@ -153,10 +121,26 @@ function relayd_configure($kill_first=false) {
require_once
(
"filter.inc"
);
}
if
(
isset
(
$config
[
'load_balancer'
][
'virtual_server'
]))
{
$vs_a
=
$config
[
'load_balancer'
][
'virtual_server'
];
}
else
{
$vs_a
=
null
;
}
if
(
isset
(
$config
[
'load_balancer'
][
'lbpool'
]))
{
$pool_a
=
$config
[
'load_balancer'
][
'lbpool'
];
}
else
{
$pool_a
=
null
;
}
if
(
isset
(
$config
[
'load_balancer'
][
'lbprotocol'
]))
{
$protocol_a
=
$config
[
'load_balancer'
][
'lbprotocol'
];
}
else
{
$protocol_a
=
null
;
}
if
(
isset
(
$config
[
'load_balancer'
][
'setting'
]))
{
$setting
=
$config
[
'load_balancer'
][
'setting'
];
}
else
{
$setting
=
null
;
}
$check_a
=
array
();
...
...
@@ -184,7 +168,7 @@ function relayd_configure($kill_first=false) {
}
$fd
=
fopen
(
'/var/etc/relayd.conf'
,
'w'
);
$conf
.
=
"log updates
\n
"
;
$conf
=
"log updates
\n
"
;
/* Global timeout, interval and prefork settings
if not specified by the user:
...
...
@@ -233,21 +217,6 @@ function relayd_configure($kill_first=false) {
}
}
}
// if(is_array($protocol_a)) {
// for ($i = 0; isset($protocol_a[$i]); $i++) {
// $proto = "{$protocol_a[$i]['type']} protocol \"{$protocol_a[$i]['name']}\" {\n";
// if(is_array($protocol_a[$i]['lbaction'])) {
// if($protocol_a[$i]['lbaction'][0] == "") {
// continue;
// }
// for ($a = 0; isset($protocol_a[$i]['lbaction'][$a]); $a++) {
// $proto .= " " . echo_lbaction($protocol_a[$i]['lbaction'][$a]) . "\n";
// }
// }
// $proto .= "}\n";
// $conf .= $proto;
// }
// }
$conf
.=
"dns protocol
\"
dnsproto
\"
{\n"
;
$conf
.=
"
\t
"
.
"tcp { nodelay, sack, socket buffer 1024, backlog 1000 }
\n
"
;
...
...
@@ -529,40 +498,3 @@ function cleanup_lb_mark_anchor($name)
file_put_contents
(
$filename
,
implode
(
"
\n
"
,
$cleanup_anchors
));
}
/* Cleanup relayd anchors that have been marked for cleanup. */
function
cleanup_lb_marked
()
{
global
$config
;
$filename
=
'/tmp/relayd_anchors_remove'
;
$cleanup_anchors
=
array
();
/* Nothing to do! */
if
(
!
file_exists
(
$filename
))
{
return
;
}
else
{
$cleanup_anchors
=
explode
(
"
\n
"
,
file_get_contents
(
$filename
));
/* Nothing to do! */
if
(
empty
(
$cleanup_anchors
))
{
return
;
}
}
/* Load current names so we can make sure we don't remove an anchor that is still in use. */
$vs_a
=
$config
[
'load_balancer'
][
'virtual_server'
];
$active_vsnames
=
array
();
if
(
isset
(
$vs_a
))
{
foreach
(
$vs_a
as
$vs
)
{
$active_vsnames
[]
=
$vs
[
'name'
];
}
}
foreach
(
$cleanup_anchors
as
$anchor
)
{
/* Only cleanup an anchor if it is not still active. */
if
(
!
in_array
(
$anchor
,
$active_vsnames
))
{
cleanup_lb_anchor
(
$anchor
);
}
}
@
unlink
(
$filename
);
}
src/www/load_balancer_virtual_server.php
View file @
f13453d6
...
...
@@ -33,6 +33,45 @@ require_once("filter.inc");
require_once
(
"vslb.inc"
);
require_once
(
"maintable.inc"
);
/* Cleanup relayd anchors that have been marked for cleanup. */
function
cleanup_lb_marked
()
{
global
$config
;
$filename
=
'/tmp/relayd_anchors_remove'
;
$cleanup_anchors
=
array
();
/* Nothing to do! */
if
(
!
file_exists
(
$filename
))
{
return
;
}
else
{
$cleanup_anchors
=
explode
(
"
\n
"
,
file_get_contents
(
$filename
));
/* Nothing to do! */
if
(
empty
(
$cleanup_anchors
))
{
return
;
}
}
/* Load current names so we can make sure we don't remove an anchor that is still in use. */
$vs_a
=
$config
[
'load_balancer'
][
'virtual_server'
];
$active_vsnames
=
array
();
if
(
isset
(
$vs_a
))
{
foreach
(
$vs_a
as
$vs
)
{
$active_vsnames
[]
=
$vs
[
'name'
];
}
}
foreach
(
$cleanup_anchors
as
$anchor
)
{
/* Only cleanup an anchor if it is not still active. */
if
(
!
in_array
(
$anchor
,
$active_vsnames
))
{
cleanup_lb_anchor
(
$anchor
);
}
}
@
unlink
(
$filename
);
}
if
(
!
is_array
(
$config
[
'load_balancer'
][
'virtual_server'
]))
{
$config
[
'load_balancer'
][
'virtual_server'
]
=
array
();
}
...
...
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