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
269b9b6a
Commit
269b9b6a
authored
Feb 19, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugins: support start and restart
parent
4635ac7b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
48 deletions
+79
-48
plugins.inc
src/etc/inc/plugins.inc
+13
-0
vpn.inc
src/etc/inc/plugins.inc.d/vpn.inc
+62
-37
guiconfig.inc
src/www/guiconfig.inc
+2
-2
vpn_l2tp_users.php
src/www/vpn_l2tp_users.php
+2
-9
No files found.
src/etc/inc/plugins.inc
View file @
269b9b6a
...
...
@@ -49,6 +49,19 @@ function plugin_scan()
return
$ret
;
}
function
plugins_action
(
$service
,
$action
)
{
if
(
!
isset
(
$service
[
'plugin'
]))
{
return
;
}
/* avoid auto-loading, it must have been required before */
$func
=
sprintf
(
'%s_action'
,
$service
[
'plugin'
]);
if
(
function_exists
(
$func
))
{
$func
(
$service
,
$action
);
}
}
function
plugins_services
()
{
$services
=
array
();
...
...
src/etc/inc/plugins.inc.d/vpn.inc
View file @
269b9b6a
<?php
/*
Copyright (C) 2008 Shrew Soft Inc
Copyright (C) 2008 Ermal Luçi
Copyright (C) 2004 Scott Ullrich
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
* Coypright (C) 2016 Franco Fichtner <franco@opnsense.org>
* Copyright (C) 2008 Shrew Soft Inc
* Copyright (C) 2008 Ermal Luçi
* Copyright (C) 2004 Scott Ullrich
* Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
function
vpn_configure
()
{
...
...
@@ -45,24 +46,48 @@ function vpn_services()
$services
=
array
();
if
(
isset
(
$config
[
'pptpd'
][
'mode'
])
&&
$config
[
'pptpd'
][
'mode'
]
!=
'off'
)
{
$pconfig
=
array
();
$pconfig
[
'name'
]
=
'pptpd'
;
$pconfig
[
'description'
]
=
gettext
(
'PPTP Server'
);
$pconfig
[
'pidfile'
]
=
'/var/run/pptp-vpn.pid'
;
$services
[]
=
$pconfig
;
$services
[]
=
array
(
'description'
=>
gettext
(
'PPTP Server'
),
'pidfile'
=>
'/var/run/pptp-vpn.pid'
,
'plugin'
=>
'vpn'
,
'name'
=>
'pptpd'
,
);
}
if
(
isset
(
$config
[
'l2tp'
][
'mode'
])
&&
$config
[
'l2tp'
][
'mode'
]
!=
'off'
)
{
$pconfig
=
array
();
$pconfig
[
'name'
]
=
'l2tpd'
;
$pconfig
[
'description'
]
=
gettext
(
'L2TP Server'
);
$pconfig
[
'pidfile'
]
=
'/var/run/l2tp-vpn.pid'
;
$services
[]
=
$pconfig
;
$services
[]
=
array
(
'description'
=>
gettext
(
'L2TP Server'
),
'pidfile'
=>
'/var/run/l2tp-vpn.pid'
,
'plugin'
=>
'vpn'
,
'name'
=>
'l2tpd'
,
);
}
return
$services
;
}
function
vpn_action
(
$service
,
$action
)
{
if
(
$action
!=
'start'
&&
$action
!=
'restart'
)
{
/* XXX also need stop */
return
;
}
switch
(
$service
[
'name'
])
{
case
'l2tpd'
:
vpn_l2tp_configure
();
break
;
case
'pptpd'
:
vpn_pptpd_configure
();
break
;
case
'pppoe'
:
/* XXX TBD */
break
;
default
:
break
;
}
}
function
vpn_netgraph_support
()
{
$iflist
=
get_configured_interface_list
();
foreach
(
$iflist
as
$iface
)
{
...
...
src/www/guiconfig.inc
View file @
269b9b6a
...
...
@@ -273,8 +273,8 @@ function print_service_banner($service)
}
}
function
get_std_save_message
()
{
global
$d_sysrebootreqd_path
;
function
get_std_save_message
()
{
$filter_related
=
false
;
$filter_pages
=
array
(
"nat"
,
"filter"
);
$to_return
=
gettext
(
"The changes have been applied successfully."
);
...
...
src/www/vpn_l2tp_users.php
View file @
269b9b6a
...
...
@@ -40,16 +40,9 @@ if ($_POST) {
$pconfig
=
$_POST
;
if
(
$_POST
[
'apply'
])
{
$retval
=
0
;
if
(
!
is_subsystem_dirty
(
'rebootreq'
))
{
$retval
=
vpn_l2tp_configure
();
}
vpn_l2tp_configure
();
$savemsg
=
get_std_save_message
();
if
(
$retval
==
0
)
{
if
(
is_subsystem_dirty
(
'l2tpusers'
))
{
clear_subsystem_dirty
(
'l2tpusers'
);
}
}
clear_subsystem_dirty
(
'l2tpusers'
);
}
}
...
...
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