diff options
-rw-r--r-- | src/conf.default/config.xml | 13 | ||||
-rw-r--r-- | src/etc/inc/config.lib.inc | 1 | ||||
-rw-r--r-- | src/etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | src/etc/inc/interfaces.inc | 175 | ||||
-rw-r--r-- | src/etc/inc/services.inc | 9 | ||||
-rw-r--r-- | src/etc/inc/upgrade_config.inc | 21 | ||||
-rw-r--r-- | src/usr/local/www/diag_confbak.php | 4 | ||||
-rw-r--r-- | src/usr/local/www/head.inc | 17 | ||||
-rw-r--r-- | src/usr/local/www/interfaces.php | 14 | ||||
-rw-r--r-- | src/usr/local/www/interfaces_assign.php | 4 | ||||
-rw-r--r-- | src/usr/local/www/interfaces_ppps_edit.php | 121 | ||||
-rw-r--r-- | src/usr/local/www/interfaces_vlan.php | 9 | ||||
-rw-r--r-- | src/usr/local/www/interfaces_vlan_edit.php | 3 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcpv6.php | 38 | ||||
-rw-r--r-- | src/usr/local/www/status_logs_common.inc | 7 | ||||
-rw-r--r-- | src/usr/local/www/system.php | 7 |
16 files changed, 258 insertions, 187 deletions
diff --git a/src/conf.default/config.xml b/src/conf.default/config.xml index 9e114e0..1cc6b92 100644 --- a/src/conf.default/config.xml +++ b/src/conf.default/config.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <pfsense> - <version>14.4</version> + <version>14.6</version> <lastchange/> <system> <optimization>normal</optimization> @@ -90,6 +90,17 @@ </range> </lan> </dhcpd> + <dhcpdv6> + <lan> + <enable/> + <range> + <from>::1000</from> + <to>::2000</to> + </range> + <ramode>assist</ramode> + <rapriority>medium</rapriority> + </lan> + </dhcpdv6> <snmpd> <syslocation/> <syscontact/> diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc index bead760..65d34bc 100644 --- a/src/etc/inc/config.lib.inc +++ b/src/etc/inc/config.lib.inc @@ -524,6 +524,7 @@ function safe_write_file($file, $content, $force_binary) { * INPUTS * $desc - string containing the a description of configuration changes * $backup - boolean: do not back up current configuration if false. + * $write_config_only - boolean: do not sync or reload anything; just save the configuration if true. * RESULT * null ******/ diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc index 235e14d..fda3529 100644 --- a/src/etc/inc/globals.inc +++ b/src/etc/inc/globals.inc @@ -99,7 +99,7 @@ $g = array( "disablecrashreporter" => false, "crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php", "debug" => false, - "latest_config" => "14.5", + "latest_config" => "14.6", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 86276b5..84b360e 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -51,6 +51,8 @@ * * ==================================================================== * + * function interfaces_wireless_configure is Copyright (C) 2005 Espen Johansen + * */ /* include all configuration functions */ @@ -1755,9 +1757,12 @@ function interface_ppps_configure($interface) { if (!empty($ifcfg['mtu'])) { $defaultmtu = intval($ifcfg['mtu']); } - $mtus = explode(',', $ppp['mtu']); - $mrus = explode(',', $ppp['mru']); - + if (isset($ppp['mtu'])) { + $mtus = explode(',', $ppp['mtu']); + } + if (isset($ppp['mru'])) { + $mrus = explode(',', $ppp['mru']); + } if (isset($ppp['mrru'])) { $mrrus = explode(',', $ppp['mrru']); } @@ -3078,23 +3083,23 @@ function interface_virtual_create($interface) { } } -function interface_vlan_mtu_configured($realhwif, $mtu) { +function interface_vlan_mtu_configured($iface) { global $config; + $mtu = 0; if (is_array($config['vlans']) && is_array($config['vlans']['vlan'])) { foreach ($config['vlans']['vlan'] as $vlan) { - if ($vlan['if'] != $realhwif) { + + if ($vlan['vlanif'] != $iface) continue; - } + $assignedport = convert_real_interface_to_friendly_interface_name($vlan['vlanif']); if (!empty($assignedport) && !empty($config['interfaces'][$assignedport]['mtu'])) { - if (intval($config['interfaces'][$assignedport]['mtu']) > $mtu) { - $mtu = $config['interfaces'][$assignedport]['mtu']; - } - } - $pppoe_mtu = interface_mtu_wanted_for_pppoe($vlan['vlanif']); - if ($pppoe_mtu > $mtu) { - $mtu = $pppoe_mtu; + /* VLAN MTU */ + $mtu = $config['interfaces'][$assignedport]['mtu']; + } elseif (!empty($config['interfaces'][$vlan['if']]['mtu'])) { + /* Parent MTU */ + $mtu = $config['interfaces'][$vlan['if']]['mtu']; } } } @@ -3102,45 +3107,13 @@ function interface_vlan_mtu_configured($realhwif, $mtu) { return $mtu; } -function interface_vlan_adapt_mtu($vlanifs, $mtu) { - global $config; - - if (!is_array($vlanifs)) { - return; - } - - /* All vlans need to use the same mtu value as their parent. */ - foreach ($vlanifs as $vlan) { - $assignedport = convert_real_interface_to_friendly_interface_name($vlan['vlanif']); - $pppoe_mtu = interface_mtu_wanted_for_pppoe($vlan['vlanif']); - $if_mtu = 0; - if (!empty($assignedport) && - !empty($config['interfaces'][$assignedport]['mtu'])) { - $if_mtu = $config['interfaces'][$assignedport]['mtu']; - } else { - $if_mtu = ($pppoe_mtu != 0 ? $pppoe_mtu : $mtu); - } - - if (get_interface_mtu($vlan['vlanif']) != $if_mtu) { - /* LAGG interface must be destroyed and re-created to change MTU */ - if (substr($vlan['if'], 0, 4) == 'lagg') { - interface_vlan_configure($vlan); - } else { - pfSense_interface_mtu($vlan['vlanif'], $if_mtu); - } - } - } -} - function interface_mtu_wanted_for_pppoe($realif) { global $config; - $mtu = 0; - - if (!is_array($config['ppps']) || !is_array($config['ppps']['ppp'])) { - return $mtu; - } + if (!is_array($config['ppps']) || !is_array($config['ppps']['ppp'])) + return 0; + $mtu = 0; foreach ($config['ppps']['ppp'] as $ppp) { if ($ppp['type'] != "pppoe") { continue; @@ -3152,29 +3125,25 @@ function interface_mtu_wanted_for_pppoe($realif) { } $ports = explode(',', $ppp['ports']); - $mtu_wanted = 1500; foreach ($ports as $pid => $port) { - if (get_real_interface($port) != $realif) { + $parentifa = get_parent_interface($port); + $parentif = $parentifa[0]; + if ($parentif != $realif) continue; - } // there is an MTU configured on the port in question if (!empty($mtus[$pid])) { - $mtu_wanted = intval($mtus[$pid]) + 8; + $mtu = intval($mtus[$pid]) + 8; // or use the MTU configured on the interface ... } elseif (is_array($config['interfaces'])) { foreach ($config['interfaces'] as $interface) { if ($interface['if'] == $ppp['if'] && !empty($interface['mtu'])) { - $mtu_wanted = intval($interface['mtu']) + 8; + $mtu = intval($interface['mtu']) + 8; break; } } } - - if ($mtu_wanted > $mtu) { - $mtu = $mtu_wanted; - } } } @@ -3295,33 +3264,17 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven $tunnelif = substr($realif, 0, 3); - if (does_interface_exist($wancfg['if'])) { - interfaces_bring_up($wancfg['if']); - } - $mtuif = $realif; $mtuhwif = $realhwif; - $wantedmtu = 0; /* adjust MTU of parent interface of PPPoE interface if this does not violate explicit configuration */ if (interface_isppp_type($interface)) { $mtuif = $realhwif; $mtuhwif_array = get_parent_interface($mtuif); $mtuhwif = $mtuhwif_array[0]; - $parent_mtu_configured = false; - if (is_array($config['interfaces'])) { - foreach ($config['interfaces'] as $tmpinterface) { - if ($tmpinterface['if'] == $mtuif && !empty($tmpinterface['mtu'])) { - $parent_mtu_configured = true; - break; - } - } - } - if (!$parent_mtu_configured) { - $wantedmtu = interface_mtu_wanted_for_pppoe($mtuif); - } } + $wantedmtu = 0; if (is_array($config['interfaces'])) { foreach ($config['interfaces'] as $tmpinterface) { if ($tmpinterface['if'] == $mtuif && !empty($tmpinterface['mtu'])) { @@ -3331,7 +3284,15 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven } } - // Set the MTU to 1500 if no explicit MTU configured + /* MTU is not specified for interface, try the pppoe settings. */ + if ($wantedmtu == 0) { + $wantedmtu = interface_mtu_wanted_for_pppoe($mtuif); + } + if ($wantedmtu == 0 && stristr($mtuif, "_vlan") && interface_isppp_type($interface)) { + $wantedmtu = interface_mtu_wanted_for_pppoe($mtuhwif); + } + + /* Set the MTU to 1500 if no explicit MTU configured. */ if ($wantedmtu == 0) { $wantedmtu = 1500; /* Default */ } @@ -3345,27 +3306,21 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven } } - $parentmtu = interface_vlan_mtu_configured($mtuhwif, $wantedmtu); + $configuredmtu = interface_vlan_mtu_configured($mtuif); - if (get_interface_mtu($mtuhwif) != $parentmtu) { - /* LAGG interface must be destroyed and re-created to change MTU */ - if (substr($mtuhwif, 0, 4) == 'lagg') { - if (isset($config['laggs']['lagg']) && - is_array($config['laggs']['lagg'])) { - foreach ($config['laggs']['lagg'] as $lagg) { - if ($lagg['laggif'] == $mtuhwif) { - interface_lagg_configure($lagg); - break; - } - } - } - } else { - pfSense_interface_mtu($mtuhwif, $parentmtu); - } - } + if ($configuredmtu != 0 && $configuredmtu > $parentmtu) + $configuredmtu = $parentmtu; + if ($configuredmtu != 0) + $mtu = $configuredmtu; + else + $mtu = $wantedmtu; - /* All vlans need to use the same mtu value as their parent. */ - interface_vlan_adapt_mtu(link_interface_to_vlans($mtuhwif), $parentmtu); + /* Set the parent MTU. */ + if (get_interface_mtu($mtuhwif) < $mtu) + set_interface_mtu($mtuhwif, $mtu); + /* Set the VLAN MTU. */ + if (get_interface_mtu($mtuif) != $mtu) + set_interface_mtu($mtuif, $mtu); } else if (substr($mtuif, 0, 4) == 'lagg') { /* LAGG interface must be destroyed and re-created to change MTU */ if ($wantedmtu != get_interface_mtu($mtuif)) { @@ -3382,16 +3337,13 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven if ($wantedmtu != get_interface_mtu($mtuif)) { pfSense_interface_mtu($mtuif, $wantedmtu); } - - /* This case is needed when the parent of vlans is being configured */ - $vlans = link_interface_to_vlans($mtuif); - if (is_array($vlans)) { - interface_vlan_adapt_mtu($vlans, $wantedmtu); - } - unset($vlans); } /* XXX: What about gre/gif/.. ? */ + if (does_interface_exist($wancfg['if'])) { + interfaces_bring_up($wancfg['if']); + } + switch ($wancfg['ipaddr']) { case 'dhcp': interface_dhcp_configure($interface); @@ -4767,7 +4719,8 @@ function get_real_interface($interface = "wan", $family = "all", $realv6iface = break; } else if (substr($interface, 0, 5) == '_lloc') { $interface = substr($interface, 5); - } else if (does_interface_exist($interface, $flush)) { + } else if (strstr($interface, "_vlan") || + does_interface_exist($interface, $flush)) { /* * If a real interface was already passed simply * pass the real interface back. This encourages @@ -5717,6 +5670,24 @@ function get_wireless_channel_info($interface) { return($wireless_channels); } +function set_interface_mtu($interface, $mtu) { + + /* LAGG interface must be destroyed and re-created to change MTU */ + if (substr($interface, 0, 4) == 'lagg') { + if (isset($config['laggs']['lagg']) && + is_array($config['laggs']['lagg'])) { + foreach ($config['laggs']['lagg'] as $lagg) { + if ($lagg['laggif'] == $interface) { + interface_lagg_configure($lagg); + break; + } + } + } + } else { + pfSense_interface_mtu($interface, $mtu); + } +} + /****f* interfaces/get_interface_mtu * NAME * get_interface_mtu - Return the mtu of an interface diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index f37cf07..90dba13 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -279,6 +279,9 @@ function services_radvd_configure($blacklist = array()) { if (!isset($config['interfaces'][$if]['enable'])) { continue; } + if ($config['dhcpdv6'][$if]['ramode'] == "disabled") { + continue; + } /* Do not put in the config an interface which is down */ if (isset($blacklist[$if])) { continue; @@ -1246,8 +1249,7 @@ function services_dhcpdv6_configure($blacklist = array()) { if (isset($blacklist[$ifname])) { continue; } - if (!empty($config['interfaces'][$ifname]['track6-interface']) && - (empty($dhcpdv6cfg[$ifname]) || !isset($dhcpdv6cfg[$ifname]['enable']))) { + if (!empty($config['interfaces'][$ifname]['track6-interface']) && isset($dhcpdv6cfg[$ifname]['enable'])) { $realif = get_real_interface($ifname, "inet6"); $ifcfgipv6 = get_interface_ipv6($ifname); if (!is_ipaddrv6($ifcfgipv6)) { @@ -1341,6 +1343,9 @@ EOD; continue; } $ifcfgipv6 = get_interface_ipv6($dhcpv6if); + if (!is_ipaddrv6($ifcfgipv6)) { + continue; + } $ifcfgsnv6 = get_interface_subnetv6($dhcpv6if); $subnetv6 = gen_subnetv6($ifcfgipv6, $ifcfgsnv6); diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index 690d6dd..403bc55 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -4571,6 +4571,27 @@ function upgrade_143_to_144() { } function upgrade_144_to_145() { + global $config; + + // Enable DHCPv6 server and radvd config for track6 interfaces, + // matching what used to be automatically enabled with no user + // configurability. + if (is_array($config['interfaces'])) { + foreach ($config['interfaces'] as $ifname => $ifcfg) { + if (isset($ifcfg['enable'])) { + if ($ifcfg['ipaddrv6'] == "track6") { + $config['dhcpdv6'][$ifname]['enable'] = true; + $config['dhcpdv6'][$ifname]['range']['from'] = "::1000"; + $config['dhcpdv6'][$ifname]['range']['to'] = "::2000"; + $config['dhcpdv6'][$ifname]['ramode'] = "assist"; + $config['dhcpdv6'][$ifname]['rapriority'] = "medium"; + } + } + } + } +} + +function upgrade_145_to_146() { // Add standard deviation to the quality rrds global $config, $g; diff --git a/src/usr/local/www/diag_confbak.php b/src/usr/local/www/diag_confbak.php index a6674df..2fe652b 100644 --- a/src/usr/local/www/diag_confbak.php +++ b/src/usr/local/www/diag_confbak.php @@ -304,7 +304,7 @@ endif; ?> </tbody> </table> - </form> -</div> + </div> +</form> <?php include("foot.inc"); diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc index 8318986..114ce81 100644 --- a/src/usr/local/www/head.inc +++ b/src/usr/local/www/head.inc @@ -496,16 +496,21 @@ if (($pagename === "index.php") && ($numColumns > 2)) { </li> <?php endif ?> - <?php if ($system_logs_manage_log_form_hidden): ?> + <?php if ($system_logs_manage_log_form_hidden): + /* If the user does not have access to status logs settings page, then exclude the manage log panel icon from the title bar. */ + if (isAllowedPage("status_logs_settings.php")) { + ?> <li> <a onclick="$('#manage-log-form').toggle(360)" title="<?=gettext("Manage log")?>"> <i class="fa fa-wrench icon-pointer"></i> </a> </li> - <?php endif ?> + <?php } + endif + ?> <?php -if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) { +if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service']) && isAllowedPage('status_services.php')) { $ssvc = array(); switch ($shortcut_section) { case "openvpn": @@ -523,15 +528,15 @@ if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) { } } -if ('' != ($link = get_shortcut_main_link($shortcut_section, false))) { +if (('' != ($link = get_shortcut_main_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['main']))) { echo '<li>' . $link . '</li>'; } -if ('' != ($link = get_shortcut_status_link($shortcut_section, false))) { +if (('' != ($link = get_shortcut_status_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['status']))) { echo '<li>' . $link . '</li>'; } -if ('' != ($link = get_shortcut_log_link($shortcut_section, false))) { +if (('' != ($link = get_shortcut_log_link($shortcut_section, false))) && (isAllowedPage($shortcuts[$shortcut_section]['log']))) { echo '<li>' . $link . '</li>'; } diff --git a/src/usr/local/www/interfaces.php b/src/usr/local/www/interfaces.php index c9a3c16..f80235d 100644 --- a/src/usr/local/www/interfaces.php +++ b/src/usr/local/www/interfaces.php @@ -826,11 +826,13 @@ if ($_POST['apply']) { // Need code to handle MLPPP if we ever use $realhwif for MLPPP handling $parent_realhwif = $realhwif_array[0]; $parent_if = convert_real_interface_to_friendly_interface_name($parent_realhwif); - if (!empty($parent_if) && !empty($config['interfaces'][$parent_if]['mtu'])) { - if ($_POST['mtu'] > intval($config['interfaces'][$parent_if]['mtu'])) { - $input_errors[] = gettext("The MTU of a VLAN cannot be greater than that of its parent interface."); - } - } + $mtu = 0; + if (!empty($parent_if) && !empty($config['interfaces'][$parent_if]['mtu'])) + $mtu = intval($config['interfaces'][$parent_if]['mtu']); + if ($mtu == 0) + $mtu = get_interface_mtu($parent_realhwif); + if ($_POST['mtu'] > $mtu) + $input_errors[] = gettext("The MTU of a VLAN cannot be greater than that of its parent interface."); } else { foreach ($config['interfaces'] as $idx => $ifdata) { if (($idx == $if) || !preg_match('/_vlan[0-9]/', $ifdata['if'])) { @@ -846,7 +848,7 @@ if ($_POST['apply']) { } if (isset($ifdata['mtu']) && $ifdata['mtu'] > $_POST['mtu']) { - $input_errors[] = sprintf(gettext("Interface %s (VLAN) has MTU set to a larger value"), $ifdata['descr']); + $input_errors[] = sprintf(gettext("Interface %s (VLAN) has MTU set to a larger value."), $ifdata['descr']); } } } diff --git a/src/usr/local/www/interfaces_assign.php b/src/usr/local/www/interfaces_assign.php index c6b730a..d99ee04 100644 --- a/src/usr/local/www/interfaces_assign.php +++ b/src/usr/local/www/interfaces_assign.php @@ -80,6 +80,10 @@ function interface_assign_description($portinfo, $portname) { global $ovpn_descrs; if ($portinfo['isvlan']) { $descr = sprintf(gettext('VLAN %1$s on %2$s'), $portinfo['tag'], $portinfo['if']); + $iface = convert_real_interface_to_friendly_interface_name($portinfo['if']); + if (isset($iface) && strlen($iface) > 0) { + $descr .= " - $iface"; + } if ($portinfo['descr']) { $descr .= " (" . $portinfo['descr'] . ")"; } diff --git a/src/usr/local/www/interfaces_ppps_edit.php b/src/usr/local/www/interfaces_ppps_edit.php index 8f06a58..e8b08f8 100644 --- a/src/usr/local/www/interfaces_ppps_edit.php +++ b/src/usr/local/www/interfaces_ppps_edit.php @@ -79,9 +79,7 @@ if (!is_array($config['ppps']['ppp'])) { $a_ppps = &$config['ppps']['ppp']; -$iflist = get_configured_interface_with_descr(); -$portlist = get_interface_list(); -$portlist = array_merge($portlist, $iflist); +$portlist = get_configured_interface_with_descr(); if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) { foreach ($config['vlans']['vlan'] as $vlan) { @@ -89,23 +87,17 @@ if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) { } } -if ($_GET && $_GET['type']) { - $pconfig['type'] = $_GET['type']; +if (isset($_REQUEST['type'])) { + $pconfig['type'] = $_REQUEST['type']; } -if (is_numericint($_GET['id'])) { - $id = $_GET['id']; -} - -if (isset($_POST['id']) && is_numericint($_POST['id'])) { - $id = $_POST['id']; +if (isset($_REQUEST['id']) && is_numericint($_REQUEST['id'])) { + $id = $_REQUEST['id']; } if (isset($id) && $a_ppps[$id]) { - $pconfig['ptpid'] = $a_ppps[$id]['ptpid']; $pconfig['type'] = $a_ppps[$id]['type']; - //$pconfig['if'] = $a_ppps[$id]['if']; - $pconfig['interfaces'] = $a_ppps[$id]['ports']; + $pconfig['interfaces'] = explode(",", $a_ppps[$id]['ports']); $pconfig['username'] = $a_ppps[$id]['username']; $pconfig['password'] = base64_decode($a_ppps[$id]['password']); if (isset($a_ppps[$id]['ondemand'])) { @@ -114,10 +106,18 @@ if (isset($id) && $a_ppps[$id]) { $pconfig['idletimeout'] = $a_ppps[$id]['idletimeout']; $pconfig['uptime'] = $a_ppps[$id]['uptime']; $pconfig['descr'] = $a_ppps[$id]['descr']; - $pconfig['bandwidth'] = explode(",", $a_ppps[$id]['bandwidth']); - $pconfig['mtu'] = explode(",", $a_ppps[$id]['mtu']); - $pconfig['mru'] = explode(",", $a_ppps[$id]['mru']); - $pconfig['mrru'] = explode(",", $a_ppps[$id]['mrru']); + $bandwidth = explode(",", $a_ppps[$id]['bandwidth']); + for ($i = 0; $i < count($bandwidth); $i++) + $pconfig['bandwidth'][$pconfig['interfaces'][$i]] = $bandwidth[$i]; + $mtu = explode(",", $a_ppps[$id]['mtu']); + for ($i = 0; $i < count($mtu); $i++) + $pconfig['mtu'][$pconfig['interfaces'][$i]] = $mtu[$i]; + $mru = explode(",", $a_ppps[$id]['mru']); + for ($i = 0; $i < count($mru); $i++) + $pconfig['mru'][$pconfig['interfaces'][$i]] = $mru[$i]; + $mrru = explode(",", $a_ppps[$id]['mrru']); + for ($i = 0; $i < count($mrru); $i++) + $pconfig['mrru'][$pconfig['interfaces'][$i]] = $mrru[$i]; if (isset($a_ppps[$id]['shortseq'])) { $pconfig['shortseq'] = true; @@ -203,12 +203,9 @@ if (isset($id) && $a_ppps[$id]) { } break; } - -} else { - $pconfig['ptpid'] = interfaces_ptpid_next(); } -if ($_POST) { +if (isset($_POST) && is_array($_POST) && count($_POST) > 0) { unset($input_errors); $pconfig = $_POST; @@ -257,7 +254,13 @@ if ($_POST) { $input_errors[] = gettext("Please choose a Link Type."); break; } - if ($_POST['passwordfld'] != $_POST['passwordfld_confirm']) { + if ($_POST['passwordfld'] == $_POST['passwordfld_confirm']) { + if ($_POST['passwordfld'] != DMYPWD) { + $pconfig['password'] = $_POST['passwordfld']; + } else { + $pconfig['password'] = base64_decode($a_ppps[$id]['password']); + } + } else { $input_errors[] = gettext("Password and confirmed password must match."); } if ($_POST['type'] == "ppp" && count($_POST['interfaces']) > 1) { @@ -296,6 +299,7 @@ if ($_POST) { } } + $port_data = array(); if (is_array($_POST['interfaces'])) { foreach ($_POST['interfaces'] as $iface) { if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) { @@ -314,11 +318,34 @@ if ($_POST) { $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."), $iface); } } + + // Loop through fields associated with an individual link/port and make an array of the data + $port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru"); + foreach ($_POST['interfaces'] as $iface) { + foreach ($port_fields as $field_label) { + if (isset($_POST[$field_label . $iface]) && + strlen($_POST[$field_label . $iface]) > 0) { + $port_data[$field_label][] = $_POST[$field_label . $iface]; + $pconfig[$field_label][$iface] = $_POST[$field_label . $iface]; + $parent_array = get_parent_interface($iface); + $parent = $parent_array[0]; + $friendly = convert_real_interface_to_friendly_interface_name($parent); + if ($field_label == "mtu" && isset($config['interfaces'][$friendly]['mtu']) && + $_POST[$field_label . $iface] > ($config['interfaces'][$friendly]['mtu'] - 8)) { + $input_errors[] = sprintf(gettext("The MTU (%d) is too big for %s (maximum allowed with current settings: %d)."), + $_POST[$field_label . $iface], $iface, $config['interfaces'][$friendly]['mtu'] - 8); + } + } + } + } } if (!$input_errors) { $ppp = array(); - $ppp['ptpid'] = $_POST['ptpid']; + if (!isset($id)) + $ppp['ptpid'] = interfaces_ptpid_next(); + else + $ppp['ptpid'] = $a_ppps[$id]['ptpid']; $ppp['type'] = $_POST['type']; $ppp['if'] = $ppp['type'].$ppp['ptpid']; $ppp['ports'] = implode(',', $_POST['interfaces']); @@ -341,16 +368,6 @@ if ($_POST) { unset($ppp['descr']); } - // Loop through fields associated with an individual link/port and make an array of the data - $port_fields = array("localip", "gateway", "subnet", "bandwidth", "mtu", "mru", "mrru"); - foreach ($_POST['interfaces'] as $iface) { - foreach ($port_fields as $field_label) { - if (isset($_POST[$field_label][$iface])) { - $port_data[$field_label][] = $_POST[$field_label][$iface]; - } - } - } - switch ($_POST['type']) { case "ppp": if (!empty($_POST['initstr'])) { @@ -413,7 +430,9 @@ if ($_POST) { $ppp['protocomp'] = $_POST['protocomp'] ? true : false; $ppp['vjcomp'] = $_POST['vjcomp'] ? true : false; $ppp['tcpmssfix'] = $_POST['tcpmssfix'] ? true : false; - $ppp['bandwidth'] = implode(',', $port_data['bandwidth']); + if (is_array($port_data['bandwidth'])) { + $ppp['bandwidth'] = implode(',', $port_data['bandwidth']); + } if (is_array($port_data['mtu'])) { $ppp['mtu'] = implode(',', $port_data['mtu']); } @@ -876,43 +895,41 @@ $section->addInput(new Form_Checkbox( // Display the Link parameters. We will hide this by default, then un-hide the selected ones on clicking 'Advanced' $j = 0; - -foreach ($linklist['list'] as $ifnm =>$nm) { +foreach ($linklist['list'] as $ifnm => $nm) { $group = new Form_Group('Link Parameters (' . $ifnm . ')'); $group->add(new Form_Input( - 'bandwidth' . $j, + 'bandwidth' . $ifnm, null, 'text', - $pconfig['bandwidth'][$j] + $pconfig['bandwidth'][$ifnm] ))->setHelp('Bandwidth'); $group->add(new Form_Input( - 'mtu' . $j, + 'mtu' . $ifnm, null, 'text', - $pconfig['mtu'][$j] + $pconfig['mtu'][$ifnm] ))->setHelp('MTU'); $group->add(new Form_Input( - 'mru' . $j, + 'mru' . $ifnm, null, 'text', - $pconfig['mru'][$j] + $pconfig['mru'][$ifnm] ))->setHelp('MRU'); $group->add(new Form_Input( - 'mrru' . $j, + 'mrru' . $ifnm, null, 'text', - $pconfig['mrru'][$j] + $pconfig['mrru'][$ifnm] ))->setHelp('MRRU'); $j++; $section->add($group); - $group->addClass('localip sec-advanced')->addClass('linkparam' . $ifnm); } @@ -932,13 +949,6 @@ if (isset($id) && $a_ppps[$id]) { )); } -$section->addInput(new Form_Input( - 'ptpid', - null, - 'hidden', - $ptpid -)); - $form->add($section); print($form); @@ -1006,9 +1016,8 @@ events.push(function() { hideClass('linkparam', true); hideInput('linkparamhelp', true); - var selected = $('#interfaces').val(); - var length = $("#interfaces :selected").length; - + var selected = $(".interfaces").val(); + var length = $(".interfaces :selected").length; for (var i=0; i<length; i++) { hideClass('localip' + selected[i], false); diff --git a/src/usr/local/www/interfaces_vlan.php b/src/usr/local/www/interfaces_vlan.php index 32ba6ed..a78bc55 100644 --- a/src/usr/local/www/interfaces_vlan.php +++ b/src/usr/local/www/interfaces_vlan.php @@ -150,7 +150,14 @@ display_top_tabs($tab_array); foreach ($a_vlans as $vlan) { ?> <tr> - <td><?=htmlspecialchars($vlan['if']);?></td> + <td> +<?php + printf("%s", htmlspecialchars($vlan['if'])); + $iface = convert_real_interface_to_friendly_interface_name($vlan['if']); + if (isset($iface) && strlen($iface) > 0) + printf(" (%s)", htmlspecialchars($iface)); +?> + </td> <td><?=htmlspecialchars($vlan['tag']);?></td> <td><?=htmlspecialchars($vlan['pcp']);?></td> <td><?=htmlspecialchars($vlan['descr']);?></td> diff --git a/src/usr/local/www/interfaces_vlan_edit.php b/src/usr/local/www/interfaces_vlan_edit.php index a6743d0..f281dda 100644 --- a/src/usr/local/www/interfaces_vlan_edit.php +++ b/src/usr/local/www/interfaces_vlan_edit.php @@ -193,6 +193,9 @@ function build_interfaces_list() { foreach ($portlist as $ifn => $ifinfo) { if (is_jumbo_capable($ifn)) { $list[$ifn] = $ifn . " (" . $ifinfo['mac'] . ")"; + $iface = convert_real_interface_to_friendly_interface_name($ifn); + if (isset($iface) && strlen($iface) > 0) + $list[$ifn] .= " - $iface"; } } diff --git a/src/usr/local/www/services_dhcpv6.php b/src/usr/local/www/services_dhcpv6.php index 0a9b2e8..95958d5 100644 --- a/src/usr/local/www/services_dhcpv6.php +++ b/src/usr/local/www/services_dhcpv6.php @@ -596,13 +596,18 @@ $section->addInput(new Form_Checkbox( 'DHCPv6 Server', 'Enable DHCPv6 server on interface ' . $iflist[$if], $pconfig['enable'] -))->toggles('.form-group:not(:first-child)'); +)); if (is_ipaddrv6($ifcfgip)) { + if ($ifcfgip == "::") { + $sntext = "Prefix Delegation"; + } else { + $sntext = gen_subnetv6($ifcfgip, $ifcfgsn); + } $section->addInput(new Form_StaticText( 'Subnet', - gen_subnetv6($ifcfgip, $ifcfgsn) + $sntext )); $section->addInput(new Form_StaticText( @@ -613,7 +618,7 @@ if (is_ipaddrv6($ifcfgip)) { $section->addInput(new Form_StaticText( 'Available Range', $range_from = gen_subnetv6($ifcfgip, $ifcfgsn) . ' to ' . gen_subnetv6_max($ifcfgip, $ifcfgsn) - )); + ))->setHelp($trackifname ? 'Prefix Delegation subnet will be appended to the beginning of the defined range':''); } if ($is_olsr_enabled) { @@ -724,7 +729,7 @@ $section->addInput(new Form_Input( 'Default lease time', 'text', $pconfig['deftime'] -))->setHelp('Seconds . Used for clients that do not ask for a specific expiration time. ' . ' <br />' . +))->setHelp('Lease time in seconds. Used for clients that do not ask for a specific expiration time. ' . ' <br />' . 'The default is 7200 seconds.'); $section->addInput(new Form_Input( @@ -947,11 +952,11 @@ foreach ($pconfig['numberoptions']['item'] as $item) { $btnaddopt = new Form_Button( - 'addrowt', + 'addrow', 'Add Option' ); -$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm')->addClass('adnloptions'); +$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm'); $section->addInput($btnaddopt); @@ -972,7 +977,7 @@ print_info_box( gettext('The DNS servers entered in %1$sSystem: General setup%3$s (or the %2$sDNS forwarder%3$s if enabled) will be assigned to clients by the DHCP server.'), '<a href="system.php">', '<a href="services_dnsmasq.php"/>', - '</a>') . + '</a>') . '<br />' . sprintf( gettext('The DHCP lease table can be viewed on the %1$sStatus: DHCPv6 leases%2$s page.'), @@ -1107,10 +1112,24 @@ events.push(function() { // Show additional controls $("#btnadnl").click(function() { hideClass('adnloptions', false); - hideInput('btnaddopt', false); + hideInput('addrow', false); + checkLastRow(); }); + $('#enable').click(function() { + do_toggle(); + }); + + function do_toggle() { + if ($('#enable').prop('checked')) { + $('.form-group:not(:first-child)').show(); + } else { + $('.form-group:not(:first-child)').hide(); + } + } + // On initial load + do_toggle(); hideDDNS(true); hideClass('ntpclass', true); hideInput('tftp', true); @@ -1118,7 +1137,8 @@ events.push(function() { hideInput('bootfile_url', true); hideCheckbox('shownetboot', true); hideClass('adnloptions', <?php echo json_encode($noopts); ?>); - hideInput('btnaddopt', true); + hideInput('addrow', true); + }); //]]> </script> diff --git a/src/usr/local/www/status_logs_common.inc b/src/usr/local/www/status_logs_common.inc index 3cc9157..89b6828 100644 --- a/src/usr/local/www/status_logs_common.inc +++ b/src/usr/local/www/status_logs_common.inc @@ -777,6 +777,11 @@ function manage_log_code() { # Manage Log Section/Form function manage_log_section() { + /* If the user does not have access to status logs settings page, then exclude the manage log panel from the page. */ + if (!isAllowedPage("status_logs_settings.php")) { + return; + } + global $input_errors, $allowed_logs, $logfile, $config, $pconfig; global $system_logs_manage_log_form_hidden; @@ -785,7 +790,7 @@ function manage_log_section() { $manage_log_active = true; } - if ($filter_active) { + if ($manage_log_active) { $panel_state = 'in'; $panel_body_state = SEC_OPEN; } else { diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php index 7f4cce3..61e44c2 100644 --- a/src/usr/local/www/system.php +++ b/src/usr/local/www/system.php @@ -180,6 +180,9 @@ if ($_POST) { for ($dnscounter=1; $dnscounter<5; $dnscounter++) { $dnsname="dns{$dnscounter}"; $dnsgwname="dns{$dnscounter}gw"; + if ($_POST[$dnsname]) { + $dnslist[] = $_POST[$dnsname]; + } if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) { $input_errors[] = sprintf(gettext("A valid IP address must be specified for DNS server %s."), $dnscounter); } else { @@ -200,6 +203,10 @@ if ($_POST) { } } + if (count(array_filter($dnslist)) != count(array_unique(array_filter($dnslist)))) { + $input_errors[] = gettext('Each configured DNS server must have a unique IP address. Remove the duplicated IP.'); + } + $direct_networks_list = explode(" ", filter_get_direct_networks_list()); for ($dnscounter=1; $dnscounter<5; $dnscounter++) { $dnsitem = "dns{$dnscounter}"; |