summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Nelson <robertn@the-nelsons.org>2015-03-26 09:19:07 -0700
committerRobert Nelson <robertn@the-nelsons.org>2015-03-26 09:19:07 -0700
commitad20e46dcea5234f19a6d9b8dd93dec00b1160ee (patch)
treedcaa74e0ee21ced741eeafcbccdb220b5e432418
parent52cbfd455ab209a918817501cda618ec3b1886d6 (diff)
parent86feced0f3734e015e70a0e8d85e9b5fed233524 (diff)
downloadpfsense-ad20e46dcea5234f19a6d9b8dd93dec00b1160ee.zip
pfsense-ad20e46dcea5234f19a6d9b8dd93dec00b1160ee.tar.gz
Merge branch 'master' into rfc2136_ignore_ipv4_ipv6
-rw-r--r--etc/inc/interfaces.inc137
-rw-r--r--etc/inc/service-utils.inc2
-rw-r--r--etc/inc/system.inc7
-rw-r--r--etc/inc/unbound.inc13
-rwxr-xr-xetc/rc.openvpn12
-rw-r--r--usr/local/www/diag_dns.php10
-rw-r--r--usr/local/www/diag_logs_settings.php8
-rw-r--r--usr/local/www/diag_ping.php8
-rw-r--r--usr/local/www/diag_testport.php8
-rw-r--r--usr/local/www/diag_traceroute.php8
-rw-r--r--usr/local/www/getserviceproviders.php2
-rwxr-xr-xusr/local/www/graph.php2
-rw-r--r--usr/local/www/graph_cpu.php2
-rw-r--r--usr/local/www/installer/installer.php5
-rw-r--r--usr/local/www/interfaces.php11
-rw-r--r--usr/local/www/status_dhcp_leases.php22
16 files changed, 139 insertions, 118 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 4d27a0e..5ab4d3c 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -1301,6 +1301,8 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg =
}
sleep(3);
unlink_if_exists("{$g['varetc_path']}/dhcp6c_{$interface}.conf");
+ unlink_if_exists("{$g['varetc_path']}/dhcp6c_{$interface}_script.sh");
+ unlink_if_exists("{$g['varetc_path']}/rtsold_{$realifv6}_script.sh");
if (does_interface_exist($realifv6)) {
$ip6 = find_interface_ipv6($realifv6);
if (is_ipaddrv6($ip6) && $ip6 != "::") {
@@ -3770,73 +3772,72 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) {
$wanif = get_real_interface($interface, "inet6");
$dhcp6cconf = "";
- $dhcp6cconf .= "interface {$wanif} {\n";
-
- /* for SLAAC interfaces we do fire off a dhcp6 client for just our name servers */
- if ($wancfg['ipaddrv6'] == "slaac") {
- $dhcp6cconf .= " information-only;\n";
- $dhcp6cconf .= " request domain-name-servers;\n";
- $dhcp6cconf .= " request domain-name;\n";
- $dhcp6cconf .= " script \"{$g['varetc_path']}/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
- $dhcp6cconf .= "};\n";
+
+ if ($wancfg['adv_dhcp6_config_file_override']) {
+ // DHCP6 Config File Override
+ $dhcp6cconf = DHCP6_Config_File_Override($wancfg, $wanif);
+ } elseif ($wancfg['adv_dhcp6_config_advanced']) {
+ // DHCP6 Config File Advanced
+ $dhcp6cconf = DHCP6_Config_File_Advanced($interface, $wancfg, $wanif);
} else {
- $trackiflist = array();
- $iflist = link_interface_to_track6($interface);
- foreach ($iflist as $ifname => $ifcfg) {
- if (is_numeric($ifcfg['track6-prefix-id'])) {
- $trackiflist[$ifname] = $ifcfg;
+ // DHCP6 Config File Basic
+ $dhcp6cconf .= "interface {$wanif} {\n";
+
+ /* for SLAAC interfaces we do fire off a dhcp6 client for just our name servers */
+ if ($wancfg['ipaddrv6'] == "slaac") {
+ $dhcp6cconf .= "\tinformation-only;\n";
+ $dhcp6cconf .= "\trequest domain-name-servers;\n";
+ $dhcp6cconf .= "\trequest domain-name;\n";
+ $dhcp6cconf .= "\tscript \"{$g['varetc_path']}/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
+ $dhcp6cconf .= "};\n";
+ } else {
+ $trackiflist = array();
+ $iflist = link_interface_to_track6($interface);
+ foreach ($iflist as $ifname => $ifcfg) {
+ if (is_numeric($ifcfg['track6-prefix-id'])) {
+ $trackiflist[$ifname] = $ifcfg;
+ }
}
- }
-
- /* skip address request if this is set */
- if (!isset($wancfg['dhcp6prefixonly'])) {
- $dhcp6cconf .= " send ia-na 0; # request stateful address\n";
- }
- if (is_numeric($wancfg['dhcp6-ia-pd-len']) && !empty($trackiflist)) {
- $dhcp6cconf .= " send ia-pd 0; # request prefix delegation\n";
- }
-
- $dhcp6cconf .= "\trequest domain-name-servers;\n";
- $dhcp6cconf .= "\trequest domain-name;\n";
- $dhcp6cconf .= "\tscript \"{$g['varetc_path']}/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
- $dhcp6cconf .= "};\n";
+ /* skip address request if this is set */
+ if (!isset($wancfg['dhcp6prefixonly'])) {
+ $dhcp6cconf .= "\tsend ia-na 0;\t# request stateful address\n";
+ }
+ if (is_numeric($wancfg['dhcp6-ia-pd-len']) && !empty($trackiflist)) {
+ $dhcp6cconf .= "\tsend ia-pd 0;\t# request prefix delegation\n";
+ }
- if (!isset($wancfg['dhcp6prefixonly'])) {
- $dhcp6cconf .= "id-assoc na 0 { };\n";
- }
+ $dhcp6cconf .= "\trequest domain-name-servers;\n";
+ $dhcp6cconf .= "\trequest domain-name;\n";
+ $dhcp6cconf .= "\tscript \"{$g['varetc_path']}/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
+ $dhcp6cconf .= "};\n";
- if (is_numeric($wancfg['dhcp6-ia-pd-len']) && !empty($trackiflist)) {
- /* Setup the prefix delegation */
- $dhcp6cconf .= "id-assoc pd 0 {\n";
- $preflen = 64 - $wancfg['dhcp6-ia-pd-len'];
- if (isset($wancfg['dhcp6-ia-pd-send-hint'])) {
- $dhcp6cconf .= " prefix ::/{$preflen} infinity;\n";
+ if (!isset($wancfg['dhcp6prefixonly'])) {
+ $dhcp6cconf .= "id-assoc na 0 { };\n";
}
- foreach ($trackiflist as $friendly => $ifcfg) {
- if ($g['debug']) {
- log_error("setting up $ifdescr - {$ifcfg['track6-prefix-id']}");
+
+ if (is_numeric($wancfg['dhcp6-ia-pd-len']) && !empty($trackiflist)) {
+ /* Setup the prefix delegation */
+ $dhcp6cconf .= "id-assoc pd 0 {\n";
+ $preflen = 64 - $wancfg['dhcp6-ia-pd-len'];
+ if (isset($wancfg['dhcp6-ia-pd-send-hint'])) {
+ $dhcp6cconf .= "\tprefix ::/{$preflen} infinity;\n";
}
- $realif = get_real_interface($friendly);
- $dhcp6cconf .= " prefix-interface {$realif} {\n";
- $dhcp6cconf .= " sla-id {$ifcfg['track6-prefix-id']};\n";
- $dhcp6cconf .= " sla-len {$wancfg['dhcp6-ia-pd-len']};\n";
- $dhcp6cconf .= " };\n";
+ foreach ($trackiflist as $friendly => $ifcfg) {
+ if ($g['debug']) {
+ log_error("setting up $ifdescr - {$ifcfg['track6-prefix-id']}");
+ }
+ $realif = get_real_interface($friendly);
+ $dhcp6cconf .= "\tprefix-interface {$realif} {\n";
+ $dhcp6cconf .= "\t\tsla-id {$ifcfg['track6-prefix-id']};\n";
+ $dhcp6cconf .= "\t\tsla-len {$wancfg['dhcp6-ia-pd-len']};\n";
+ $dhcp6cconf .= "\t};\n";
+ }
+ unset($preflen, $iflist, $ifcfg, $ifname);
+ $dhcp6cconf .= "};\n";
}
- unset($preflen, $iflist, $ifcfg, $ifname);
- $dhcp6cconf .= "};\n";
+ unset($trackiflist);
}
- unset($trackiflist);
- }
-
- // DHCP6 Config File Advanced
- if ($wancfg['adv_dhcp6_config_advanced']) {
- $dhcp6cconf = DHCP6_Config_File_Advanced($interface, $wancfg, $wanif);
- }
-
- // DHCP6 Config File Override
- if ($wancfg['adv_dhcp6_config_file_override']) {
- $dhcp6cconf = DHCP6_Config_File_Override($wancfg, $wanif);
}
/* wide-dhcp6c works for now. */
@@ -4052,10 +4053,14 @@ function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif) {
function DHCP6_Config_File_Override($wancfg, $wanif) {
- $dhcp6cconf = file_get_contents($wancfg['adv_dhcp6_config_file_override_path']);
- $dhcp6cconf = DHCP6_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf);
+ $dhcp6cconf = @file_get_contents($wancfg['adv_dhcp6_config_file_override_path']);
- return $dhcp6cconf;
+ if ($dhcp6cconf === false) {
+ log_error("Error: cannot open {$wancfg['adv_dhcp6_config_file_override_path']} in DHCP6_Config_File_Override() for reading.\n");
+ return '';
+ } else {
+ return DHCP6_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf);;
+ }
}
@@ -4231,10 +4236,14 @@ function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) {
function DHCP_Config_File_Override($wancfg, $wanif) {
- $dhclientconf = file_get_contents($wancfg['adv_dhcp_config_file_override_path']);
- $dhclientconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf);
+ $dhclientconf = @file_get_contents($wancfg['adv_dhcp_config_file_override_path']);
- return $dhclientconf;
+ if ($dhclientconf === false) {
+ log_error("Error: cannot open {$wancfg['adv_dhcp_config_file_override_path']} in DHCP_Config_File_Override() for reading.\n");
+ return '';
+ } else {
+ return DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf);
+ }
}
diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc
index 8323924..b5e9675 100644
--- a/etc/inc/service-utils.inc
+++ b/etc/inc/service-utils.inc
@@ -264,7 +264,7 @@ function get_services() {
if (isset($config['unbound']['enable'])) {
$pconfig = array();
$pconfig['name'] = "unbound";
- $pconfig['description'] = gettext("Unbound DNS Resolver");
+ $pconfig['description'] = gettext("DNS Resolver");
$services[] = $pconfig;
}
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 1cfdfb5..2428631 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -176,15 +176,16 @@ function system_resolvconf_generate($dynupdate = false) {
}
}
} else {
+ $ns = array();
// Do not create blank search/domain lines, it can break tools like dig.
if ($syscfg['domain']) {
$resolvconf .= "search {$syscfg['domain']}\n";
}
}
if (is_array($syscfg['dnsserver'])) {
- foreach ($syscfg['dnsserver'] as $ns) {
- if ($ns) {
- $resolvconf .= "nameserver $ns\n";
+ foreach ($syscfg['dnsserver'] as $sys_dnsserver) {
+ if ($sys_dnsserver && (!in_array($sys_dnsserver, $ns)) {
+ $resolvconf .= "nameserver $sys_dnsserver\n";
}
}
}
diff --git a/etc/inc/unbound.inc b/etc/inc/unbound.inc
index 22abb5d..914dd49b4 100644
--- a/etc/inc/unbound.inc
+++ b/etc/inc/unbound.inc
@@ -233,7 +233,7 @@ EOF;
$verbosity = isset($config['unbound']['log_verbosity']) ? $config['unbound']['log_verbosity'] : 1;
$use_caps = isset($config['unbound']['use_caps']) ? "yes" : "no";
- // Set up forwarding if it configured
+ // Set up forwarding if it is configured
if (isset($config['unbound']['forwarding'])) {
$dnsservers = array();
if (isset($config['system']['dnsallowoverride'])) {
@@ -243,12 +243,11 @@ EOF;
$dnsservers[] = $nameserver;
}
}
- } else {
- $ns = array_unique(get_dns_servers());
- foreach ($ns as $nameserver) {
- if ($nameserver) {
- $dnsservers[] = $nameserver;
- }
+ }
+ $sys_dnsservers = array_unique(get_dns_servers());
+ foreach ($sys_dnsservers as $sys_dnsserver) {
+ if ($sys_dnsserver && (!in_array($sys_dnsserver, $ns))) {
+ $dnsservers[] = $sys_dnsserver;
}
}
diff --git a/etc/rc.openvpn b/etc/rc.openvpn
index 96a80a0..ce5ea96 100755
--- a/etc/rc.openvpn
+++ b/etc/rc.openvpn
@@ -49,14 +49,10 @@ function openvpn_resync_if_needed ($mode, $ovpn_settings, $interface) {
$mode_id = $mode . $ovpn_settings['vpnid'];
$fpath = "{$g['varetc_path']}/openvpn/{$mode_id}.interface";
if (file_exists($fpath)) {
- $current_device = file_get_contents($fpath);
- $current_device = trim($current_device, " \t\n");
- $new_device = get_failover_interface($ovpn_settings['interface']);
- if (isset($config['interfaces'][$interface])) {
- $this_device = $config['interfaces'][$interface]['if'];
- if (($current_device == $new_device) && ($current_device != $this_device)) {
- $resync_needed = false;
- }
+ /* Compare the interface currently used by the VPN with the interface that should be used.
+ If the VPN should stay on the same interface, do not resync */
+ if (trim(file_get_contents($fpath), " \t\n") == get_failover_interface($ovpn_settings['interface'])) {
+ $resync_needed = false;
}
}
}
diff --git a/usr/local/www/diag_dns.php b/usr/local/www/diag_dns.php
index d99c5ba..cbce9aa 100644
--- a/usr/local/www/diag_dns.php
+++ b/usr/local/www/diag_dns.php
@@ -38,11 +38,13 @@ require("guiconfig.inc");
$host = trim($_REQUEST['host'], " \t\n\r\0\x0B[];\"'");
$host_esc = escapeshellarg($host);
-if (is_array($config['aliases']['alias'])) {
- $a_aliases = &$config['aliases']['alias'];
-} else {
- $a_aliases = array();
+/* If this section of config.xml has not been populated yet we need to set it up
+*/
+if (!is_array($config['aliases']['alias'])) {
+ $config['aliases']['alias'] = array();
}
+$a_aliases = &$config['aliases']['alias'];
+
$aliasname = str_replace(array(".","-"), "_", $host);
$alias_exists = false;
$counter=0;
diff --git a/usr/local/www/diag_logs_settings.php b/usr/local/www/diag_logs_settings.php
index e2eca1a..5f48985 100644
--- a/usr/local/www/diag_logs_settings.php
+++ b/usr/local/www/diag_logs_settings.php
@@ -380,13 +380,13 @@ function check_everything() {
<select name="sourceip" class="formselect">
<option value="">Default (any)</option>
<?php $sourceips = get_possible_traffic_source_addresses(false);
- foreach ($sourceips as $sip):
+ foreach ($sourceips as $sipvalue => $sipname):
$selected = "";
- if (!link_interface_to_bridge($sip['value']) && ($sip['value'] == $pconfig['sourceip']))
+ if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $pconfig['sourceip']))
$selected = 'selected="selected"';
?>
- <option value="<?=$sip['value'];?>" <?=$selected;?>>
- <?=htmlspecialchars($sip['name']);?>
+ <option value="<?=$sipvalue;?>" <?=$selected;?>>
+ <?=htmlspecialchars($sipname);?>
</option>
<?php endforeach; ?>
</select>
diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php
index bc60f71..0c289cf 100644
--- a/usr/local/www/diag_ping.php
+++ b/usr/local/www/diag_ping.php
@@ -116,13 +116,13 @@ include("head.inc"); ?>
<select name="sourceip" class="formselect">
<option value="">Default</option>
<?php $sourceips = get_possible_traffic_source_addresses(true);
- foreach ($sourceips as $sip):
+ foreach ($sourceips as $sipvalue => $sipname):
$selected = "";
- if (!link_interface_to_bridge($sip['value']) && ($sip['value'] == $sourceip))
+ if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip))
$selected = "selected=\"selected\"";
?>
- <option value="<?=$sip['value'];?>" <?=$selected;?>>
- <?=htmlspecialchars($sip['name']);?>
+ <option value="<?=$sipvalue;?>" <?=$selected;?>>
+ <?=htmlspecialchars($sipname);?>
</option>
<?php endforeach; ?>
</select>
diff --git a/usr/local/www/diag_testport.php b/usr/local/www/diag_testport.php
index b64075e..393c757 100644
--- a/usr/local/www/diag_testport.php
+++ b/usr/local/www/diag_testport.php
@@ -140,13 +140,13 @@ include("head.inc"); ?>
<select name="sourceip" class="formselect">
<option value="">Any</option>
<?php $sourceips = get_possible_traffic_source_addresses(true);
- foreach ($sourceips as $sip):
+ foreach ($sourceips as $sipvalue => $sipname):
$selected = "";
- if (!link_interface_to_bridge($sip['value']) && ($sip['value'] == $sourceip))
+ if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip))
$selected = "selected=\"selected\"";
?>
- <option value="<?=$sip['value'];?>" <?=$selected;?>>
- <?=htmlspecialchars($sip['name']);?>
+ <option value="<?=$sipvalue;?>" <?=$selected;?>>
+ <?=htmlspecialchars($sipname);?>
</option>
<?php endforeach; ?>
</select>
diff --git a/usr/local/www/diag_traceroute.php b/usr/local/www/diag_traceroute.php
index 8cdbf93..7878ebe 100644
--- a/usr/local/www/diag_traceroute.php
+++ b/usr/local/www/diag_traceroute.php
@@ -116,13 +116,13 @@ if (!isset($do_traceroute)) {
<select name="sourceip" class="formselect">
<option value="">Any</option>
<?php $sourceips = get_possible_traffic_source_addresses(true);
- foreach ($sourceips as $sip):
+ foreach ($sourceips as $sipvalue => $sipname):
$selected = "";
- if (!link_interface_to_bridge($sip['value']) && ($sip['value'] == $sourceip))
+ if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip))
$selected = "selected=\"selected\"";
?>
- <option value="<?=$sip['value'];?>" <?=$selected;?>>
- <?=htmlspecialchars($sip['name']);?>
+ <option value="<?=$sipvalue;?>" <?=$selected;?>>
+ <?=htmlspecialchars($sipname);?>
</option>
<?php endforeach; ?>
</select>
diff --git a/usr/local/www/getserviceproviders.php b/usr/local/www/getserviceproviders.php
index d720d14..b34e046 100644
--- a/usr/local/www/getserviceproviders.php
+++ b/usr/local/www/getserviceproviders.php
@@ -76,7 +76,7 @@ function providers_list($country) {
function provider_plan_data($country,$provider,$connection) {
header("Content-type: application/xml;");
- echo "<?xml version=\"1.0\" ?>\n";
+ echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<connection>\n";
$serviceproviders = get_country_providers($country);
foreach($serviceproviders as $sp) {
diff --git a/usr/local/www/graph.php b/usr/local/www/graph.php
index ce65a55..478bae4 100755
--- a/usr/local/www/graph.php
+++ b/usr/local/www/graph.php
@@ -102,7 +102,7 @@ if(file_exists("/usr/local/www/themes/{$g['theme']}/graph.php")) {
}
/********* Graph DATA **************/
-print('<?xml version="1.0" ?>' . "\n");?>
+print('<?xml version="1.0" encoding="UTF-8"?>' . "\n");?>
<svg width="100%" height="100%" viewBox="0 0 <?=$width?> <?=$height?>" preserveAspectRatio="none" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="init(evt)">
<g id="graph">
<rect id="bg" x1="0" y1="0" width="100%" height="100%" fill="white"/>
diff --git a/usr/local/www/graph_cpu.php b/usr/local/www/graph_cpu.php
index 200b9ea..ef3f22d 100644
--- a/usr/local/www/graph_cpu.php
+++ b/usr/local/www/graph_cpu.php
@@ -68,7 +68,7 @@ $height=100; // SVG internal height : do not modify
$width=200; // SVG internal width : do not modify
/********* Graph DATA **************/
-print('<?xml version="1.0" ?>' . "\n");?>
+print('<?xml version="1.0" encoding="UTF-8"?>' . "\n");?>
<svg width="100%" height="100%" viewBox="0 0 <?=$width?> <?=$height?>" preserveAspectRatio="none" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="init(evt);">
<g id="graph">
<rect id="bg" x1="0" y1="0" width="100%" height="100%" fill="white"/>
diff --git a/usr/local/www/installer/installer.php b/usr/local/www/installer/installer.php
index 90c138b..8f5dd91 100644
--- a/usr/local/www/installer/installer.php
+++ b/usr/local/www/installer/installer.php
@@ -1138,7 +1138,8 @@ EOF;
function return_rowhelper_row($rownum, $mountpoint, $fstype, $disk, $size, $encpass) {
global $g, $select_txt, $custom_disks, $savemsg;
$release = php_uname("r");
- $release = trim($release[0]);
+ // Get release number like 8.3 or 10.1
+ $relnum = strtok($release, "-");
// Mount point
$disks = installer_find_all_disks();
@@ -1155,7 +1156,7 @@ function return_rowhelper_row($rownum, $mountpoint, $fstype, $disk, $size, $encp
);
// UFS + Journaling was introduced in 9.0
- if($release == "9") {
+ if($relnum >= 9) {
$types['UFS+J'] = "UFS + Journaling";
$types['UFS+J.eli'] = "Encrypted UFS + Journaling";
}
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index 8ca3247..62cf658 100644
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -576,6 +576,9 @@ if ($_POST['apply']) {
case "dhcp6":
if (in_array($wancfg['ipaddrv6'], array()))
$input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']);
+ if ($_POST['dhcp6-ia-pd-send-hint'] && strtolower($_POST['dhcp6-ia-pd-len']) == 'none') {
+ $input_errors[] = gettext('DHCPv6 Prefix Delegation size must be provided when Send IPv6 prefix hint flag is checked');
+ }
break;
case "6rd":
foreach ($ifdescrs as $ifent => $ifdescr) {
@@ -1154,7 +1157,7 @@ if ($_POST['apply']) {
$wancfg['adv_dhcp6_id_assoc_statement_address_enable'] = $_POST['adv_dhcp6_id_assoc_statement_address_enable'];
if (!empty($_POST['adv_dhcp6_id_assoc_statement_address']))
$wancfg['adv_dhcp6_id_assoc_statement_address'] = $_POST['adv_dhcp6_id_assoc_statement_address'];
- if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_id']))
+ if (is_numericint($_POST['adv_dhcp6_id_assoc_statement_address_id']))
$wancfg['adv_dhcp6_id_assoc_statement_address_id'] = $_POST['adv_dhcp6_id_assoc_statement_address_id'];
if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_pltime']))
$wancfg['adv_dhcp6_id_assoc_statement_address_pltime'] = $_POST['adv_dhcp6_id_assoc_statement_address_pltime'];
@@ -1165,16 +1168,16 @@ if ($_POST['apply']) {
$wancfg['adv_dhcp6_id_assoc_statement_prefix_enable'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_enable'];
if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix']))
$wancfg['adv_dhcp6_id_assoc_statement_prefix'] = $_POST['adv_dhcp6_id_assoc_statement_prefix'];
- if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_id']))
+ if (is_numericint($_POST['adv_dhcp6_id_assoc_statement_prefix_id']))
$wancfg['adv_dhcp6_id_assoc_statement_prefix_id'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_id'];
if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_pltime']))
$wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_pltime'];
if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_vltime']))
$wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_vltime'];
- if (!empty($_POST['adv_dhcp6_prefix_interface_statement_sla_id']))
+ if (is_numericint($_POST['adv_dhcp6_prefix_interface_statement_sla_id']))
$wancfg['adv_dhcp6_prefix_interface_statement_sla_id'] = $_POST['adv_dhcp6_prefix_interface_statement_sla_id'];
- if (!empty($_POST['adv_dhcp6_prefix_interface_statement_sla_len']))
+ if (is_numericint($_POST['adv_dhcp6_prefix_interface_statement_sla_len']))
$wancfg['adv_dhcp6_prefix_interface_statement_sla_len'] = $_POST['adv_dhcp6_prefix_interface_statement_sla_len'];
if (!empty($_POST['adv_dhcp6_authentication_statement_authname']))
diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php
index 191d9f5..24c41b8 100644
--- a/usr/local/www/status_dhcp_leases.php
+++ b/usr/local/www/status_dhcp_leases.php
@@ -107,9 +107,12 @@ function adjust_gmt($dt) {
}
if ($dhcpleaseinlocaltime == "yes") {
$ts = strtotime($dt . " GMT");
- return strftime("%Y/%m/%d %I:%M:%S%p", $ts);
- } else
- return $dt;
+ if ($ts !== false) {
+ return strftime("%Y/%m/%d %I:%M:%S%p", $ts);
+ }
+ }
+ /* If we did not need to convert to local time or the conversion failed, just return the input. */
+ return $dt;
}
function remove_duplicate($array, $field)
@@ -186,9 +189,16 @@ foreach($leases_content as $lease) {
$f = $f+3;
break;
case "ends":
- $leases[$l]['end'] = $data[$f+2];
- $leases[$l]['end'] .= " " . $data[$f+3];
- $f = $f+3;
+ if ($data[$f+1] == "never") {
+ // Quote from dhcpd.leases(5) man page:
+ // If a lease will never expire, date is never instead of an actual date.
+ $leases[$l]['end'] = gettext("Never");
+ $f = $f+1;
+ } else {
+ $leases[$l]['end'] = $data[$f+2];
+ $leases[$l]['end'] .= " " . $data[$f+3];
+ $f = $f+3;
+ }
break;
case "tstp":
$f = $f+3;
OpenPOWER on IntegriCloud