diff --git a/net/relayd/Makefile b/net/relayd/Makefile index 0826605d2..859889be0 100644 --- a/net/relayd/Makefile +++ b/net/relayd/Makefile @@ -1,6 +1,6 @@ PLUGIN_NAME= relayd PLUGIN_VERSION= 2.0.d -PLUGIN_REVISION= 5 +PLUGIN_REVISION= 6 PLUGIN_DEPENDS= relayd PLUGIN_COMMENT= Relayd Load Balancer PLUGIN_MAINTAINER= frank.brendel@eurolog.com diff --git a/net/relayd/src/etc/inc/plugins.inc.d/relayd.inc b/net/relayd/src/etc/inc/plugins.inc.d/relayd.inc index 415142ca2..eec641244 100644 --- a/net/relayd/src/etc/inc/plugins.inc.d/relayd.inc +++ b/net/relayd/src/etc/inc/plugins.inc.d/relayd.inc @@ -1,32 +1,30 @@ +/* + * Copyright (C) 2018 EURO-LOG AG + * Copyright (C) 2016 Franco Fichtner + * All rights reserved. * - * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * 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. * - * 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. + * 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 relayd_enabled() @@ -34,7 +32,7 @@ function relayd_enabled() global $config; return isset($config['OPNsense']['relayd']['general']['enabled']) && - $config['OPNsense']['relayd']['general']['enabled'] == 1; + $config['OPNsense']['relayd']['general']['enabled'] == 1; } function relayd_firewall($fw) @@ -48,7 +46,9 @@ function relayd_firewall($fw) function relayd_services() { global $config; + $services = array(); + if (relayd_enabled()) { $services[] = array( 'description' => gettext('Relayd'), @@ -60,6 +60,7 @@ function relayd_services() 'name' => 'relayd', ); } + return $services; } diff --git a/net/relayd/src/opnsense/mvc/app/controllers/OPNsense/Relayd/Api/ServiceController.php b/net/relayd/src/opnsense/mvc/app/controllers/OPNsense/Relayd/Api/ServiceController.php index 125a69592..502b7055f 100644 --- a/net/relayd/src/opnsense/mvc/app/controllers/OPNsense/Relayd/Api/ServiceController.php +++ b/net/relayd/src/opnsense/mvc/app/controllers/OPNsense/Relayd/Api/ServiceController.php @@ -1,31 +1,29 @@ mdlRelayd->serializeToConfig(); Config::getInstance()->save(); - if ($nodeType == 'general' && - isset($relaydInfo[$nodeType]['enabled']) && - $relaydInfo[$nodeType]['enabled'] == '0') { + if ($nodeType == 'general') { $svcRelayd = new ServiceController(); - $result = $svcRelayd->stopAction(); + $result = $svcRelayd->reconfigureAction(); } } } diff --git a/net/relayd/src/opnsense/mvc/app/views/OPNsense/Relayd/index.volt b/net/relayd/src/opnsense/mvc/app/views/OPNsense/Relayd/index.volt index f651c04f3..3bbb9296e 100644 --- a/net/relayd/src/opnsense/mvc/app/views/OPNsense/Relayd/index.volt +++ b/net/relayd/src/opnsense/mvc/app/views/OPNsense/Relayd/index.volt @@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. $('#btnReload').unbind('click').click(function(){ $('#btnReloadProgress').addClass("fa fa-spinner fa-pulse"); ajaxCall(url="/api/relayd/service/reconfigure", sendData={}, callback=function(data,status) { + updateServiceControlUI('relayd'); $('#btnReloadProgress').removeClass("fa fa-spinner fa-pulse"); $('#btnReload').blur(); $("#responseMsg").removeClass("hidden"); @@ -62,10 +63,10 @@ POSSIBILITY OF SUCH DAMAGE. $("#frm_GeneralSettings_progress").addClass("fa fa-spinner fa-pulse"); var frm_id = 'frm_GeneralSettings'; saveFormToEndpoint(url = "/api/relayd/settings/set/general/",formid=frm_id,callback_ok=function(){ + $("#"+frm_id+"_progress").removeClass("fa fa-spinner fa-pulse"); + $("#btn_ApplyGeneralSettings").blur(); updateServiceControlUI('relayd'); }); - $("#"+frm_id+"_progress").removeClass("fa fa-spinner fa-pulse"); - $("#btn_ApplyGeneralSettings").blur(); }); $("#grid-host").UIBootgrid({ @@ -332,8 +333,8 @@ POSSIBILITY OF SUCH DAMAGE.

- - + +

diff --git a/net/relayd/src/opnsense/mvc/app/views/OPNsense/Relayd/status.volt b/net/relayd/src/opnsense/mvc/app/views/OPNsense/Relayd/status.volt index 9f375cc28..01e03c96d 100644 --- a/net/relayd/src/opnsense/mvc/app/views/OPNsense/Relayd/status.volt +++ b/net/relayd/src/opnsense/mvc/app/views/OPNsense/Relayd/status.volt @@ -28,6 +28,7 @@ POSSIBILITY OF SUCH DAMAGE.