. 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"); $wancfg = &$config['interfaces']['wan']; $optcfg = &$config['interfaces']['wan']; $pconfig['username'] = $config['pppoe']['username']; $pconfig['password'] = $config['pppoe']['password']; $pconfig['provider'] = $config['pppoe']['provider']; $pconfig['pppoe_dialondemand'] = isset($config['pppoe']['ondemand']); $pconfig['pppoe_idletimeout'] = $config['pppoe']['timeout']; $pconfig['pptp_username'] = $config['pptp']['username']; $pconfig['pptp_password'] = $config['pptp']['password']; $pconfig['pptp_local'] = $config['pptp']['local']; $pconfig['pptp_subnet'] = $config['pptp']['subnet']; $pconfig['pptp_remote'] = $config['pptp']['remote']; $pconfig['pptp_dialondemand'] = isset($config['pptp']['ondemand']); $pconfig['pptp_idletimeout'] = $config['pptp']['timeout']; $pconfig['disableftpproxy'] = isset($wancfg['disableftpproxy']); $pconfig['bigpond_username'] = $config['bigpond']['username']; $pconfig['bigpond_password'] = $config['bigpond']['password']; $pconfig['bigpond_authserver'] = $config['bigpond']['authserver']; $pconfig['bigpond_authdomain'] = $config['bigpond']['authdomain']; $pconfig['bigpond_minheartbeatinterval'] = $config['bigpond']['minheartbeatinterval']; $pconfig['dhcphostname'] = $wancfg['dhcphostname']; if ($wancfg['ipaddr'] == "dhcp") { $pconfig['type'] = "DHCP"; } else if ($wancfg['ipaddr'] == "pppoe") { $pconfig['type'] = "PPPoE"; } else if ($wancfg['ipaddr'] == "pptp") { $pconfig['type'] = "PPTP"; } else if ($wancfg['ipaddr'] == "bigpond") { $pconfig['type'] = "BigPond"; } else { $pconfig['type'] = "Static"; $pconfig['ipaddr'] = $wancfg['ipaddr']; $pconfig['subnet'] = $wancfg['subnet']; $pconfig['gateway'] = $config['interfaces']['wan']['gateway']; $pconfig['pointtopoint'] = $wancfg['pointtopoint']; } $pconfig['blockpriv'] = isset($wancfg['blockpriv']); $pconfig['blockbogons'] = isset($wancfg['blockbogons']); $pconfig['spoofmac'] = $wancfg['spoofmac']; $pconfig['mtu'] = $wancfg['mtu']; /* Wireless interface? */ if (isset($wancfg['wireless'])) { require("interfaces_wlan.inc"); wireless_config_init(); } if ($_POST) { unset($input_errors); $pconfig = $_POST; /* input validation */ if ($_POST['type'] == "Static") { $reqdfields = explode(" ", "ipaddr subnet gateway"); $reqdfieldsn = explode(",", "IP address,Subnet bit count,Gateway"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } else if ($_POST['type'] == "PPPoE") { if ($_POST['pppoe_dialondemand']) { $reqdfields = explode(" ", "username password pppoe_dialondemand pppoe_idletimeout"); $reqdfieldsn = explode(",", "PPPoE username,PPPoE password,Dial on demand,Idle timeout value"); } else { $reqdfields = explode(" ", "username password"); $reqdfieldsn = explode(",", "PPPoE username,PPPoE password"); } do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } else if ($_POST['type'] == "PPTP") { if ($_POST['pptp_dialondemand']) { $reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote pptp_dialondemand pptp_idletimeout"); $reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address,Dial on demand,Idle timeout value"); } else { $reqdfields = explode(" ", "pptp_username pptp_password pptp_local pptp_subnet pptp_remote"); $reqdfieldsn = explode(",", "PPTP username,PPTP password,PPTP local IP address,PPTP subnet,PPTP remote IP address"); } do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } else if ($_POST['type'] == "BigPond") { $reqdfields = explode(" ", "bigpond_username bigpond_password"); $reqdfieldsn = explode(",", "BigPond username,BigPond password"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ $_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac'])); 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 (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) { $input_errors[] = "A valid gateway must be specified."; } if (($_POST['pointtopoint'] && !is_ipaddr($_POST['pointtopoint']))) { $input_errors[] = "A valid point-to-point IP address must be specified."; } if (($_POST['provider'] && !is_domain($_POST['provider']))) { $input_errors[] = "The service name contains invalid characters."; } if (($_POST['pppoe_idletimeout'] != "") && !is_numericint($_POST['pppoe_idletimeout'])) { $input_errors[] = "The idle timeout value must be an integer."; } if (($_POST['pptp_local'] && !is_ipaddr($_POST['pptp_local']))) { $input_errors[] = "A valid PPTP local IP address must be specified."; } if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet']))) { $input_errors[] = "A valid PPTP subnet bit count must be specified."; } if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']))) { $input_errors[] = "A valid PPTP remote IP address must be specified."; } if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout'])) { $input_errors[] = "The idle timeout value must be an integer."; } if (($_POST['bigpond_authserver'] && !is_domain($_POST['bigpond_authserver']))) { $input_errors[] = "The authentication server name contains invalid characters."; } if (($_POST['bigpond_authdomain'] && !is_domain($_POST['bigpond_authdomain']))) { $input_errors[] = "The authentication domain name contains invalid characters."; } if ($_POST['bigpond_minheartbeatinterval'] && !is_numericint($_POST['bigpond_minheartbeatinterval'])) { $input_errors[] = "The minimum heartbeat interval must be an integer."; } if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) { $input_errors[] = "A valid MAC address must be specified."; } if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) { $input_errors[] = "The MTU must be between 576 and 1500 bytes."; } /* Wireless interface? */ if (isset($wancfg['wireless'])) { $wi_input_errors = wireless_config_post(); if ($wi_input_errors) { $input_errors = array_merge($input_errors, $wi_input_errors); } } if (!$input_errors) { $bridge = discover_bridge($wancfg['if'], filter_translate_type_to_real_interface($wancfg['bridge'])); if($bridge <> "-1") { destroy_bridge($bridge); } unset($wancfg['ipaddr']); unset($wancfg['subnet']); unset($config['interfaces']['wan']['gateway']); unset($wancfg['pointtopoint']); unset($wancfg['dhcphostname']); unset($config['pppoe']['username']); unset($config['pppoe']['password']); unset($config['pppoe']['provider']); unset($config['pppoe']['ondemand']); unset($config['pppoe']['timeout']); unset($config['pptp']['username']); unset($config['pptp']['password']); unset($config['pptp']['local']); unset($config['pptp']['subnet']); unset($config['pptp']['remote']); unset($config['pptp']['ondemand']); unset($config['pptp']['timeout']); unset($config['bigpond']['username']); unset($config['bigpond']['password']); unset($config['bigpond']['authserver']); unset($config['bigpond']['authdomain']); unset($config['bigpond']['minheartbeatinterval']); unset($wancfg['disableftpproxy']); /* per interface pftpx helper */ if($_POST['disableftpproxy'] == "yes") { $wancfg['disableftpproxy'] = true; system_start_ftp_helpers(); } else { system_start_ftp_helpers(); } if ($_POST['type'] == "Static") { $wancfg['ipaddr'] = $_POST['ipaddr']; $wancfg['subnet'] = $_POST['subnet']; $config['interfaces']['wan']['gateway'] = $_POST['gateway']; if (isset($wancfg['ispointtopoint'])) $wancfg['pointtopoint'] = $_POST['pointtopoint']; } else if ($_POST['type'] == "DHCP") { $wancfg['ipaddr'] = "dhcp"; $wancfg['dhcphostname'] = $_POST['dhcphostname']; } else if ($_POST['type'] == "PPPoE") { $wancfg['ipaddr'] = "pppoe"; $config['pppoe']['username'] = $_POST['username']; $config['pppoe']['password'] = $_POST['password']; $config['pppoe']['provider'] = $_POST['provider']; $config['pppoe']['ondemand'] = $_POST['pppoe_dialondemand'] ? true : false; $config['pppoe']['timeout'] = $_POST['pppoe_idletimeout']; } else if ($_POST['type'] == "PPTP") { $wancfg['ipaddr'] = "pptp"; $config['pptp']['username'] = $_POST['pptp_username']; $config['pptp']['password'] = $_POST['pptp_password']; $config['pptp']['local'] = $_POST['pptp_local']; $config['pptp']['subnet'] = $_POST['pptp_subnet']; $config['pptp']['remote'] = $_POST['pptp_remote']; $config['pptp']['ondemand'] = $_POST['pptp_dialondemand'] ? true : false; $config['pptp']['timeout'] = $_POST['pptp_idletimeout']; } else if ($_POST['type'] == "BigPond") { $wancfg['ipaddr'] = "bigpond"; $config['bigpond']['username'] = $_POST['bigpond_username']; $config['bigpond']['password'] = $_POST['bigpond_password']; $config['bigpond']['authserver'] = $_POST['bigpond_authserver']; $config['bigpond']['authdomain'] = $_POST['bigpond_authdomain']; $config['bigpond']['minheartbeatinterval'] = $_POST['bigpond_minheartbeatinterval']; } if($_POST['blockpriv'] == "yes") $wancfg['blockpriv'] = true; else unset($wancfg['blockpriv']); if($_POST['blockbogons'] == "yes") $wancfg['blockbogons'] = true; else unset($wancfg['blockbogons']); $wancfg['spoofmac'] = $_POST['spoofmac']; $wancfg['mtu'] = $_POST['mtu']; write_config(); $retval = 0; $savemsg = get_std_save_message($retval); } } $pgtitle = "Interfaces: WAN"; include("head.inc"); ?>
=$pgtitle?>