Rework this a little since using tap+tunnel network is valid, but using tap+tunnel network+bridging is not (will not do what the user expects/wants)

This commit is contained in:
jim-p 2011-11-09 12:48:38 -05:00
parent 1ab6bdb5ff
commit 74a556a3ca
2 changed files with 11 additions and 11 deletions

View File

@ -409,12 +409,12 @@ function openvpn_reconfigure($mode, $settings) {
// If the CIDR is less than a /30, OpenVPN will complain if you try to
// use the server directive. It works for a single client without it.
// See ticket #1417
if (($settings['dev_mode'] != "tap") && ($cidr < 30)) {
if (!empty($ip) && !empty($mask) && ($cidr < 30)) {
$conf .= "server {$ip} {$mask}\n";
$conf .= "client-config-dir {$g['varetc_path']}/openvpn-csc\n";
}
case 'p2p_shared_key':
if ($settings['dev_mode'] != "tap") {
if (!empty($ip) && !empty($mask)) {
$baselong = ip2long32($ip) & ip2long($mask);
$ip1 = long2ip32($baselong + 1);
$ip2 = long2ip32($baselong + 2);
@ -424,7 +424,7 @@ function openvpn_reconfigure($mode, $settings) {
case 'server_tls':
case 'server_user':
case 'server_tls_user':
if ($settings['dev_mode'] != "tap") {
if (!empty($ip) && !empty($mask)) {
$conf .= "server {$ip} {$mask}\n";
if(is_ipaddr($ipv6))
$conf .= "server-ipv6 {$ipv6}/{$prefix}\n";

View File

@ -295,6 +295,8 @@ if ($_POST) {
$reqdfields[] = 'tunnel_network';
$reqdfieldsn[] = gettext('Tunnel network');
} else {
if ($pconfig['serverbridge_dhcp'] && $pconfig['tunnel_network'])
$input_errors[] = gettext("Using a tunnel network and server bridge settings together is not allowed.");
if (($pconfig['serverbridge_dhcp_start'] && !$pconfig['serverbridge_dhcp_end'])
|| (!$pconfig['serverbridge_dhcp_start'] && $pconfig['serverbridge_dhcp_end']))
$input_errors[] = gettext("Server Bridge DHCP Start and End must both be empty, or defined.");
@ -603,16 +605,14 @@ function tuntap_change() {
value = document.iform.dev_mode.options[index].value;
switch(value) {
case "tun":
document.getElementById("ipv4_tunnel_network").style.display="";
document.getElementById("ipv6_tunnel_network").style.display="";
document.getElementById("ipv4_tunnel_network").className="vncellreq";
document.getElementById("serverbridge_dhcp").style.display="none";
document.getElementById("serverbridge_interface").style.display="none";
document.getElementById("serverbridge_dhcp_start").style.display="none";
document.getElementById("serverbridge_dhcp_end").style.display="none";
break;
case "tap":
document.getElementById("ipv4_tunnel_network").style.display="none";
document.getElementById("ipv6_tunnel_network").style.display="none";
document.getElementById("ipv4_tunnel_network").className="vncell";
if (!p2p) {
document.getElementById("serverbridge_dhcp").style.display="";
document.getElementById("serverbridge_interface").style.display="";
@ -1052,8 +1052,8 @@ if ($savemsg)
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
</tr>
<tr id="ipv4_tunnel_network">
<td width="22%" valign="top" class="vncellreq"><?=gettext("IPv4 Tunnel Network"); ?></td>
<tr>
<td width="22%" valign="top" class="vncellreq" id="ipv4_tunnel_network"><?=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>
@ -1066,8 +1066,8 @@ if ($savemsg)
"to connecting clients. (see Address Pool)"); ?>
</td>
</tr>
<tr id="ipv6_tunnel_network">
<td width="22%" valign="top" class="vncellreq"><?=gettext("IPv6 Tunnel Network"); ?></td>
<tr>
<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>