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
64ee69be
Commit
64ee69be
authored
Jul 10, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) cleanup gwlb.inc
parent
3f6f524a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
57 deletions
+62
-57
gwlb.inc
src/etc/inc/gwlb.inc
+0
-57
services.inc
src/etc/inc/services.inc
+22
-0
rc.openvpn
src/etc/rc.openvpn
+25
-0
status_gateway_groups.php
src/www/status_gateway_groups.php
+15
-0
No files found.
src/etc/inc/gwlb.inc
View file @
64ee69be
...
...
@@ -912,20 +912,6 @@ function lookup_gateway_ip_by_name($name) {
return
false
;
}
function
lookup_gateway_monitor_ip_by_name
(
$name
)
{
$gateways_arr
=
return_gateways_array
(
false
,
true
);
if
(
!
empty
(
$gateways_arr
[
$name
]))
{
$gateway
=
$gateways_arr
[
$name
];
if
(
!
is_ipaddr
(
$gateway
[
'monitor'
]))
return
$gateway
[
'gateway'
];
return
$gateway
[
'monitor'
];
}
return
(
false
);
}
function
lookup_gateway_interface_by_name
(
$name
)
{
$gateways_arr
=
return_gateways_array
(
false
,
true
);
...
...
@@ -1049,48 +1035,5 @@ function validate_address_family($ipaddr, $gwname) {
return
false
;
}
function
gateway_is_gwgroup_member
(
$name
)
{
global
$config
;
if
(
is_array
(
$config
[
'gateways'
][
'gateway_group'
]))
$groups
=
$config
[
'gateways'
][
'gateway_group'
];
else
return
false
;
$members
=
array
();
foreach
(
$groups
as
$group
)
{
if
(
is_array
(
$group
[
'item'
]))
{
foreach
(
$group
[
'item'
]
as
$item
)
{
$elements
=
explode
(
"|"
,
$item
);
$gwname
=
$elements
[
0
];
if
(
$name
==
$elements
[
0
])
$members
[]
=
$group
[
'name'
];
}
}
}
return
$members
;
}
/**
* check if apinger service is enabled
*/
function
is_apinger_enabled
()
{
global
$config
;
$gwcount
=
0
;
if
(
isset
(
$config
[
'gateways'
][
'gateway_item'
]))
{
foreach
(
$config
[
'gateways'
][
'gateway_item'
]
as
$gwkey
=>
$gateway
)
{
if
(
!
isset
(
$gateway
[
'monitor_disable'
])
||
$gateway
[
'monitor_disable'
]
==
"0"
)
{
$gwcount
+=
1
;
}
}
}
if
(
$gwcount
==
0
)
{
return
false
;
}
else
{
return
true
;
}
}
?>
src/etc/inc/services.inc
View file @
64ee69be
...
...
@@ -2408,6 +2408,28 @@ function install_cron_job($command, $active=false, $minute="0", $hour="*", $mont
configure_cron
();
}
/**
* check if apinger service is enabled
*/
function
is_apinger_enabled
()
{
global
$config
;
$gwcount
=
0
;
if
(
isset
(
$config
[
'gateways'
][
'gateway_item'
]))
{
foreach
(
$config
[
'gateways'
][
'gateway_item'
]
as
$gwkey
=>
$gateway
)
{
if
(
!
isset
(
$gateway
[
'monitor_disable'
])
||
$gateway
[
'monitor_disable'
]
==
"0"
)
{
$gwcount
+=
1
;
}
}
}
if
(
$gwcount
==
0
)
{
return
false
;
}
else
{
return
true
;
}
}
function
get_services
()
{
global
$config
;
$services
=
array
();
...
...
src/etc/rc.openvpn
View file @
64ee69be
...
...
@@ -36,6 +36,31 @@ require_once("filter.inc");
require_once
(
"gwlb.inc"
);
require_once
(
"openvpn.inc"
);
function
gateway_is_gwgroup_member
(
$name
)
{
global
$config
;
if
(
is_array
(
$config
[
'gateways'
][
'gateway_group'
]))
$groups
=
$config
[
'gateways'
][
'gateway_group'
];
else
return
false
;
$members
=
array
();
foreach
(
$groups
as
$group
)
{
if
(
is_array
(
$group
[
'item'
]))
{
foreach
(
$group
[
'item'
]
as
$item
)
{
$elements
=
explode
(
"|"
,
$item
);
$gwname
=
$elements
[
0
];
if
(
$name
==
$elements
[
0
])
$members
[]
=
$group
[
'name'
];
}
}
}
return
$members
;
}
function
openvpn_resync_if_needed
(
$mode
,
$ovpn_settings
,
$interface
)
{
global
$g
,
$config
;
...
...
src/www/status_gateway_groups.php
View file @
64ee69be
...
...
@@ -29,6 +29,21 @@
require_once
(
"guiconfig.inc"
);
function
lookup_gateway_monitor_ip_by_name
(
$name
)
{
$gateways_arr
=
return_gateways_array
(
false
,
true
);
if
(
!
empty
(
$gateways_arr
[
$name
]))
{
$gateway
=
$gateways_arr
[
$name
];
if
(
!
is_ipaddr
(
$gateway
[
'monitor'
]))
return
$gateway
[
'gateway'
];
return
$gateway
[
'monitor'
];
}
return
(
false
);
}
if
(
!
is_array
(
$config
[
'gateways'
]))
{
$config
[
'gateways'
]
=
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