diff options
author | Seth Mos <seth.mos@dds.nl> | 2011-05-09 23:23:16 +0200 |
---|---|---|
committer | Seth Mos <seth.mos@dds.nl> | 2011-05-09 23:23:16 +0200 |
commit | bfb3e7174a36490ddb6af768839bc04a7637325d (patch) | |
tree | e339d1e54feb27a65016eb72795388a9d528f838 /usr/local/www | |
parent | de06b5b7ce604d55bec563f8b1a620abcbb085b4 (diff) | |
download | pfsense-bfb3e7174a36490ddb6af768839bc04a7637325d.zip pfsense-bfb3e7174a36490ddb6af768839bc04a7637325d.tar.gz |
Add a prefix pool for prefix delegation. Doesn't work yet. ISC dhcpd complaining about the network mask being too short.
Diffstat (limited to 'usr/local/www')
-rw-r--r-- | usr/local/www/services_dhcpv6.php | 40 | ||||
-rw-r--r-- | usr/local/www/services_dhcpv6_edit.php | 9 |
2 files changed, 33 insertions, 16 deletions
diff --git a/usr/local/www/services_dhcpv6.php b/usr/local/www/services_dhcpv6.php index d05839d..80b4021 100644 --- a/usr/local/www/services_dhcpv6.php +++ b/usr/local/www/services_dhcpv6.php @@ -92,6 +92,11 @@ if (is_array($config['dhcpdv6'][$if])){ $pconfig['range_from'] = $config['dhcpdv6'][$if]['range']['from']; $pconfig['range_to'] = $config['dhcpdv6'][$if]['range']['to']; } + if (is_array($config['dhcpdv6'][$if]['prefixrange'])) { + $pconfig['prefixrange_from'] = $config['dhcpdv6'][$if]['prefixrange']['from']; + $pconfig['prefixrange_to'] = $config['dhcpdv6'][$if]['prefixrange']['to']; + $pconfig['prefixrange_length'] = $config['dhcpdv6'][$if]['prefixrange']['prefixlength']; + } $pconfig['mode'] = $config['dhcpdv6'][$if]['mode']; $pconfig['deftime'] = $config['dhcpdv6'][$if]['defaultleasetime']; $pconfig['maxtime'] = $config['dhcpdv6'][$if]['maxleasetime']; @@ -173,7 +178,11 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); - if (($_POST['range_from'] && !is_ipaddrv6($_POST['range_from']))) + if (($_POST['prefixrange_from'] && !is_ipaddrv6($_POST['prefixrange_from']))) + $input_errors[] = gettext("A valid range must be specified."); + if (($_POST['prefixrange_to'] && !is_ipaddrv6($_POST['prefixrange_to']))) + $input_errors[] = gettext("A valid prefix range must be specified."); + if (($_POST['range_from'] && !is_ipaddrv6($_POST['prefixrange_from']))) $input_errors[] = gettext("A valid range must be specified."); if (($_POST['range_to'] && !is_ipaddrv6($_POST['range_to']))) $input_errors[] = gettext("A valid range must be specified."); @@ -197,11 +206,6 @@ if ($_POST) { if (($_POST['nextserver'] && !is_ipaddrv6($_POST['nextserver']))) $input_errors[] = gettext("A valid IPv6 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) { @@ -237,7 +241,7 @@ if ($_POST) { // $dynsubnet_start = ip2ulong($_POST['range_from']); // $dynsubnet_end = ip2ulong($_POST['range_to']); - /* FIX later. + /* FIX later. Also applies to prefix delegation if(is_array($a_maps)) { foreach ($a_maps as $map) { if (empty($map['ipaddrv6'])) @@ -258,10 +262,15 @@ if ($_POST) { $config['dhcpdv6'][$if] = array(); if (!is_array($config['dhcpdv6'][$if]['range'])) $config['dhcpdv6'][$if]['range'] = array(); + if (!is_array($config['dhcpdv6'][$if]['prefixrange'])) + $config['dhcpdv6'][$if]['prefixrange'] = array(); $config['dhcpdv6'][$if]['mode'] = $_POST['mode']; $config['dhcpdv6'][$if]['range']['from'] = $_POST['range_from']; $config['dhcpdv6'][$if]['range']['to'] = $_POST['range_to']; + $config['dhcpdv6'][$if]['prefixrange']['from'] = $_POST['prefixrange_from']; + $config['dhcpdv6'][$if]['prefixrange']['to'] = $_POST['prefixrange_to']; + $config['dhcpdv6'][$if]['prefixrange']['prefixlength'] = $_POST['prefixrange_length']; $config['dhcpdv6'][$if]['defaultleasetime'] = $_POST['deftime']; $config['dhcpdv6'][$if]['maxleasetime'] = $_POST['maxtime']; $config['dhcpdv6'][$if]['netmask'] = $_POST['netmask']; @@ -373,6 +382,9 @@ include("head.inc"); endis = !(document.iform.enable.checked || enable_over); document.iform.range_from.disabled = endis; document.iform.range_to.disabled = endis; + document.iform.prefixrange_from.disabled = endis; + document.iform.prefixrange_to.disabled = endis; + document.iform.prefixrange_length.disabled = endis; document.iform.dns1.disabled = endis; document.iform.dns2.disabled = endis; document.iform.deftime.disabled = endis; @@ -561,6 +573,20 @@ include("head.inc"); </td> </tr> <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Prefix Delegation Range");?></td> + <td width="78%" class="vtable"> + <input name="prefixrange_from" type="text" class="formfld unknown" id="prefixrange_from" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_from']);?>"> + <?=gettext("to"); ?> <input name="prefixrange_to" type="text" class="formfld unknown" id="prefixrange_to" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_to']);?>"> + <?=gettext("prefix length"); ?> <select name="prefixrange_length" class="formselect" id="prefixrange_length"> + <option value="48" <?php if($pconfig['prefixrange_length'] == 48) echo "selected"; ?>>48</option> + <option value="56" <?php if($pconfig['prefixrange_length'] == 56) echo "selected"; ?>>56</option> + <option value="60" <?php if($pconfig['prefixrange_length'] == 60) echo "selected"; ?>>60</option> + </select> <br/> + <?php echo gettext("You can define a Prefix range here for DHCP Prefix Delegation. This allows for + assigning networks to subrouters"); ?> + </td> + </tr> + <tr> <td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td> <td width="78%" class="vtable"> <input name="dns1" type="text" class="formfld unknown" id="dns1" size="28" value="<?=htmlspecialchars($pconfig['dns1']);?>"><br> diff --git a/usr/local/www/services_dhcpv6_edit.php b/usr/local/www/services_dhcpv6_edit.php index 0902142..ef87477 100644 --- a/usr/local/www/services_dhcpv6_edit.php +++ b/usr/local/www/services_dhcpv6_edit.php @@ -85,14 +85,12 @@ if (isset($_POST['id'])) if (isset($id) && $a_maps[$id]) { $pconfig['duid'] = $a_maps[$id]['duid']; - $pconfig['prefixpool'] = $a_maps[$id]['prefixpool']; $pconfig['hostname'] = $a_maps[$id]['hostname']; $pconfig['ipaddrv6'] = $a_maps[$id]['ipaddrv6']; $pconfig['netbootfile'] = $a_maps[$id]['netbootfile']; $pconfig['descr'] = $a_maps[$id]['descr']; } else { $pconfig['duid'] = $_GET['duid']; - $pconfig['prefixpool'] = $_GET['prefixpool']; $pconfig['hostname'] = $_GET['hostname']; $pconfig['netbootfile'] = $_GET['netbootfile']; $pconfig['descr'] = $_GET['descr']; @@ -206,13 +204,6 @@ include("head.inc"); <br> <?=gettext("If no IPv6 address is given, one will be dynamically allocated from the pool.");?></td> </tr> - <tr> - <td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Prefix Pool");?></td> - <td width="78%" class="vtable"> - <input name="prefixpool" type="text" class="formfld unknown" id="prefixpool" size="28" value="<?=htmlspecialchars($pconfig['prefixpool']);?>"> - <br> - <?=gettext("If no IPv6 Prefix Pool is given, no prefixes will be negotiated");?></td> - </tr> <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Hostname");?></td> <td width="78%" class="vtable"> |