#!/usr/local/bin/php . 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("guiconfig.inc"); unset($index); if ($_GET['index']) $index = (int)$_GET['index']; else if ($_POST['index']) $index = (int)$_POST['index']; if (!$index) exit; $optcfg = &$config['interfaces']['opt' . $index]; $pconfig['descr'] = $optcfg['descr']; $pconfig['bridge'] = $optcfg['bridge']; $pconfig['ipaddr'] = $optcfg['ipaddr']; $pconfig['subnet'] = $optcfg['subnet']; $pconfig['enable'] = isset($optcfg['enable']); if (ipv6enabled()) { $pconfig['ipv6ra'] = isset($optcfg['ipv6ra']); $pconfig['ipv6ramtu'] = $optcfg['ipv6ramtu']; if (isset($optcfg['ipv6rao'])) { $pconfig['raflags'] = "Other"; } else if (isset($optcfg['ipv6ram'])) { $pconfig['raflags'] = "Managed"; } else { $pconfig['raflags'] = "None"; } if ($optcfg['ipaddr6'] == "6to4") { $pconfig['ipv6mode'] = "6to4"; } else if ($optcfg['ipaddr6'] == "DHCP-PD") { $pconfig['ipv6mode'] = "DHCP-PD"; $pconfig['slalen'] = $optcfg['slalen']; $pconfig['slaid'] = $optcfg['slaid']; } else if ($optcfg['ipaddr6']) { $pconfig['ipaddr6'] = $optcfg['ipaddr6']; $pconfig['subnet6'] = $optcfg['subnet6']; $pconfig['ipv6mode'] = "static"; } else { $pconfig['ipv6mode'] = "disabled"; } } if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ if ($_POST['enable']) { /* description unique? */ for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { if ($i != $index) { if ($config['interfaces']['opt' . $i]['descr'] == $_POST['descr']) { $input_errors[] = "An interface with the specified description already exists."; } } } if ($_POST['bridge']) { /* captive portal on? */ if (isset($config['captiveportal']['enable'])) { $input_errors[] = "Interfaces cannot be bridged while the captive portal is enabled."; } } else { $reqdfields = explode(" ", "descr ipaddr subnet"); $reqdfieldsn = explode(",", "Description,IP address,Subnet bit count"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) { $input_errors[] = "A valid IP address must be specified."; } if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) { $input_errors[] = "A valid subnet bit count must be specified."; } if (ipv6enabled()) { if ($_POST['ipv6mode'] == "static" && !is_ipaddr6($_POST['ipaddr6'])) { $input_errors[] = "A valid IPv6 address must be specified."; } if ($_POST['ipv6ramtu'] && ($_POST['ipv6ramtu'] < 56 || $_POST['ipv6ramtu'] > 1500)) { $input_errors[] = "A valid RA MTU must be specified (56 - 1500)."; } } } } else { // Scheduler: delete matching jobs croen_update_job(Array('interface-enable', 'interface-disable'), 'opt'.$index); } if (!$input_errors) { $optcfg['descr'] = $_POST['descr']; $optcfg['ipaddr'] = $_POST['ipaddr']; $optcfg['subnet'] = $_POST['subnet']; $optcfg['bridge'] = $_POST['bridge']; $optcfg['enable'] = $_POST['enable'] ? true : false; if (ipv6enabled()) { if ($_POST['raflags'] == "Managed") { unset($optcfg['ipv6rao']); $optcfg['ipv6ram'] = true; } else if ($_POST['raflags'] == "Other") { unset($optcfg['ipv6ram']); $optcfg['ipv6rao'] = true; } else if ($_POST['raflags'] == "None") { unset($optcfg['ipv6rao']); unset($optcfg['ipv6ram']); } if ($_POST['ipv6mode'] == "6to4") { $optcfg['ipaddr6'] = "6to4"; unset($optcfg['subnet6']); $optcfg['ipv6ra'] = $_POST['ipv6ra'] ? true : false; $optcfg['ipv6ram'] = $_POST['ipv6ram'] ? true : false; $optcfg['ipv6ramtu'] = $_POST['ipv6ramtu']; $optcfg['ipv6rao'] = $_POST['ipv6rao'] ? true : false; } else if ($_POST['ipv6mode'] == "DHCP-PD") { $optcfg['ipaddr6'] = "DHCP-PD"; unset($optcfg['subnet6']); unset($optcfg['slaid']); if ($_POST['slaid'] != null) $optcfg['slaid'] = $_POST['slaid']; $optcfg['slalen'] = 64 - $_POST['ispfix']; $pconfig['slalen'] = 64 - $_POST['ispfix']; $optcfg['ipv6ra'] = $_POST['ipv6ra'] ? true : false; $optcfg['ipv6ramtu'] = $_POST['ipv6ramtu']; } else if ($_POST['ipv6mode'] == "static") { $optcfg['ipaddr6'] = $_POST['ipaddr6']; $optcfg['subnet6'] = $_POST['subnet6']; $optcfg['ipv6ra'] = $_POST['ipv6ra'] ? true : false; $optcfg['ipv6ram'] = $_POST['ipv6ram'] ? true : false; $optcfg['ipv6ramtu'] = $_POST['ipv6ramtu']; $optcfg['ipv6rao'] = $_POST['ipv6rao'] ? true : false; } else { unset($optcfg['ipaddr6']); unset($optcfg['subnet6']); unset($optcfg['ipv6ra']); unset($optcfg['ipv6ramtu']); } } write_config(); $retval = 0; if (!file_exists($d_sysrebootreqd_path)) { config_lock(); $retval = interfaces_optional_configure(); /* is this the captive portal interface? */ if (isset($config['captiveportal']['enable']) && ($config['captiveportal']['interface'] == ('opt' . $index))) { captiveportal_configure(); } config_unlock(); } $savemsg = get_std_save_message($retval); } } $pgtitle = array("Interfaces", "Optional $index (" . htmlspecialchars($optcfg['descr']) . ")"); ?>
  onClick="enable_change(false)"> Enable Optional interface
Description
Enter a description (name) for the interface here.
IP configuration
Bridge with
IP address /
IPv6 mode
Choosing 6to4 on an optional interface will make it use the next available /64 prefix within the WAN interface's 6to4 prefix (which is determined by its current IPv4 address).
IPv6 address /
IPv6 Prefix Delegation /
Select site-level aggregator ID and ISP prefix length (decimal notation).
If ID is 10 and the client is delegated an IPv6 prefix 2001:db8:ffff and prefix 64, this will result in a single IPv6 prefix, 2001:db8:ffff:A::/64 .
IPv6 RA > Send IPv6 router advertisements
If this option is checked, other hosts on this interface will be able to automatically configure their IPv6 address based on prefix and gateway information that the firewall provides to them. This option should normally be enabled.
Flags
If Managed is selected, other hosts on this interface will use DHCPv6 for BOTH address and non address allocation configuration.
If Other is selected, other hosts on this interface will use DHCPv6 for non address allocation only, like DNS.
MTU bytes
Enter the MTU you want advertised here.
 
  Note:
be sure to add firewall rules to permit traffic through the interface.
Optional has been disabled because there is no OPT interface.