. 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. */ /* pfSense_MODULE: routing */ ##|+PRIV ##|*IDENT=page-services-loadbalancer-relay-protocol-edit ##|*NAME=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* ##|-PRIV require("guiconfig.inc"); if (!is_array($config['load_balancer']['lbprotocol'])) { $config['load_balancer']['lbprotocol'] = array(); } $a_protocol = &$config['load_balancer']['lbprotocol']; if (isset($_POST['id'])) $id = $_POST['id']; else $id = $_GET['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'; } $changedesc = gettext("Load Balancer: Relay Protocol:") . " "; $changecount = 0; if ($_POST) { $changecount++; 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]; if($protent['name'] != "") $changedesc .= " " . sprintf(gettext("modified '%s' load balancing protocol:"), $protent['name']); 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; } if ($changecount > 0) { /* Mark config dirty */ mark_subsystem_dirty('loadbalancer'); write_config($changedesc); } header("Location: load_balancer_relay_protocol.php"); exit; } } $pgtitle = array(gettext("Services"), gettext("Load Balancer"),gettext("Relay Protocol"),gettext("Edit")); #$statusurl = "status_lb_vs.php"; $statusurl = "status_lb_pool.php"; $logurl = "diag_logs_relayd.php"; include("head.inc"); $types = array("http" => gettext("HTTP"), "tcp" => gettext("TCP"), "dns" => gettext("DNS")); ?>