summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_dhcpv6.php
diff options
context:
space:
mode:
Diffstat (limited to 'usr/local/www/services_dhcpv6.php')
-rw-r--r--usr/local/www/services_dhcpv6.php78
1 files changed, 56 insertions, 22 deletions
diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php
index d18e15e..664652e 100644
--- a/usr/local/www/services_dhcpv6.php
+++ b/usr/local/www/services_dhcpv6.php
@@ -119,6 +119,7 @@ if (is_array($config['dhcpdv6'][$if])){
$pconfig['failover_peerip'] = $config['dhcpdv6'][$if]['failover_peerip'];
$pconfig['netmask'] = $config['dhcpdv6'][$if]['netmask'];
$pconfig['numberoptions'] = $config['dhcpdv6'][$if]['numberoptions'];
+ $pconfig['dhcpv6leaseinlocaltime'] = $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'];
if (!is_array($config['dhcpdv6'][$if]['staticmap']))
$config['dhcpdv6'][$if]['staticmap'] = array();
$a_maps = &$config['dhcpdv6'][$if]['staticmap'];
@@ -143,9 +144,8 @@ if(is_array($dhcrelaycfg)) {
}
}
-/* FIXME needs v6 code, use in subnet v6? */
function is_inrange($test, $start, $end) {
- if ( (ip2ulong($test) < ip2ulong($end)) && (ip2ulong($test) > ip2ulong($start)) )
+ if ( (inet_pton($test) < inet_pton($end)) && (inet_pton($test) > inet_pton($start)) )
return true;
else
return false;
@@ -197,6 +197,16 @@ if ($_POST) {
$input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain'])))
$input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
+ if ($_POST['domainsearchlist']) {
+ $domain_array=preg_split("/[ ;]+/",$_POST['domainsearchlist']);
+ foreach ($domain_array as $curdomain) {
+ if (!is_domain($curdomain)) {
+ $input_errors[] = gettext("A valid domain search list must be specified.");
+ break;
+ }
+ }
+ }
+
if (($_POST['ntp1'] && !is_ipaddrv6($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddrv6($_POST['ntp2'])))
$input_errors[] = gettext("A valid IPv6 address must be specified for the primary/secondary NTP servers.");
if (($_POST['domain'] && !is_domain($_POST['domain'])))
@@ -222,38 +232,40 @@ if ($_POST) {
$noip = true;
if (!$input_errors) {
/* make sure the range lies within the current subnet */
- /* FIXME change for ipv6 subnet */
$subnet_start = gen_subnetv6($ifcfgip, $ifcfgsn);
$subnet_end = gen_subnetv6_max($ifcfgip, $ifcfgsn);
- if((! ip_in_subnet($_POST['range_from'], $subnet_start)) || (! ip_in_subnet($_POST['range_to'], $subnet_start))) {
+ if ((! is_inrange($_POST['range_from'], $subnet_start, $subnet_end)) ||
+ (! is_inrange($_POST['range_to'], $subnet_start, $subnet_end))) {
$input_errors[] = gettext("The specified range lies outside of the current subnet.");
}
- /* no idea how to do this yet
- if (ip2ulong($_POST['range_from']) > ip2ulong($_POST['range_to']))
+ /* "from" cannot be higher than "to" */
+ if (inet_pton($_POST['range_from']) > inet_pton($_POST['range_to']))
$input_errors[] = gettext("The range is invalid (first element higher than second element).");
- */
/* make sure that the DHCP Relay isn't enabled on this interface */
if (isset($config['dhcrelay'][$if]['enable']))
$input_errors[] = sprintf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."),$iflist[$if]);
- // $dynsubnet_start = ip2ulong($_POST['range_from']);
- // $dynsubnet_end = ip2ulong($_POST['range_to']);
- /* FIX later. Also applies to prefix delegation
+
+ /* Verify static mappings do not overlap:
+ - available DHCP range
+ - prefix delegation range (FIXME: still need to be completed) */
+ $dynsubnet_start = inet_pton($_POST['range_from']);
+ $dynsubnet_end = inet_pton($_POST['range_to']);
+
if(is_array($a_maps)) {
foreach ($a_maps as $map) {
if (empty($map['ipaddrv6']))
continue;
- if ((ip2ulong($map['ipaddrv6']) > $dynsubnet_start) &&
- (ip2ulong($map['ipaddr']) < $dynsubnet_end)) {
+ if ((inet_pton($map['ipaddrv6']) > $dynsubnet_start) &&
+ (inet_pton($map['ipaddr']) < $dynsubnet_end)) {
$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
break;
}
}
}
- */
}
}
@@ -308,6 +320,7 @@ if ($_POST) {
$config['dhcpdv6'][$if]['nextserver'] = $_POST['nextserver'];
$config['dhcpdv6'][$if]['filename'] = $_POST['filename'];
$config['dhcpdv6'][$if]['rootpath'] = $_POST['rootpath'];
+ $config['dhcpdv6'][$if]['dhcpv6leaseinlocaltime'] = $_POST['dhcpv6leaseinlocaltime'];
// Handle the custom options rowhelper
if(isset($config['dhcpdv6'][$if]['numberoptions']['item']))
@@ -389,15 +402,16 @@ include("head.inc");
document.iform.dns2.disabled = endis;
document.iform.deftime.disabled = endis;
document.iform.maxtime.disabled = endis;
- document.iform.gateway.disabled = endis;
+ //document.iform.gateway.disabled = endis;
document.iform.failover_peerip.disabled = endis;
+ document.iform.dhcpv6leaseinlocaltime.disabled = endis;
document.iform.domain.disabled = endis;
document.iform.domainsearchlist.disabled = endis;
document.iform.ddnsdomain.disabled = endis;
document.iform.ddnsupdate.disabled = endis;
document.iform.ntp1.disabled = endis;
document.iform.ntp2.disabled = endis;
- document.iform.tftp.disabled = endis;
+ //document.iform.tftp.disabled = endis;
document.iform.ldap.disabled = endis;
document.iform.netboot.disabled = endis;
document.iform.nextserver.disabled = endis;
@@ -417,13 +431,11 @@ include("head.inc");
aodiv = document.getElementById('showddns');
aodiv.style.display = "block";
}
- /*
function show_ntp_config() {
document.getElementById("showntpbox").innerHTML='';
aodiv = document.getElementById('showntp');
aodiv.style.display = "block";
}
- */
/*
function show_tftp_config() {
document.getElementById("showtftpbox").innerHTML='';
@@ -545,8 +557,7 @@ include("head.inc");
?>
-
<?php
- /* FIXME end of subnet calculation here */
- $range_to = gen_subnetv6_max($ifcfgip, $ifcfgsn);;
+ $range_to = gen_subnetv6_max($ifcfgip, $ifcfgsn);
echo $range_to;
?>
</td>
@@ -618,7 +629,7 @@ include("head.inc");
<td width="22%" valign="top" class="vncell"><?=gettext("Domain search list");?></td>
<td width="78%" class="vtable">
<input name="domainsearchlist" type="text" class="formfld unknown" id="domainsearchlist" size="28" value="<?=htmlspecialchars($pconfig['domainsearchlist']);?>"><br>
- <?=gettext("The DHCP server can optionally provide a domain search list.");?>
+ <?=gettext("The DHCP server can optionally provide a domain search list. Use the semicolon character as seperator");?>
</td>
</tr>
<tr>
@@ -649,6 +660,31 @@ include("head.inc");
</td>
</tr>
<tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Time format change"); ?></td>
+ <td width="78%" class="vtable">
+ <table>
+ <tr>
+ <td>
+ <input name="dhcpv6leaseinlocaltime" type="checkbox" id="dhcpv6leaseinlocaltime" value="yes" <?php if ($pconfig['dhcpv6leaseinlocaltime']) echo "checked"; ?>>
+ </td>
+ <td>
+ <strong>
+ <?=gettext("Change DHCPv6 display lease time from UTC to local time."); ?>
+ </strong>
+ </td>
+ </tr>
+ <tr>
+ <td>&nbsp;</td>
+ <td>
+ <span class="red"><strong><?=gettext("Note:");?></strong></span> <?=gettext("By default DHCPv6 leases are displayed in UTC time. By checking this
+ box DHCPv6 lease time will be displayed in local time and set to time zone selected. This will be used for all DHCPv6 interfaces lease time."); ?>
+
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic DNS");?></td>
<td width="78%" class="vtable">
<div id="showddnsbox">
@@ -664,7 +700,6 @@ include("head.inc");
</div>
</td>
</tr>
- <!-- ISC dhcpd does not support ntp for ipv6 yet. See redmine #2016
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("NTP servers");?></td>
<td width="78%" class="vtable">
@@ -677,7 +712,6 @@ include("head.inc");
</div>
</td>
</tr>
- -->
<!-- ISC dhcpd does not support tftp for ipv6 yet. See redmine #2016
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("TFTP server");?></td>
OpenPOWER on IntegriCloud