diff options
-rw-r--r-- | etc/inc/config.inc | 13 | ||||
-rw-r--r-- | etc/inc/globals.inc | 6 | ||||
-rw-r--r-- | etc/inc/vpn.inc | 9 | ||||
-rwxr-xr-x | etc/rc.banner | 2 | ||||
-rw-r--r-- | usr/local/www/vpn_l2tp.php | 29 | ||||
-rwxr-xr-x | usr/local/www/vpn_pppoe.php | 6 | ||||
-rwxr-xr-x | usr/local/www/vpn_pptp.php | 6 |
7 files changed, 35 insertions, 36 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc index 3f81ab0..6bd22c8 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -317,19 +317,6 @@ function parse_config($parse = false) { update_filter_reload_status("Plugins completed."); } - /* override some global configuration parms if they exist - * instead of hard coding these checks into the codebase - */ - if($config['pptp']['n_pptp_units']) - $g['n_pptp_units'] = $config['pptp']['n_pptp_units']; - if($config['pptp']['pptp_subnet']) - $g['pptp_subnet'] = $config['pptp']['pptp_subnet']; - - if($config['pppoe']['n_pppoe_units']) - $g['n_pppoe_units'] = $config['pppoe']['n_pppoe_units']; - if($config['pppoe']['pppoe_subnet']) - $g['pppoe_subnet'] = $config['pppoe']['pppoe_subnet']; - return $config; } diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc index a2207bf..054ce31 100644 --- a/etc/inc/globals.inc +++ b/etc/inc/globals.inc @@ -57,12 +57,6 @@ $g = array( "product_website" => "www.pfsense.org", "product_website_footer" => "http://www.pfsense.org/?gui20", "product_email" => "coreteam@pfsense.org", - "pppoe_interface" => "ng0", - "n_pptp_units" => 16, /* this value can be overriden in pptp->n_pptp_units */ - "pptp_subnet" => 28, /* this value can be overriden in pptp->pptp_subnet */ - "n_pppoe_units" => 16, /* this value can be overriden in pppoe->n_pppoe_units */ - "pppoe_subnet" => 28, /* this value can be overriden in pppoe->pppoe_subnet */ - "l2tp_subnet" => 28, /* this value can be overriden in l2tp->l2tp_subnet */ "debug" => false, "latest_config" => "5.5", "nopkg_platforms" => array("cdrom"), diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 232fdc9..2167eac 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -926,11 +926,11 @@ pptpd: EOD; - for ($i = 0; $i < $g['n_pptp_units']; $i++) { + for ($i = 0; $i < $pptpdcfg['n_pptp_units']; $i++) { $mpdconf .= " load pt{$i}\n"; } - for ($i = 0; $i < $g['n_pptp_units']; $i++) { + for ($i = 0; $i < $pptpdcfg['n_pptp_units']; $i++) { $clientip = long2ip(ip2long($pptpdcfg['remoteip']) + $i); @@ -1029,7 +1029,7 @@ EOD; $mpdlinks = ""; - for ($i = 0; $i < $g['n_pptp_units']; $i++) { + for ($i = 0; $i < $pptpdcfg['n_pptp_units']; $i++) { $mpdlinks .=<<<EOD pt{$i}: @@ -1310,9 +1310,6 @@ function vpn_l2tp_configure() { switch ($l2tpcfg['mode']) { case 'server' : - - $l2tp_interface = filter_translate_type_to_real_interface($l2tpcfg['interface']); - if ($l2tpcfg['paporchap'] == "chap") $paporchap = "set link enable chap"; else diff --git a/etc/rc.banner b/etc/rc.banner index fe3d914..dc7e257 100755 --- a/etc/rc.banner +++ b/etc/rc.banner @@ -71,11 +71,9 @@ break; case "pppoe": $ifinfo['class'] = "(PPPoE)"; - //$ifinfo['ipaddr'] = $iflist[$g['pppoe_interface']]['ipaddr']; break; case "pptp": $ifinfo['class'] = "(PPTP)"; - //$ifinfo['ipaddr'] = $iflist[$g['pppoe_interface']]['ipaddr']; break; } $ifinfo['ipaddr'] = get_interface_ip($ifinfo['friendly']); diff --git a/usr/local/www/vpn_l2tp.php b/usr/local/www/vpn_l2tp.php index 231eef1..41da308 100644 --- a/usr/local/www/vpn_l2tp.php +++ b/usr/local/www/vpn_l2tp.php @@ -39,6 +39,7 @@ $l2tpcfg = &$config['l2tp']; $pconfig['remoteip'] = $l2tpcfg['remoteip']; $pconfig['localip'] = $l2tpcfg['localip']; +$pconfig['l2tp_subnet'] = $l2tpcfg['l2tp_subnet']; $pconfig['mode'] = $l2tpcfg['mode']; $pconfig['interface'] = $l2tpcfg['interface']; $pconfig['radiusenable'] = isset($l2tpcfg['radius']['enable']); @@ -70,7 +71,7 @@ if ($_POST) { if (($_POST['localip'] && !is_ipaddr($_POST['localip']))) { $input_errors[] = gettext("A valid server address must be specified."); } - if (($_POST['subnet'] && !is_ipaddr($_POST['remoteip']))) { + if (($_POST['l2tp_subnet'] && !is_ipaddr($_POST['remoteip']))) { $input_errors[] = gettext("A valid remote start address must be specified."); } if (($_POST['radiusserver'] && !is_ipaddr($_POST['radiusserver']))) { @@ -84,9 +85,9 @@ if ($_POST) { } if (!$input_errors) { - $_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $g['l2tp_subnet']); + $_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $_POST['l2tp_subnet']); $subnet_start = ip2long($_POST['remoteip']); - $subnet_end = ip2long($_POST['remoteip']) + $g['n_l2tp_units'] - 1; + $subnet_end = ip2long($_POST['remoteip']) + $_POST['n_l2tp_units'] - 1; if ((ip2long($_POST['localip']) >= $subnet_start) && (ip2long($_POST['localip']) <= $subnet_end)) { @@ -107,6 +108,7 @@ if ($_POST) { if (!$input_errors) { $l2tpcfg['remoteip'] = $_POST['remoteip']; $l2tpcfg['localip'] = $_POST['localip']; + $l2tpcfg['l2tp_subnet'] = $_POST['l2tp_subnet']; $l2tpcfg['mode'] = $_POST['mode']; $l2tpcfg['interface'] = $_POST['interface']; $l2tpcfg['n_l2tp_units'] = $_POST['n_l2tp_units']; @@ -168,6 +170,7 @@ function enable_change(enable_over) { if ((get_radio_value(document.iform.mode) == "server") || enable_over) { document.iform.remoteip.disabled = 0; document.iform.localip.disabled = 0; + document.iform.l2tp_subnet.disabled = 0; document.iform.radiusenable.disabled = 0; document.iform.radiusissueips.disabled = 0; document.iform.paporchap.disabled = 0; @@ -176,6 +179,7 @@ function enable_change(enable_over) { /* fix colors */ document.iform.remoteip.style.backgroundColor = '#FFFFFF'; document.iform.localip.style.backgroundColor = '#FFFFFF'; + document.iform.l2tp_subnet.style.backgroundColor = '#FFFFFF'; document.iform.radiusenable.style.backgroundColor = '#FFFFFF'; document.iform.radiusissueips.style.backgroundColor = '#FFFFFF'; document.iform.paporchap.style.backgroundColor = '#FFFFFF'; @@ -205,6 +209,7 @@ function enable_change(enable_over) { } else { document.iform.interface.disabled = 1; document.iform.n_l2tp_units.disabled = 1; + document.iform.l2tp_subnet.disabled = 1; document.iform.paporchap.disabled = 1; document.iform.remoteip.disabled = 1; document.iform.localip.disabled = 1; @@ -216,6 +221,7 @@ function enable_change(enable_over) { /* fix colors */ document.iform.interface.style.backgroundColor = '#D4D0C8'; document.iform.n_l2tp_units.style.backgroundColor = '#D4D0C8'; + document.iform.l2tp_subnet.style.backgroundColor = '#D4D0C8'; document.iform.paporchap.style.backgroundColor = '#D4D0C8'; document.iform.remoteip.style.backgroundColor = '#D4D0C8'; document.iform.localip.style.backgroundColor = '#D4D0C8'; @@ -296,6 +302,23 @@ function enable_change(enable_over) { </td> </tr> <tr> + <td width="22%" valign="top" class="vncellreq">Subnet netmask</td> + <td width="78%" class="vtable"> + <select id="l2tp_subnet" name="l2tp_subnet"> + <?php + for($x=0; $x<33; $x++) { + if($x == $pconfig['l2tp_subnet']) + $SELECTED = " SELECTED"; + else + $SELECTED = ""; + echo "<option value=\"{$x}\"{$SELECTED}>{$x}</option>\n"; + } + ?> + </select> + <br>Hint: 24 is 255.255.255.0 + </td> + </tr> + <tr> <td width="22%" valign="top" class="vncellreq">No. L2TP users</td> <td width="78%" class="vtable"> <select id="n_l2tp_units" name="n_l2tp_units"> diff --git a/usr/local/www/vpn_pppoe.php b/usr/local/www/vpn_pppoe.php index 2faa4f1..12c6cd8 100755 --- a/usr/local/www/vpn_pppoe.php +++ b/usr/local/www/vpn_pppoe.php @@ -89,7 +89,7 @@ if ($_POST) { if (($_POST['localip'] && !is_ipaddr($_POST['localip']))) { $input_errors[] = "A valid server address must be specified."; } - if (($_POST['subnet'] && !is_ipaddr($_POST['remoteip']))) { + if (($_POST['pppoe_subnet'] && !is_ipaddr($_POST['remoteip']))) { $input_errors[] = "A valid remote start address must be specified."; } if (($_POST['radiusserver'] && !is_ipaddr($_POST['radiusserver']))) { @@ -97,9 +97,9 @@ if ($_POST) { } if (!$input_errors) { - $_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $g['pppoe_subnet']); + $_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $_POST['pppoe_subnet']); $subnet_start = ip2long($_POST['remoteip']); - $subnet_end = ip2long($_POST['remoteip']) + $g['pppoe_subnet'] - 1; + $subnet_end = ip2long($_POST['remoteip']) + $_POST['pppoe_subnet'] - 1; if ((ip2long($_POST['localip']) >= $subnet_start) && (ip2long($_POST['localip']) <= $subnet_end)) { diff --git a/usr/local/www/vpn_pptp.php b/usr/local/www/vpn_pptp.php index 0bd1070..0ffff02 100755 --- a/usr/local/www/vpn_pptp.php +++ b/usr/local/www/vpn_pptp.php @@ -89,7 +89,7 @@ if ($_POST) { if (($_POST['localip'] && !is_ipaddr($_POST['localip']))) { $input_errors[] = "A valid server address must be specified."; } - if (($_POST['subnet'] && !is_ipaddr($_POST['remoteip']))) { + if (($_POST['pptp_subnet'] && !is_ipaddr($_POST['remoteip']))) { $input_errors[] = "A valid remote start address must be specified."; } if (($_POST['radiusserver'] && !is_ipaddr($_POST['radiusserver']))) { @@ -97,9 +97,9 @@ if ($_POST) { } if (!$input_errors) { - $_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $g['pptp_subnet']); + $_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $_POST['pptp_subnet']); $subnet_start = ip2long($_POST['remoteip']); - $subnet_end = ip2long($_POST['remoteip']) + $g['n_pptp_units'] - 1; + $subnet_end = ip2long($_POST['remoteip']) + $_POST['n_pptp_units'] - 1; if ((ip2long($_POST['localip']) >= $subnet_start) && (ip2long($_POST['localip']) <= $subnet_end)) { |