Project

General

Profile

« Previous | Next » 

Revision 5bf321b6

Added by Matthew Smith almost 10 years ago

Add support for an IPv6 pool for mobile clients.

View differences:

usr/local/www/vpn_ipsec_mobile.php
60 60

  
61 61
	$pconfig['pool_address'] = $a_client['pool_address'];
62 62
	$pconfig['pool_netbits'] = $a_client['pool_netbits'];
63
	$pconfig['pool_address_v6'] = $a_client['pool_address_v6'];
64
	$pconfig['pool_netbits_v6'] = $a_client['pool_netbits_v6'];
63 65
	$pconfig['net_list'] = $a_client['net_list'];
64 66
	$pconfig['save_passwd'] = $a_client['save_passwd'];
65 67
	$pconfig['dns_domain'] = $a_client['dns_domain'];
......
81 83
	else
82 84
		$pconfig['pool_netbits'] = 24;
83 85

  
86
	if ($pconfig['pool_address_v6'] && $pconfig['pool_netbits_v6'])
87
		$pconfig['pool_enable_v6'] = true;
88
	else
89
		$pconfig['pool_netbits_v6'] = 120;
90

  
84 91
	if (isset($pconfig['net_list']))
85 92
		$pconfig['net_list_enable'] = true;
86 93

  
......
140 147
		if (!is_ipaddr($pconfig['pool_address']))
141 148
			$input_errors[] = gettext("A valid IP address for 'Virtual Address Pool Network' must be specified.");
142 149

  
150
	if ($pconfig['pool_enable_v6'])
151
		if (!is_ipaddrv6($pconfig['pool_address_v6']))
152
			$input_errors[] = gettext("A valid IPv6 address for 'Virtual IPv6 Address Pool Network' must be specified.");
153

  
143 154
	if ($pconfig['dns_domain_enable'])
144 155
		if (!is_domain($pconfig['dns_domain']))
145 156
			$input_errors[] = gettext("A valid value for 'DNS Default Domain' must be specified.");
......
200 211
			$client['pool_netbits'] = $pconfig['pool_netbits'];
201 212
		}
202 213

  
214
		if ($pconfig['pool_enable_v6']) {
215
			$client['pool_address_v6'] = $pconfig['pool_address_v6'];
216
			$client['pool_netbits_v6'] = $pconfig['pool_netbits_v6'];
217
		}
218

  
203 219
		if ($pconfig['net_list_enable'])
204 220
			$client['net_list'] = true;
205 221

  
......
263 279
	}
264 280
}
265 281

  
282
function pool_change_v6() {
283
	if (document.iform.pool_enable_v6.checked) {
284
		document.iform.pool_address_v6.disabled = 0;
285
		document.iform.pool_netbits_v6.disabled = 0;
286
	} else {
287
		document.iform.pool_address_v6.disabled = 1;
288
		document.iform.pool_netbits_v6.disabled = 1;
289
	}
290
}
291

  
266 292
function dns_domain_change() {
267 293

  
268 294
	if (document.iform.dns_domain_enable.checked)
......
393 419
									$selected = "";
394 420
									if (in_array($auth_server['name'], $authmodes))
395 421
										$selected = "selected=\"selected\"";
396
									echo "<option value=\"" . htmlspecialchars($auth_server['name']). "\" {$selected}>" . htmlspecialchars($auth_server['name']). "</option>\n";
422
									echo "<option value='{$auth_server['name']}' {$selected}>{$auth_server['name']}</option>\n";
397 423
								}
398 424
							?>
399 425
							</select>
......
449 475
							</table>
450 476
						</td>
451 477
					</tr>
478
					<tr> 
479
						<td width="22%" valign="top" class="vncell"><?=gettext("Virtual IPv6 Address Pool"); ?></td>
480
						<td width="78%" class="vtable">
481
							<table border="0" cellspacing="2" cellpadding="0" summary="enable v6 pool">
482
								<tr>
483
									<td>
484
										<?php set_checked($pconfig['pool_enable_v6'],$chk); ?>
485
										<input name="pool_enable_v6" type="checkbox" id="pool_enable_v6" value="yes" <?=$chk;?> onclick="pool_change_v6()" />
486
									</td>
487
									<td>
488
										<?=gettext("Provide a virtual IPv6 address to clients"); ?><br />
489
									</td>
490
								</tr>
491
							</table>
492
							<table border="0" cellspacing="2" cellpadding="0" summary="virtual IPv6 address pool">
493
								<tr>
494
									<td>
495
										<?=gettext("Network"); ?>:&nbsp;
496
										<input name="pool_address_v6" type="text" class="formfld unknown" id="pool_address_v6" size="20" value="<?=htmlspecialchars($pconfig['pool_address_v6']);?>" />
497
										/
498
										<select name="pool_netbits_v6" class="formselect" id="pool_netbits_v6">
499
											<?php for ($i = 128; $i >= 0; $i--): ?>
500
											<option value="<?=$i;?>" <?php if ($i == $pconfig['pool_netbits_v6']) echo "selected=\"selected\""; ?>>
501
												<?=$i;?>
502
											</option>
503
											<?php endfor; ?>
504
										</select>
505
									</td>
506
								</tr>
507
							</table>
508
						</td>
509
					</tr>
452 510
					<tr>
453 511
						<td width="22%" valign="top" class="vncell"><?=gettext("Network List"); ?></td>
454 512
						<td width="78%" class="vtable">

Also available in: Unified diff