Exemplo n.º 1
0
										</td>
										</tr>
										<tr>
										<td width="22%" valign="top" class="vncellreq"><?php 
    echo gettext("Available range");
    ?>
</td>
										<td width="78%" class="vtable">
										<?php 
    $range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
    $range_from++;
    echo long2ip32($range_from);
    ?>
										-
										<?php 
    $range_to = ip2long(long2ip32(ip2long($ifcfgip) | ~gen_subnet_mask_long($ifcfgsn)));
    $range_to--;
    echo long2ip32($range_to);
    ?>
										<?php 
    if (is_numeric($pool) || $act == "newpool") {
        ?>
											<br />In-use DHCP Pool Ranges:
											<?php 
        if (is_array($config['dhcpd'][$if]['range'])) {
            ?>
												<br /><?php 
            echo $config['dhcpd'][$if]['range']['from'];
            ?>
-<?php 
            echo $config['dhcpd'][$if]['range']['to'];
Exemplo n.º 2
0
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 if (!$input_errors) {
     /* make sure the range lies within the current subnet */
     $subnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
     $subnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | ~gen_subnet_mask_long($ifcfgsn)));
     if (ip2ulong($_POST['range_from']) > ip2ulong($_POST['range_to'])) {
         $input_errors[] = gettext("The range is invalid (first element higher than second element).");
     }
     if (ip2ulong($_POST['range_from']) < $subnet_start || ip2ulong($_POST['range_to']) > $subnet_end) {
         $input_errors[] = gettext("The specified range lies outside of the current subnet.");
     }
     if (is_numeric($pool) || $act == "newpool") {
         if (!(ip2ulong($_POST['range_from']) > ip2ulong($config['dhcpd'][$if]['range']['to']) || ip2ulong($_POST['range_to']) < ip2ulong($config['dhcpd'][$if]['range']['from']))) {
             $input_errors[] = gettext("The specified range must not be within the DHCP range for this interface.");
         }
     }
     foreach ($a_pools as $id => $p) {
         if (is_numeric($pool) && $id == $pool) {
             continue;
         }
 if ($_POST['range_from'] && !is_ipaddr($_POST['range_from'])) {
     $input_errors[] = "Geçerli bir aralıkta tanımlanmalıdır.";
 }
 if ($_POST['range_to'] && !is_ipaddr($_POST['range_to'])) {
     $input_errors[] = "Geçerli bir aralıkta tanımlanmalıdır.";
 }
 if ($_POST['gateway'] && !is_ipaddr($_POST['gateway'])) {
     $input_errors[] = "Geçerli bir IP gateway IP adresi tanımlanmaldır.";
 }
 /* make sure the range lies within the bridged subnet */
 if ($_POST['bridge']) {
     if ($_POST['method'] == "ovpn") {
         $ipaddr = $config['interfaces'][$_POST['bridge']]['ipaddr'];
         $subnet = $config['interfaces'][$_POST['bridge']]['subnet'];
         $subnet_start = ip2long($ipaddr) & gen_subnet_mask_long($subnet);
         $subnet_end = ip2long($ipaddr) | ~gen_subnet_mask_long($subnet);
         if (!ip_in_subnet($_POST['gateway'], gen_subnet($ipaddr, $subnet) . "/" . $subnet)) {
             $input_errors[] = "The specified gateway lies outside of the bridged subnet.";
         }
         if (ip2long($_POST['range_from']) < $subnet_start || ip2long($_POST['range_from']) > $subnet_end || ip2long($_POST['range_to']) < $subnet_start || ip2long($_POST['range_to']) > $subnet_end) {
             $input_errors[] = "The specified range lies outside of the bridged subnet.";
         }
         if (ip2long($_POST['range_from']) > ip2long($_POST['range_to'])) {
             $input_errors[] = "The range is invalid (first element higher than second element).";
         }
     }
 }
 /* valid Port */
 if (empty($_POST['port'])) {
     $input_errors[] = "You must provide a server in between 1 and 65535.";
 } else {
Exemplo n.º 4
0
                          maskesi</td>
                        <td width="78%" class="vtable">
                          <?php 
echo gen_subnet_mask($ifcfg['subnet']);
?>
                        </td>
                      </tr>
                      <tr>
                        <td width="22%" valign="top" class="vncellreq">Mevcut aralık</td>
                        <td width="78%" class="vtable">
                          <?php 
echo long2ip(ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']));
?>
                          -
                          <?php 
echo long2ip(ip2long($ifcfg['ipaddr']) | ~gen_subnet_mask_long($ifcfg['subnet']));
?>
                        </td>
                      </tr>
					  <?php 
if ($is_olsr_enabled) {
    ?>
                      <tr>
                        <td width="22%" valign="top" class="vncellreq">Alt ağ maskesi</td>
                        <td width="78%" class="vtable">
	                        <select name="netmask" class="formfld" id="netmask">
							<?php 
    for ($i = 32; $i > 0; $i--) {
        if ($i != 31) {
            echo "<option value=\"{$i}\" ";
            if ($i == $pconfig['netmask']) {
 /* 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['mac'] == $_POST['mac']) {
         $input_errors[] = "This Hostname, IP or MAC address already exists.";
         break;
     }
 }
 /* make sure it's not within the dynamic subnet */
 if ($_POST['ipaddr']) {
     $dynsubnet_start = ip2long($config['dhcpd'][$if]['range']['from']);
     $dynsubnet_end = ip2long($config['dhcpd'][$if]['range']['to']);
     $lansubnet_start = ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']);
     $lansubnet_end = ip2long($ifcfg['ipaddr']) | ~gen_subnet_mask_long($ifcfg['subnet']);
     if (ip2long($_POST['ipaddr']) < $lansubnet_start || ip2long($_POST['ipaddr']) > $lansubnet_end) {
         $input_errors[] = "The IP address must lie in the {$ifcfg['descr']} subnet.";
     }
 }
 if (!$input_errors) {
     $mapent = array();
     $mapent['mac'] = $_POST['mac'];
     $mapent['ipaddr'] = $_POST['ipaddr'];
     $mapent['hostname'] = $_POST['hostname'];
     $mapent['descr'] = $_POST['descr'];
     if (isset($id) && $a_maps[$id]) {
         $a_maps[$id] = $mapent;
     } else {
         $a_maps[] = $mapent;
     }