Project

General

Profile

« Previous | Next » 

Revision bfb3e717

Added by Seth Mos about 14 years ago

Add a prefix pool for prefix delegation. Doesn't work yet. ISC dhcpd complaining about the network mask being too short.

View differences:

etc/inc/services.inc
133 133
		$rtadvdconf .= "\t:prefixlen#{$ifcfgsnv6}:\\\n";
134 134
		$rtadvdconf .= "\t:raflags=\"mo\":\\\n";
135 135
		$rtadvdconf .= "\t:tc=ether:\n";
136
		$rtadvdconf .= "\n\n";
137

  
136
		$rtadvdconf .= "\n\n"; 
138 137
	}
139 138

  
140 139
	fwrite($fd, $rtadvdconf);
......
528 527
	
529 528
	/* kill any running dhcpd */
530 529
	if(is_process_running("dhcpd")) {
531
		killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/'dhcpdv6.pid");
530
		killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid");
532 531
	}
533 532

  
534 533
	/* DHCP enabled on any interfaces? */
......
613 612
	$dhcpv6num = 0;
614 613
	foreach ($dhcpdv6cfg as $dhcpv6if => $dhcpv6ifconf) {
615 614

  
616
		interfaces_staticarp_configure($dhcpv6if);
617

  
618 615
		if (!isset($dhcpv6ifconf['enable']))
619 616
			continue;
620 617

  
......
683 680

  
684 681
		if($is_olsr_enabled == true)
685 682
			if($dhcpv6ifconf['netmask'])
686
				$subnetmask = gen_subnet_mask($dhcpv6ifconf['netmask']);
683
				$subnetmask = gen_subnet_maskv6($dhcpv6ifconf['netmask']);
687 684

  
688 685
		$dnscfgv6 = "";
689 686

  
......
750 747
$dnscfgv6
751 748

  
752 749
EOD;
750

  
751
		if(is_ipaddrv6($dhcpv6ifconf['prefixrange']['from']) && is_ipaddrv6($dhcpv6ifconf['prefixrange']['to'])) {
752
			$dhcpdv6conf .= "	prefix6 {$dhcpv6ifconf['prefixrange']['from']} {$dhcpv6ifconf['prefixrange']['to']} /{$dhcpv6ifconf['prefixrange']['prefixlength']};\n";
753

  
754
		}
753 755
    		// default-lease-time
754 756
		if ($dhcpv6ifconf['defaultleasetime'])
755 757
			$dhcpdv6conf .= "	default-lease-time {$dhcpv6ifconf['defaultleasetime']};\n";
usr/local/www/services_dhcpv6.php
92 92
		$pconfig['range_from'] = $config['dhcpdv6'][$if]['range']['from'];
93 93
		$pconfig['range_to'] = $config['dhcpdv6'][$if]['range']['to'];
94 94
	}
95
	if (is_array($config['dhcpdv6'][$if]['prefixrange'])) {
96
		$pconfig['prefixrange_from'] = $config['dhcpdv6'][$if]['prefixrange']['from'];
97
		$pconfig['prefixrange_to'] = $config['dhcpdv6'][$if]['prefixrange']['to'];
98
		$pconfig['prefixrange_length'] = $config['dhcpdv6'][$if]['prefixrange']['prefixlength'];
99
	}
95 100
	$pconfig['mode'] = $config['dhcpdv6'][$if]['mode'];
96 101
	$pconfig['deftime'] = $config['dhcpdv6'][$if]['defaultleasetime'];
97 102
	$pconfig['maxtime'] = $config['dhcpdv6'][$if]['maxleasetime'];
......
173 178

  
174 179
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
175 180

  
176
		if (($_POST['range_from'] && !is_ipaddrv6($_POST['range_from'])))
181
		if (($_POST['prefixrange_from'] && !is_ipaddrv6($_POST['prefixrange_from'])))
182
			$input_errors[] = gettext("A valid range must be specified.");
183
		if (($_POST['prefixrange_to'] && !is_ipaddrv6($_POST['prefixrange_to'])))
184
			$input_errors[] = gettext("A valid prefix range must be specified.");
185
		if (($_POST['range_from'] && !is_ipaddrv6($_POST['prefixrange_from'])))
177 186
			$input_errors[] = gettext("A valid range must be specified.");
178 187
		if (($_POST['range_to'] && !is_ipaddrv6($_POST['range_to'])))
179 188
			$input_errors[] = gettext("A valid range must be specified.");
......
197 206
		if (($_POST['nextserver'] && !is_ipaddrv6($_POST['nextserver'])))
198 207
			$input_errors[] = gettext("A valid IPv6 address must be specified for the network boot server.");
199 208

  
200
		if(gen_subnet($ifcfgip, $ifcfgsn) == $_POST['range_from'])
201
			$input_errors[] = gettext("You cannot use the network address in the starting subnet range.");
202
		if(gen_subnet_max($ifcfgip, $ifcfgsn) == $_POST['range_to'])
203
			$input_errors[] = gettext("You cannot use the broadcast address in the ending subnet range.");
204

  
205 209
		// Disallow a range that includes the virtualip
