From da8a2bed0f02364923959e27919fd6989bd99167 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 10 Dec 2015 11:45:46 +0100 Subject: [PATCH] load balancer: remove unused relay pages and related backend parts Dormant ever since 2009, time to remove those finally. --- src/etc/inc/upgrade_config.inc | 23 +- src/etc/inc/vslb.inc | 5 - src/etc/inc/xmlparse.inc | 2 +- .../OPNsense/Core/ACL_Legacy_Page_Map.json | 28 - .../load_balancer_relay_protocol_edit.js | 52 -- src/www/load_balancer_relay_action.php | 158 ----- src/www/load_balancer_relay_action_edit.php | 567 ------------------ src/www/load_balancer_relay_protocol.php | 151 ----- src/www/load_balancer_relay_protocol_edit.php | 288 --------- 9 files changed, 15 insertions(+), 1259 deletions(-) delete mode 100644 src/www/javascript/load_balancer_relay_protocol_edit/load_balancer_relay_protocol_edit.js delete mode 100644 src/www/load_balancer_relay_action.php delete mode 100644 src/www/load_balancer_relay_action_edit.php delete mode 100644 src/www/load_balancer_relay_protocol.php delete mode 100644 src/www/load_balancer_relay_protocol_edit.php diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index 251d2fd1e..2e8512d10 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -2547,20 +2547,25 @@ function upgrade_071_to_072() { rename_field($config['sysctl']['item'], 'desc', 'descr'); } -function upgrade_072_to_073() { +function upgrade_072_to_073() +{ global $config; - if (!is_array($config['load_balancer'])) + + if (!isset($config['load_balancer'])) { return; - if (is_array($config['load_balancer']['monitor_type'])) + } + + if (isset($config['load_balancer']['monitor_type'])) { rename_field($config['load_balancer']['monitor_type'], 'desc', 'descr'); - if (is_array($config['load_balancer']['lbpool'])) + } + + if (isset($config['load_balancer']['lbpool'])) { rename_field($config['load_balancer']['lbpool'], 'desc', 'descr'); - if (is_array($config['load_balancer']['lbaction'])) - rename_field($config['load_balancer']['lbaction'], 'desc', 'descr'); - if (is_array($config['load_balancer']['lbprotocol'])) - rename_field($config['load_balancer']['lbprotocol'], 'desc', 'descr'); - if (is_array($config['load_balancer']['virtual_server'])) + } + + if (isset($config['load_balancer']['virtual_server'])) { rename_field($config['load_balancer']['virtual_server'], 'desc', 'descr'); + } } function upgrade_073_to_074() { diff --git a/src/etc/inc/vslb.inc b/src/etc/inc/vslb.inc index 6df276b02..dfc74daf6 100644 --- a/src/etc/inc/vslb.inc +++ b/src/etc/inc/vslb.inc @@ -139,11 +139,6 @@ function relayd_configure($kill_first=false) { } 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 { diff --git a/src/etc/inc/xmlparse.inc b/src/etc/inc/xmlparse.inc index cd5df6815..c95d601ff 100644 --- a/src/etc/inc/xmlparse.inc +++ b/src/etc/inc/xmlparse.inc @@ -40,7 +40,7 @@ function listtags() 'hash-algorithm-option', 'hosts', 'ifgroupentry', 'igmpentry', 'interface_array', 'item', 'key', - 'lagg', 'lbaction', 'lbpool', 'l7rules', 'lbprotocol', + 'lagg', 'lbpool', 'member', 'menu', 'mobilekey', 'monitor_type', 'mount', 'npt', 'ntpserver', 'onetoone', 'openvpn-server', 'openvpn-client', 'openvpn-csc', 'option', diff --git a/src/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json b/src/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json index 75cc797cc..73557f784 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json +++ b/src/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json @@ -803,34 +803,6 @@ "load_balancer_monitor.php*" ] }, - "page-services-loadbalancer-relay-action-edit": { - "name": "WebCfg - Services: Load Balancer: Relay Action: Edit page", - "descr": "Allow access to the 'Services: Load Balancer: Relay Action: Edit' page.", - "match": [ - "load_balancer_relay_action_edit.php*" - ] - }, - "page-services-loadbalancer-relay-action": { - "name": "WebCfg - Services: Load Balancer: Relay Actions page", - "descr": "Allow access to the 'Services: Load Balancer: Relay Actions' page.", - "match": [ - "load_balancer_relay_action.php*" - ] - }, - "page-services-loadbalancer-relay-protocol-edit": { - "name": "WebCfg - Services: Load Balancer: Relay Protocol: Edit page", - "descr": "Allow access to the 'Services: Load Balancer: Relay Protocol: Edit' page.", - "match": [ - "load_balancer_relay_protocol_edit.php*" - ] - }, - "page-services-loadbalancer-relay-protocol": { - "name": "WebCfg - Services: Load Balancer: Relay Protocols page", - "descr": "Allow access to the 'Services: Load Balancer: Relay Protocols' page.", - "match": [ - "load_balancer_relay_protocol.php*" - ] - }, "page-services-loadbalancer-setting": { "name": "WebCfg - Services: Load Balancer: setting page", "descr": "Allow access to the 'Settings: Load Balancer: Settings' page.", diff --git a/src/www/javascript/load_balancer_relay_protocol_edit/load_balancer_relay_protocol_edit.js b/src/www/javascript/load_balancer_relay_protocol_edit/load_balancer_relay_protocol_edit.js deleted file mode 100644 index 95262f57a..000000000 --- a/src/www/javascript/load_balancer_relay_protocol_edit/load_balancer_relay_protocol_edit.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2005-2008 Bill Marquette . - 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. -*/ - -/* - * This code makes use of prototype shortcuts and will not work - * without prototype being loaded prior to it. - */ - -function copyOption(theSrc, theDst) -{ - var selOption = theSrc[theSrc.selectedIndex]; - theDst.options[theDst.length] = new Option(selOption.text, selOption.value); -} - -function deleteOption(theSel) -{ - var theIndex = theSel.selectedIndex; - var selLength = theSel.length; - if(selLength>0) - { - theSel.options[theIndex] = null; - } -} - -function AllOptions(el, selectAll) { - el.select('option').each(function(opt) { - opt.selected = selectAll; - }); -} diff --git a/src/www/load_balancer_relay_action.php b/src/www/load_balancer_relay_action.php deleted file mode 100644 index a7f32c808..000000000 --- a/src/www/load_balancer_relay_action.php +++ /dev/null @@ -1,158 +0,0 @@ -. - 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. -*/ - -require_once("guiconfig.inc"); -require_once("filter.inc"); -require_once("load_balancer_maintable.inc"); -require_once("services.inc"); -require_once("vslb.inc"); - - -if (!is_array($config['load_balancer']['lbaction'])) { - $config['load_balancer']['lbaction'] = array(); -} -$a_action = &$config['load_balancer']['lbaction']; - - -if ($_POST) { - - $pconfig = $_POST; - - if ($_POST['apply']) { - $retval = 0; - $retval |= filter_configure(); - $retval |= relayd_configure(); - - $savemsg = get_std_save_message(); - clear_subsystem_dirty('loadbalancer'); - } -} - -if ($_GET['act'] == "del") { - if (array_key_exists($_GET['id'], $a_action)) { - /* make sure no relay protocols reference this entry */ - if (is_array($config['load_balancer']['lbprotocol'])) { - foreach ($config['load_balancer']['lbprotocol'] as $lbp) { - foreach($lbp['lbaction'] as $lba) { - if ($lba['name'] == $a_action[$_GET['id']]['name']) { - $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one relay protocol."); - break; - } - } - } - } - - if (!$input_errors) { - unset($a_action[$_GET['id']]); - write_config(); - mark_subsystem_dirty('loadbalancer'); - header("Location: load_balancer_relay_action.php"); - exit; - } - } -} - -/* Index lbpool array for easy hyperlinking */ -/* for ($i = 0; isset($config['load_balancer']['lbprotocol'][$i]); $i++) { - for ($o = 0; isset($config['load_balancer']['lbprotocol'][$i]['options'][$o]); o++) { - $a_vs[$i]['options'][$o] = " - $a_vs[$i]['poolname'] = "{$a_vs[$i]['poolname']}"; - if ($a_vs[$i]['sitedown'] != '') { - $a_vs[$i]['sitedown'] = "{$a_vs[$i]['sitedown']}"; - } else { - $a_vs[$i]['sitedown'] = 'none'; - } -} -*/ - -$shortcut_section = "relayd"; - -include("head.inc"); - -?> - - - - - -
-
-
- - 0) print_input_errors($input_errors); ?> - -

- You must apply the changes in order for them to take effect."));?>
- - - -

- - - -
-
- -
- -
-edit_uri('load_balancer_relay_action_edit.php'); - $t->my_uri('load_balancer_relay_action.php'); - $t->add_column(gettext('Name'),'name',20); - $t->add_column(gettext('Type'),'type',10); - $t->add_column(gettext('Options'),'options',30); - $t->add_column(gettext('Description'),'descr',30); - $t->add_button('edit'); - $t->add_button('dup'); - $t->add_button('del'); - $t->add_content_array($a_action); - $t->display(); -?> -
-
-
-
-
-
-
-
- - - diff --git a/src/www/load_balancer_relay_action_edit.php b/src/www/load_balancer_relay_action_edit.php deleted file mode 100644 index 7f2926d30..000000000 --- a/src/www/load_balancer_relay_action_edit.php +++ /dev/null @@ -1,567 +0,0 @@ -. - 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. -*/ - -require_once("guiconfig.inc"); -require_once("services.inc"); - -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_relay_action.php'); - -if (!is_array($config['load_balancer']['lbaction'])) { - $config['load_balancer']['lbaction'] = array(); -} -$a_action = &$config['load_balancer']['lbaction']; - -if (is_numericint($_GET['id'])) - $id = $_GET['id']; -if (isset($_POST['id']) && is_numericint($_POST['id'])) - $id = $_POST['id']; - -if (isset($id) && $a_action[$id]) { - $pconfig = array(); - $pconfig = $a_action[$id]; -} else { - // XXX - TODO, this isn't sane for this page :) - /* Some sane page defaults */ - $pconfig['protocol'] = 'http'; - $pconfig['direction'] = 'request'; - $pconfig['type'] = 'cookie'; - $pconfig['action'] = 'change'; -} - -$kv = array('key', 'value'); -$vk = array('value', 'key'); -$hr_actions = array(); -$hr_actions['append'] = $vk; -$hr_actions['change'] = $kv; -$hr_actions['expect'] = $vk; -$hr_actions['filter'] = $vk; -$hr_actions['hash'] = 'key'; -$hr_actions['log'] = 'key'; -// mark is disabled until I can figure out how to make the display clean -//$hr_actions['mark'] = array('value', 'key', 'id'); -//$hr_actions[] = 'label'; -//$hr_actions[] = 'no label'; -$hr_actions['remove'] = 'key'; -//$hr_actions[] = 'return error'; -/* Setup decision tree */ -$action = array(); -$actions['protocol']['http'] = 'HTTP'; -$actions['protocol']['tcp'] = 'TCP'; -$actions['protocol']['dns'] = 'DNS'; -$actions['direction'] = array(); -$actions['direction']['request'] = array(); -$actions['direction']['request']['cookie'] = $hr_actions; -$actions['direction']['request']['header'] = $hr_actions; -$actions['direction']['request']['path'] = $hr_actions; -$actions['direction']['request']['query'] = $hr_actions; -$actions['direction']['request']['url'] = $hr_actions; -$actions['direction']['response'] = array(); -$actions['direction']['response']['cookie'] = $hr_actions; -$actions['direction']['response']['header'] = $hr_actions; -//$action['http']['tcp'] = array(); -//$action['http']['ssl'] = array(); - - - -if ($_POST) { - unset($input_errors); - $pconfig = $_POST; - - // Peel off the action and type from the post and fix $pconfig - $action = explode('_', $pconfig['action']); - $pconfig['action'] = $action[2]; - $pconfig['type'] = $action[1]; - unset($pconfig["type_{$pconfig['direction']}"]); - - /* input validation */ - $reqdfields = explode(" ", "name protocol direction action descr"); - $reqdfieldsn = array(gettext("Name"),gettext("Protocol"),gettext("Direction"),gettext("Action"),gettext("Description")); - - do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); - - /* Ensure that our monitor names are unique */ - for ($i=0; isset($config['load_balancer']['lbactions'][$i]); $i++) - if (($_POST['name'] == $config['load_balancer']['lbactions'][$i]['name']) && ($i != $id)) - $input_errors[] = gettext("This action name has already been used. Action names must be unique."); - - if (strpos($_POST['name'], " ") !== false) - $input_errors[] = gettext("You cannot use spaces in the 'name' field."); - - if (!$input_errors) { - $actent = array(); - if (isset($id) && $a_action[$id]) { - $actent = $a_action[$id]; - } - - update_if_changed("name", $actent['name'], $pconfig['name']); - update_if_changed("protocol", $actent['protocol'], $pconfig['protocol']); - update_if_changed("type", $actent['type'], $pconfig['type']); - update_if_changed("direction", $actent['direction'], $pconfig['direction']); - update_if_changed("description", $actent['descr'], $pconfig['descr']); - update_if_changed("action", $actent['action'], $pconfig['action']); - switch ($pconfig['action']) { - case "append": - case "change": - case "expect": - case "filter": { - update_if_changed("value", $actent['options']['value'], $pconfig['option_action_value']); - update_if_changed("key", $actent['options']['akey'], $pconfig['option_action_key']); - break; - } - case "hash": - case "log": { - update_if_changed("key", $actent['options']['akey'], $pconfig['option_action_key']); - break; - } - } - - if (isset($id) && $a_action[$id]) { -// XXX - TODO - /* modify all virtual servers with this name */ -// for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) { -// if ($config['load_balancer']['virtual_server'][$i]['protocol'] == $a_protocol[$id]['name']) -// $config['load_balancer']['virtual_server'][$i]['protocol'] = $protent['name']; -// } - $a_action[$id] = $actent; - } else { - $a_action[] = $actent; - } - - mark_subsystem_dirty('loadbalancer'); - write_config(); - header("Location: load_balancer_relay_action.php"); - exit; - } -} - -$shortcut_section = "relayd"; - -include("head.inc"); - $types = array("http" => gettext("HTTP"), "tcp" => gettext("TCP"), "dns" => gettext("DNS")); -?> - - - - - - - - -
- -
- -
- 0) print_input_errors($input_errors); ?> - -
- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - > - - - - > - - - - > - - - - - - - -
- size="16" maxlength="16"> -
- size="64"> -
- -
- - -
- $v) { - echo" -
- -
- - - - - - -
 size="20">
 size="20">
 size="20">
-
- XXX: -
- XXX: - -
  - "> - " onclick="window.location.href=''" /> - - - -
-
-
-
-
-
- - - - - diff --git a/src/www/load_balancer_relay_protocol.php b/src/www/load_balancer_relay_protocol.php deleted file mode 100644 index 44dc42260..000000000 --- a/src/www/load_balancer_relay_protocol.php +++ /dev/null @@ -1,151 +0,0 @@ -. - 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. -*/ - -require_once("guiconfig.inc"); -require_once("filter.inc"); -require_once("load_balancer_maintable.inc"); -require_once("services.inc"); -require_once("vslb.inc"); - - -if (!is_array($config['load_balancer']['lbprotocol'])) { - $config['load_balancer']['lbprotocol'] = array(); -} -$a_protocol = &$config['load_balancer']['lbprotocol']; - -if ($_POST) { - $pconfig = $_POST; - - if ($_POST['apply']) { - $retval = 0; - $retval |= filter_configure(); - $retval |= relayd_configure(); - - $savemsg = get_std_save_message(); - clear_subsystem_dirty('loadbalancer'); - } -} - -if ($_GET['act'] == "del") { - if (array_key_exists($_GET['id'], $a_protocol)) { - /* make sure no virtual servers reference this entry */ - if (is_array($config['load_balancer']['virtual_server'])) { - foreach ($config['load_balancer']['virtual_server'] as $vs) { - if ($vs['protocol'] == $a_protocol[$_GET['id']]['name']) { - $input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one virtual server."); - break; - } - } - } - - if (!$input_errors) { - unset($a_protocol[$_GET['id']]); - write_config(); - mark_subsystem_dirty('loadbalancer'); - header("Location: load_balancer_relay_protocol.php"); - exit; - } - } -} - -/* Index lbpool array for easy hyperlinking */ -/* for ($i = 0; isset($config['load_balancer']['lbprotocol'][$i]); $i++) { - for ($o = 0; isset($config['load_balancer']['lbprotocol'][$i]['options'][$o]); o++) { - $a_vs[$i]['options'][$o] = " - $a_vs[$i]['poolname'] = "{$a_vs[$i]['poolname']}"; - if ($a_vs[$i]['sitedown'] != '') { - $a_vs[$i]['sitedown'] = "{$a_vs[$i]['sitedown']}"; - } else { - $a_vs[$i]['sitedown'] = 'none'; - } -} -*/ - -$shortcut_section = "relayd"; - -include("head.inc"); - -?> - - - - -
-
-
- - 0) print_input_errors($input_errors); ?> - -

- " . gettext("You must apply the changes in order for them to take effect."));?>
- - -

- - - -
-
- -
- -
-edit_uri('load_balancer_relay_protocol_edit.php'); - $t->my_uri('load_balancer_relay_protocol.php'); - $t->add_column(gettext('Name'),'name',20); - $t->add_column(gettext('Type'),'type',10); - $t->add_column(gettext('Options'),'options',30); - $t->add_column(gettext('Description'),'descr',30); - $t->add_button('edit'); - $t->add_button('dup'); - $t->add_button('del'); - $t->add_content_array($a_protocol); - $t->display(); -?> -
-
-
-
-
-
-
-
- - diff --git a/src/www/load_balancer_relay_protocol_edit.php b/src/www/load_balancer_relay_protocol_edit.php deleted file mode 100644 index ff83ebbc0..000000000 --- a/src/www/load_balancer_relay_protocol_edit.php +++ /dev/null @@ -1,288 +0,0 @@ -. - 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. -*/ - -require_once("guiconfig.inc"); -require_once("services.inc"); - -$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/load_balancer_relay_protocol.php'); - -if (!is_array($config['load_balancer']['lbprotocol'])) { - $config['load_balancer']['lbprotocol'] = array(); -} -$a_protocol = &$config['load_balancer']['lbprotocol']; - -if (is_numericint($_GET['id'])) - $id = $_GET['id']; -if (isset($_POST['id']) && is_numericint($_POST['id'])) - $id = $_POST['id']; - -if (isset($id) && $a_protocol[$id]) { - $pconfig = $a_protocol[$id]; - $pconfig['type'] = $a_protocol[$id]['type']; - $pconfig['descr'] = $a_protocol[$id]['descr']; - $pconfig['lbaction'] = array(); - $pconfig['options'] = $a_protocol[$id]['options']; -} else { - /* Some sane page defaults */ - $pconfig['type'] = 'http'; -} - -if ($_POST) { - unset($input_errors); - $pconfig = $_POST; - - - /* input validation */ - $reqdfields = explode(" ", "name type descr"); - $reqdfieldsn = array(gettext("Name"),gettext("Type"),gettext("Description")); - - do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); - - /* Ensure that our monitor names are unique */ - for ($i=0; isset($config['load_balancer']['lbprotocol'][$i]); $i++) - if (($_POST['name'] == $config['load_balancer']['lbprotocol'][$i]['name']) && ($i != $id)) - $input_errors[] = gettext("This protocol name has already been used. Protocol names must be unique."); - - if (strpos($_POST['name'], " ") !== false) - $input_errors[] = gettext("You cannot use spaces in the 'name' field."); - - switch($_POST['type']) { - case 'tcp': - case 'http': - case 'https': - case 'dns': { - break; - } - } - - if (!$input_errors) { - $protent = array(); - - if(isset($id) && $a_protocol[$id]) { - $protent = $a_protocol[$id]; - } - - update_if_changed(gettext("name"), $protent['name'], $pconfig['name']); - update_if_changed(gettext("type"), $protent['type'], $pconfig['type']); - update_if_changed(gettext("description"), $protent['descr'], $pconfig['descr']); - update_if_changed(gettext("type"), $protent['type'], $pconfig['type']); - update_if_changed(gettext("action"), $protent['lbaction'], $pconfig['lbaction']); - - if (isset($id) && $a_protocol[$id]) { - /* modify all virtual servers with this name */ -/* - for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) { - if ($config['load_balancer']['virtual_server'][$i]['protocol'] == $a_protocol[$id]['name']) - $config['load_balancer']['virtual_server'][$i]['protocol'] = $protent['name']; - } -*/ - $a_protocol[$id] = $protent; - } else { - $a_protocol[] = $protent; - } - - mark_subsystem_dirty('loadbalancer'); - write_config(); - header("Location: load_balancer_relay_protocol.php"); - exit; - } -} - -$shortcut_section = "relayd"; - -include("head.inc"); - -$types = array("http" => gettext("HTTP"), "tcp" => gettext("TCP"), "dns" => gettext("DNS")); -?> - - - - - -
- -
- -
- 0) print_input_errors($input_errors); ?> - -
- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- size="16" maxlength="16"> -
- -
- size="64"> -
 
- - - - - - - - - -
-
- -
- "; - ?> -
-
-
- " onclick="copyOption($('available_action'), $('lbaction'));" />
- " onclick="deleteOption($('lbaction'));" /> -
-
-
- -
- "; - ?> -
-
-
  - " onClick="AllOptions($('lbaction'), true); AllOptions($('available_action'), false);"> - " onclick="window.location.href=''" /> - - - -
-
-
-
-
-
- - - - -