$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'.");
     } else {
         if (!is_unqualified_hostname($_POST['hostname'])) {
             $input_errors[] = gettext("A valid hostname is specified, but the domain name part should be omitted");
         }
     }
 }
 if ($_POST['ipaddrv6']) {
     if (!is_ipaddrv6($_POST['ipaddrv6'])) {
         $input_errors[] = gettext("A valid IPv6 address must be specified.");
     } elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6') {
         $trackifname = $config['interfaces'][$if]['track6-interface'];
         $trackcfg = $config['interfaces'][$trackifname];
         $pdlen = 64 - $trackcfg['dhcp6-ia-pd-len'];
         if (!Net_IPv6::isInNetmask($_POST['ipaddrv6'], '::', $pdlen)) {
             $input_errors[] = sprintf(gettext("The prefix (upper %s bits) must be zero.  Use the form %s"), $pdlen, dhcpv6_pd_str_help($ifcfgsn));
         }
     }
 }
 if (empty($_POST['duid'])) {
     $input_errors[] = gettext("A valid DUID must be specified.");
 }
 /* check for overlaps */
 foreach ($a_maps as $mapent) {
     if (isset($id) && $a_maps[$id] && $a_maps[$id] === $mapent) {
         continue;
     }
     if ($mapent['hostname'] == $_POST['hostname'] && $mapent['hostname'] || $mapent['duid'] == $_POST['duid']) {
         $input_errors[] = gettext("This Hostname, IP or DUID already exists.");
         break;
     }
    $pconfig['netboot'] = isset($config['dhcpdv6'][$if]['netboot']);
    $pconfig['bootfile_url'] = $config['dhcpdv6'][$if]['bootfile_url'];
    $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'];
}
if ($config['interfaces'][$if]['ipaddrv6'] == 'track6') {
    $trackifname = $config['interfaces'][$if]['track6-interface'];
    $trackcfg = $config['interfaces'][$trackifname];
    $ifcfgsn = "64";
    $ifcfgip = '::';
    $str_help_mask = dhcpv6_pd_str_help($ifcfgsn);
} else {
    $ifcfgip = get_interface_ipv6($if);
    $ifcfgsn = get_interface_subnetv6($if);
}
/*	 set the enabled flag which will tell us if DHCP relay is enabled
 *	 on any interface. We will use this to disable DHCP server since
 *	 the two are not compatible with each other.
 */
$dhcrelay_enabled = false;
$dhcrelaycfg = $config['dhcrelay6'];
if (is_array($dhcrelaycfg) && isset($dhcrelaycfg['enable']) && isset($dhcrelaycfg['interface']) && !empty($dhcrelaycfg['interface'])) {
    $dhcrelayifs = explode(",", $dhcrelaycfg['interface']);
    foreach ($dhcrelayifs as $dhcrelayif) {
        if (isset($iflist[$dhcrelayif]) && !link_interface_to_bridge($dhcrelayif)) {
            $dhcrelay_enabled = true;