Add forgotten "ipv6 remote network", clean up a couple bits, make sure local network box is hidden for shared key servers.

This commit is contained in:
jim-p 2012-08-09 14:40:54 -04:00
parent d5d1554278
commit 4856df9b7f
3 changed files with 80 additions and 13 deletions

View File

@ -521,6 +521,8 @@ function openvpn_reconfigure($mode, $settings) {
}
if ($settings['local_networkv6']) {
list($ipv6, $prefix) = explode('/', $settings['local_networkv6']);
if (empty($prefix))
$prefix = "128";
$conf .= "push \"route-ipv6 $ipv6/$prefix\"\n";
}
@ -600,6 +602,13 @@ function openvpn_reconfigure($mode, $settings) {
$mask = gen_subnet_mask($mask);
$conf .= "route $ip $mask\n";
}
// Add a remote network route if set, and only for p2p modes.
if ((substr($settings['mode'], 0, 3) == "p2p") && is_subnet($settings['remote_networkv6'])) {
list($ipv6, $prefix) = explode('/', $settings['remote_networkv6']);
if (empty($prefix))
$prefix = "128";
$conf .= "route-ipv6 ${ipv6}/${prefix}\n";
}
// Write the settings for the keys
switch($settings['mode']) {

View File

@ -128,7 +128,9 @@ if($_GET['act']=="edit"){
$pconfig['engine'] = $a_client[$id]['engine'];
$pconfig['tunnel_network'] = $a_client[$id]['tunnel_network'];
$pconfig['tunnel_networkv6'] = $a_client[$id]['tunnel_networkv6'];
$pconfig['remote_network'] = $a_client[$id]['remote_network'];
$pconfig['remote_networkv6'] = $a_client[$id]['remote_networkv6'];
$pconfig['use_shaper'] = $a_client[$id]['use_shaper'];
$pconfig['compression'] = $a_client[$id]['compression'];
$pconfig['passtos'] = $a_client[$id]['passtos'];
@ -262,7 +264,9 @@ if ($_POST) {
$client['engine'] = $pconfig['engine'];
$client['tunnel_network'] = $pconfig['tunnel_network'];
$client['tunnel_networkv6'] = $pconfig['tunnel_networkv6'];
$client['remote_network'] = $pconfig['remote_network'];
$client['remote_networkv6'] = $pconfig['remote_networkv6'];
$client['use_shaper'] = $pconfig['use_shaper'];
$client['compression'] = $pconfig['compression'];
$client['passtos'] = $pconfig['passtos'];
@ -760,7 +764,7 @@ if ($savemsg)
<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Tunnel Network"); ?></td>
<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Tunnel Network"); ?></td>
<td width="78%" class="vtable">
<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>">
<br>
@ -774,7 +778,21 @@ if ($savemsg)
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Remote Network"); ?></td>
<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Tunnel Network"); ?></td>
<td width="78%" class="vtable">
<input name="tunnel_networkv6" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_networkv6']);?>">
<br>
<?=gettext("This is the IPv6 virtual network used for private " .
"communications between this client and the " .
"server expressed using CIDR (eg. fe80::/64). " .
"The first network address is assumed to be the " .
"server address and the second network address " .
"will be assigned to the client virtual " .
"interface"); ?>.
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Remote Network"); ?></td>
<td width="78%" class="vtable">
<input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>">
<br>
@ -787,6 +805,20 @@ if ($savemsg)
"only communicate with other clients"); ?>.
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Remote Network"); ?></td>
<td width="78%" class="vtable">
<input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>">
<br>
<?=gettext("This is an IPv6 network that will be routed through " .
"the tunnel, so that a site-to-site VPN can be " .
"established without manually changing the " .
"routing tables. Expressed as an IP/PREFIX. If " .
"this is a site-to-site VPN, enter the " .
"remote LAN here. You may leave this blank to " .
"only communicate with other clients"); ?>.
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Limit outgoing bandwidth");?></td>
<td width="78%" class="vtable">
@ -834,6 +866,9 @@ if ($savemsg)
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
<tr>
<td colspan="2" class="list" height="12"></td>
</tr>
@ -853,7 +888,11 @@ if ($savemsg)
</tr>
</table>
</td>
</tr>
</tr>
</table>
<br/>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">

View File

@ -139,6 +139,7 @@ if($_GET['act']=="edit"){
$pconfig['tunnel_networkv6'] = $a_server[$id]['tunnel_networkv6'];
$pconfig['remote_network'] = $a_server[$id]['remote_network'];
$pconfig['remote_networkv6'] = $a_server[$id]['remote_networkv6'];
$pconfig['gwredir'] = $a_server[$id]['gwredir'];
$pconfig['local_network'] = $a_server[$id]['local_network'];
$pconfig['local_networkv6'] = $a_server[$id]['local_networkv6'];
@ -352,6 +353,7 @@ if ($_POST) {
$server['tunnel_network'] = $pconfig['tunnel_network'];
$server['tunnel_networkv6'] = $pconfig['tunnel_networkv6'];
$server['remote_network'] = $pconfig['remote_network'];
$server['remote_networkv6'] = $pconfig['remote_networkv6'];
$server['gwredir'] = $pconfig['gwredir'];
$server['local_network'] = $pconfig['local_network'];
$server['local_networkv6'] = $pconfig['local_networkv6'];
@ -467,7 +469,8 @@ function mode_change() {
document.getElementById("client_opts").style.display="none";
document.getElementById("remote_opts").style.display="";
document.getElementById("gwredir_opts").style.display="none";
document.getElementById("local_opts").style.display="none";
document.getElementById("local_optsv4").style.display="none";
document.getElementById("local_optsv6").style.display="none";
document.getElementById("authmodetr").style.display="none";
document.getElementById("inter_client_communication").style.display="none";
break;
@ -475,7 +478,8 @@ function mode_change() {
document.getElementById("client_opts").style.display="none";
document.getElementById("remote_opts").style.display="";
document.getElementById("gwredir_opts").style.display="";
document.getElementById("local_opts").style.display="";
document.getElementById("local_optsv4").style.display="";
document.getElementById("local_optsv6").style.display="";
document.getElementById("authmodetr").style.display="none";
document.getElementById("inter_client_communication").style.display="none";
break;
@ -485,7 +489,8 @@ function mode_change() {
document.getElementById("client_opts").style.display="";
document.getElementById("remote_opts").style.display="none";
document.getElementById("gwredir_opts").style.display="";
document.getElementById("local_opts").style.display="";
document.getElementById("local_optsv4").style.display="";
document.getElementById("local_optsv6").style.display="";
document.getElementById("inter_client_communication").style.display="";
break;
case "server_tls":
@ -494,7 +499,8 @@ function mode_change() {
document.getElementById("client_opts").style.display="";
document.getElementById("remote_opts").style.display="none";
document.getElementById("gwredir_opts").style.display="";
document.getElementById("local_opts").style.display="";
document.getElementById("local_optsv4").style.display="";
document.getElementById("local_optsv6").style.display="";
document.getElementById("inter_client_communication").style.display="";
break;
}
@ -1085,7 +1091,7 @@ if ($savemsg)
"communications between this server and client " .
"hosts expressed using CIDR (eg. fe80::/64). " .
"The first network address will be assigned to " .
"the server virtual interface. The remaining " .
"the server virtual interface. The remaining " .
"network addresses can optionally be assigned " .
"to connecting clients. (see Address Pool)"); ?>
</td>
@ -1178,7 +1184,7 @@ if ($savemsg)
</table>
</td>
</tr>
<tr id="local_opts">
<tr id="local_optsv4">
<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Local Network"); ?></td>
<td width="78%" class="vtable">
<input name="local_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['local_network']);?>">
@ -1191,7 +1197,7 @@ if ($savemsg)
"This is generally set to your LAN network"); ?>.
</td>
</tr>
<tr id="local_opts">
<tr id="local_optsv6">
<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Local Network"); ?></td>
<td width="78%" class="vtable">
<input name="local_networkv6" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['local_networkv6']);?>">
@ -1205,7 +1211,7 @@ if ($savemsg)
</td>
</tr>
<tr id="remote_opts">
<td width="22%" valign="top" class="vncell"><?=gettext("Remote Network"); ?></td>
<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Remote Network"); ?></td>
<td width="78%" class="vtable">
<input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>">
<br>
@ -1218,6 +1224,20 @@ if ($savemsg)
"you don't want a site-to-site VPN"); ?>.
</td>
</tr>
<tr id="remote_opts">
<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Remote Network"); ?></td>
<td width="78%" class="vtable">
<input name="remote_networkv6" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_networkv6']);?>">
<br>
<?=gettext("This is an IPv6 network that will be routed through " .
"the tunnel, so that a site-to-site VPN can be " .
"established without manually changing the " .
"routing tables. Expressed as an IP/PREFIX. If " .
"this is a site-to-site VPN, enter the " .
"remote LAN here. You may leave this blank if " .
"you don't want a site-to-site VPN"); ?>.
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Concurrent connections");?></td>
<td width="78%" class="vtable">
@ -1578,8 +1598,7 @@ if ($savemsg)
</table>
<br/>
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">