Esempio n. 1
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_ipaddrv6($ifcfgip)) {
         if (!is_inrange_v6($_POST['range_from'], $subnet_start, $subnet_end) || !is_inrange_v6($_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']);
Esempio n. 2
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_ipaddrv6($ifcfgip)) {
				if ((! is_inrange_v6($_POST['range_from'], $subnet_start, $subnet_end)) ||
				 (! is_inrange_v6($_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) */