206 210
		if (is_array($config['virtualip']['vip'])) {
207 211
			foreach($config['virtualip']['vip'] as $vip) {
......
237 241

  
238 242
			// $dynsubnet_start = ip2ulong($_POST['range_from']);
239 243
			// $dynsubnet_end = ip2ulong($_POST['range_to']);
240
			/* FIX later.
244
			/* FIX later. Also applies to prefix delegation
241 245
			if(is_array($a_maps)) {
242 246
				foreach ($a_maps as $map) {
243 247
					if (empty($map['ipaddrv6']))
......
258 262
			$config['dhcpdv6'][$if] = array();
259 263
		if (!is_array($config['dhcpdv6'][$if]['range']))
260 264
			$config['dhcpdv6'][$if]['range'] = array();
265
		if (!is_array($config['dhcpdv6'][$if]['prefixrange']))
266
			$config['dhcpdv6'][$if]['prefixrange'] = array();
261 267

  
262 268
		$config['dhcpdv6'][$if]['mode'] = $_POST['mode'];
263 269
		$config['dhcpdv6'][$if]['range']['from'] = $_POST['range_from'];
264 270
		$config['dhcpdv6'][$if]['range']['to'] = $_POST['range_to'];
271
		$config['dhcpdv6'][$if]['prefixrange']['from'] = $_POST['prefixrange_from'];
272
		$config['dhcpdv6'][$if]['prefixrange']['to'] = $_POST['prefixrange_to'];
273
		$config['dhcpdv6'][$if]['prefixrange']['prefixlength'] = $_POST['prefixrange_length'];
265 274
		$config['dhcpdv6'][$if]['defaultleasetime'] = $_POST['deftime'];
266 275
		$config['dhcpdv6'][$if]['maxleasetime'] = $_POST['maxtime'];
267 276
		$config['dhcpdv6'][$if]['netmask'] = $_POST['netmask'];
......
373 382
		endis = !(document.iform.enable.checked || enable_over);
374 383
		document.iform.range_from.disabled = endis;
375 384
		document.iform.range_to.disabled = endis;
385
		document.iform.prefixrange_from.disabled = endis;
386
		document.iform.prefixrange_to.disabled = endis;
387
		document.iform.prefixrange_length.disabled = endis;
376 388
		document.iform.dns1.disabled = endis;
377 389
		document.iform.dns2.disabled = endis;
378 390
		document.iform.deftime.disabled = endis;
......
561 573
			</td>
562 574
			</tr>
563 575
			<tr>
576
			<td width="22%" valign="top" class="vncellreq"><?=gettext("Prefix Delegation Range");?></td>
577
			<td width="78%" class="vtable">
578
				<input name="prefixrange_from" type="text" class="formfld unknown" id="prefixrange_from" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_from']);?>">
579
				&nbsp;<?=gettext("to"); ?>&nbsp; <input name="prefixrange_to" type="text" class="formfld unknown" id="prefixrange_to" size="28" value="<?=htmlspecialchars($pconfig['prefixrange_to']);?>">
580
				&nbsp;<?=gettext("prefix length"); ?>&nbsp; <select name="prefixrange_length" class="formselect" id="prefixrange_length">
581
					<option value="48" <?php if($pconfig['prefixrange_length'] == 48) echo "selected"; ?>>48</option>
582
					<option value="56" <?php if($pconfig['prefixrange_length'] == 56) echo "selected"; ?>>56</option>
583
					<option value="60" <?php if($pconfig['prefixrange_length'] == 60) echo "selected"; ?>>60</option>
584
				</select> <br/>
585
				<?php echo gettext("You can define a Prefix range here for DHCP Prefix Delegation. This allows for 
586
					assigning networks to subrouters"); ?>
587
			</td>
588
			</tr>
589
			<tr>
564 590
			<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td>
565 591
			<td width="78%" class="vtable">
566 592
				<input name="dns1" type="text" class="formfld unknown" id="dns1" size="28" value="<?=htmlspecialchars($pconfig['dns1']);?>"><br>
usr/local/www/services_dhcpv6_edit.php
85 85

  
86 86
if (isset($id) && $a_maps[$id]) {
87 87
        $pconfig['duid'] = $a_maps[$id]['duid'];
88
        $pconfig['prefixpool'] = $a_maps[$id]['prefixpool'];
89 88
	$pconfig['hostname'] = $a_maps[$id]['hostname'];
90 89
        $pconfig['ipaddrv6'] = $a_maps[$id]['ipaddrv6'];
91 90
	$pconfig['netbootfile'] = $a_maps[$id]['netbootfile'];
92 91
        $pconfig['descr'] = $a_maps[$id]['descr'];
93 92
} else {
94 93
        $pconfig['duid'] = $_GET['duid'];
95
        $pconfig['prefixpool'] = $_GET['prefixpool'];
96 94
	$pconfig['hostname'] = $_GET['hostname'];
97 95
	$pconfig['netbootfile'] = $_GET['netbootfile'];
98 96
        $pconfig['descr'] = $_GET['descr'];
......
206 204
                    <br>
207 205
                    <?=gettext("If no IPv6 address is given, one will be dynamically allocated  from the pool.");?></td>
208 206
                </tr>
209
                <tr>
210
                  <td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Prefix Pool");?></td>
211
                  <td width="78%" class="vtable"> 
212
                    <input name="prefixpool" type="text" class="formfld unknown" id="prefixpool" size="28" value="<?=htmlspecialchars($pconfig['prefixpool']);?>">
213
                    <br>
214
                    <?=gettext("If no IPv6 Prefix Pool is given, no prefixes will be negotiated");?></td>
215
                </tr>
216 207
                <tr> 
217 208
                  <td width="22%" valign="top" class="vncell"><?=gettext("Hostname");?></td>
218 209
                  <td width="78%" class="vtable"> 

Also available in: Unified diff