}
 $natiflist = get_configured_interface_with_descr();
 foreach ($natiflist as $natif => $natdescr) {
     if ($_POST['interface'] == $natif && (empty($config['interfaces'][$natif]['ipaddr']) && empty($config['interfaces'][$natif]['ipaddrv6']))) {
         $input_errors[] = gettext("The interface chosen for the VIP has no IPv4 or IPv6 address configured so it cannot be used as a parent for the VIP.");
     }
 }
 /* ipalias and carp should not use network or broadcast address */
 if ($_POST['mode'] == "ipalias" || $_POST['mode'] == "carp") {
     if (is_ipaddrv4($_POST['subnet']) && $_POST['subnet_bits'] != "32") {
         $network_addr = gen_subnet($_POST['subnet'], $_POST['subnet_bits']);
         $broadcast_addr = gen_subnet_max($_POST['subnet'], $_POST['subnet_bits']);
     } else {
         if (is_ipaddrv6($_POST['subnet']) && $_POST['subnet_bits'] != "128") {
             $network_addr = gen_subnetv6($_POST['subnet'], $_POST['subnet_bits']);
             $broadcast_addr = gen_subnetv6_max($_POST['subnet'], $_POST['subnet_bits']);
         }
     }
     if (isset($network_addr) && $_POST['subnet'] == $network_addr) {
         $input_errors[] = gettext("You cannot use the network address for this VIP");
     } else {
         if (isset($broadcast_addr) && $_POST['subnet'] == $broadcast_addr) {
             $input_errors[] = gettext("You cannot use the broadcast address for this VIP");
         }
     }
 }
 /* make sure new ip is within the subnet of a valid ip
  * on one of our interfaces (wan, lan optX)
  */
 switch ($_POST['mode']) {
     case 'carp':
示例#2
0
    print_info_box(gettext("The DHCPv6 Server can only be enabled on interfaces configured with a static IPv6 address. This system has none."), 'danger');
    include "foot.inc";
    exit;
}
$tab_array = array();
$tab_array[] = array(gettext("DHCPv6 Server"), true, "services_dhcpv6.php?if={$if}");
$tab_array[] = array(gettext("Router Advertisements"), false, "services_router_advertisements.php?if={$if}");
display_top_tabs($tab_array);
require_once 'classes/Form.class.php';
$form = new Form(new Form_Button('Submit', 'Save'));
$section = new Form_Section('DHCPv6 Options');
$section->addInput(new Form_Checkbox('enable', 'DHCPv6 Server', 'Enable DHCPv6 server on interface ' . $iflist[$if], $pconfig['enable']))->toggles('.form-group:not(:first-child)');
if (is_ipaddrv6($ifcfgip)) {
    $section->addInput(new Form_StaticText('Subnet', gen_subnetv6($ifcfgip, $ifcfgsn)));
    $section->addInput(new Form_StaticText('Subnet Mask', $ifcfgsn . ' bits'));
    $section->addInput(new Form_StaticText('Available Range', $range_from = gen_subnetv6($ifcfgip, $ifcfgsn) . ' to ' . gen_subnetv6_max($ifcfgip, $ifcfgsn)));
}
if ($is_olsr_enabled) {
    $section->addInput(new Form_Select('netmask', 'Subnetmask', $pconfig['netmask'], array_combine(range(128, 1, -1), range(128, 1, -1))));
}
$f1 = new Form_Input('range_from', null, 'text', $pconfig['range_from']);
$f1->setHelp('To');
$f2 = new Form_Input('range_to', null, 'text', $pconfig['range_to']);
$f2->setHelp('From');
$group = new Form_Group('Range');
$group->add($f1);
$group->add($f2);
$section->add($group);
$f1 = new Form_Input('prefix_from', null, 'text', $pconfig['prefix_from']);
$f1->setHelp('To');
$f2 = new Form_Input('prefix_to', null, 'text', $pconfig['prefix_to']);
 }
 $natiflist = get_configured_interface_with_descr();
 foreach ($natiflist as $natif => $natdescr) {
     if ($pconfig['interface'] == $natif && (empty($config['interfaces'][$natif]['ipaddr']) && empty($config['interfaces'][$natif]['ipaddrv6']))) {
         $input_errors[] = gettext("The interface chosen for the VIP has no IPv4 or IPv6 address configured so it cannot be used as a parent for the VIP.");
     }
 }
 /* ipalias and carp should not use network or broadcast address */
 if ($pconfig['mode'] == "ipalias" || $pconfig['mode'] == "carp") {
     if (is_ipaddrv4($pconfig['subnet']) && $pconfig['subnet_bits'] != "32") {
         $network_addr = gen_subnet($pconfig['subnet'], $pconfig['subnet_bits']);
         $broadcast_addr = gen_subnet_max($pconfig['subnet'], $pconfig['subnet_bits']);
     } else {
         if (is_ipaddrv6($pconfig['subnet']) && $_POST['subnet_bits'] != "128") {
             $network_addr = gen_subnetv6($pconfig['subnet'], $pconfig['subnet_bits']);
             $broadcast_addr = gen_subnetv6_max($pconfig['subnet'], $pconfig['subnet_bits']);
         }
     }
     if (isset($network_addr) && $pconfig['subnet'] == $network_addr) {
         $input_errors[] = gettext("You cannot use the network address for this VIP");
     } else {
         if (isset($broadcast_addr) && $pconfig['subnet'] == $broadcast_addr) {
             $input_errors[] = gettext("You cannot use the broadcast address for this VIP");
         }
     }
 }
 /* make sure new ip is within the subnet of a valid ip
  * on one of our interfaces (wan, lan optX)
  */
 if ($pconfig['mode'] == 'carp') {
     /* verify against reusage of vhids */
示例#4
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 = gen_subnetv6($ifcfgip, $ifcfgsn);
        $range_from++;
        echo $range_from;
        ?>
											-
											<?php 
        $range_to = gen_subnetv6_max($ifcfgip, $ifcfgsn);
        echo $range_to;
        ?>
											</td>
											</tr>
											<?php 
    }
    ?>

											<?php 
    if ($is_olsr_enabled) {
        ?>
											<tr>
											<td width="22%" valign="top" class="vncellreq"><?php 
        echo gettext("Subnet Mask");
        ?>
示例#5
0
if ($dhcrelay_enabled) {
    include "foot.inc";
    exit;
}
$form = new Form();
$section = new Form_Section('DHCPv6 Options');
$section->addInput(new Form_Checkbox('enable', 'DHCPv6 Server', 'Enable DHCPv6 server on interface ' . $iflist[$if], $pconfig['enable']));
if (is_ipaddrv6($ifcfgip)) {
    if ($ifcfgip == "::") {
        $sntext = "Prefix Delegation";
    } else {
        $sntext = gen_subnetv6($ifcfgip, $ifcfgsn);
    }
    $section->addInput(new Form_StaticText('Subnet', $sntext));
    $section->addInput(new Form_StaticText('Subnet Mask', $ifcfgsn . ' bits'));
    $section->addInput(new Form_StaticText('Available Range', $range_from = gen_subnetv6($ifcfgip, $ifcfgsn) . ' to ' . gen_subnetv6_max($ifcfgip, $ifcfgsn)))->setHelp($trackifname ? 'Prefix Delegation subnet will be appended to the beginning of the defined range' : '');
}
if ($is_olsr_enabled) {
    $section->addInput(new Form_Select('netmask', 'Subnet Mask', $pconfig['netmask'], array_combine(range(128, 1, -1), range(128, 1, -1))));
}
$f1 = new Form_Input('range_from', null, 'text', $pconfig['range_from']);
$f1->setHelp('From');
$f2 = new Form_Input('range_to', null, 'text', $pconfig['range_to']);
$f2->setHelp('To');
$group = new Form_Group('Range');
$group->add($f1);
$group->add($f2);
$section->add($group);
$f1 = new Form_Input('prefixrange_from', null, 'text', $pconfig['prefixrange_from']);
$f1->setHelp('From');
$f2 = new Form_Input('prefixrange_to', null, 'text', $pconfig['prefixrange_to']);