示例#1
0
     $input_errors[] = gettext("A valid IP address or hostname must be specified for the TFTP server.");
 }
 if ($_POST['nextserver'] && !is_ipaddrv4($_POST['nextserver'])) {
     $input_errors[] = gettext("A valid IP address must be specified for the network boot server.");
 }
 if (gen_subnet($ifcfgip, $ifcfgsn) == $_POST['range_from']) {
     $input_errors[] = gettext("You cannot use the network address in the starting subnet range.");
 }
 if (gen_subnet_max($ifcfgip, $ifcfgsn) == $_POST['range_to']) {
     $input_errors[] = gettext("You cannot use the broadcast address in the ending subnet range.");
 }
 // Disallow a range that includes the virtualip
 if (is_array($config['virtualip']['vip'])) {
     foreach ($config['virtualip']['vip'] as $vip) {
         if ($vip['interface'] == $if) {
             if ($vip['subnet'] && is_inrange($vip['subnet'], $_POST['range_from'], $_POST['range_to'])) {
                 $input_errors[] = sprintf(gettext("The subnet range cannot overlap with virtual IP address %s."), $vip['subnet']);
             }
         }
     }
 }
 $noip = false;
 if (is_array($a_maps)) {
     foreach ($a_maps as $map) {
         if (empty($map['ipaddr'])) {
             $noip = true;
         }
     }
 }
 if ($_POST['staticarp'] && $noip) {
     $input_errors[] = "Cannot enable static ARP when you have static map entries without IP addresses. Ensure all static maps have IP addresses and try again.";
示例#2
0
    if (ip2long($test) < ip2long($end) && ip2long($test) > ip2long($start)) {
        return true;
    } else {
        return false;
    }
}
if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
    /* input validation */
    if ($_POST['enable']) {
        $reqdfields = explode(" ", "range_from range_to");
        $reqdfieldsn = explode(",", "Range begin,Range end");
        do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
        foreach ($a_maps as $mapent) {
            if (is_inrange($mapent['ipaddr'], $_POST['range_from'], $_POST['range_to'])) {
                $input_errors[] = "{$mapent['ipaddr']} is inside the range you specified.";
            }
        }
        if ($_POST['range_from'] && !is_ipaddr($_POST['range_from'])) {
            $input_errors[] = "Geçerli bir aralık belirtilmelidir.";
        }
        if ($_POST['range_to'] && !is_ipaddr($_POST['range_to'])) {
            $input_errors[] = "Geçerli bir aralık belirtilmelidir.";
        }
        if ($_POST['gateway'] && !is_ipaddr($_POST['gateway'])) {
            $input_errors[] = "Geçerli bir IP adresi ağ geçidi için belirtilmelidir.";
        }
        if ($_POST['wins1'] && !is_ipaddr($_POST['wins1']) || $_POST['wins2'] && !is_ipaddr($_POST['wins2'])) {
            $input_errors[] = "Birincil/ikincil WINS sunucuları için geçerli bir IP adresi tanımlanmalıdır.";
        }
示例#3
0
         }
     }
 }
 $noip = false;
 if (is_array($a_maps)) {
     foreach ($a_maps as $map) {
         if (empty($map['ipaddrv6'])) {
             $noip = true;
         }
     }
 }
 if (!$input_errors) {
     /* make sure the range lies within the current subnet */
     $subnet_start = gen_subnetv6($ifcfgip, $ifcfgsn);
     $subnet_end = gen_subnetv6_max($ifcfgip, $ifcfgsn);
     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.");
     }
     /* "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]);
     }
     /* 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']);