net/pptp: change listen IP to interface for #1106

This breaks compatibility, but it seems to solve issues with setups.

Suggested by: @mibofra
This commit is contained in:
Franco Fichtner
2018-12-30 12:26:02 +00:00
parent 9f924b119f
commit 735bed8942
4 changed files with 59 additions and 54 deletions
+1 -5
View File
@@ -53,7 +53,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['paporchap'] = $l2tpcfg['paporchap'];
$pconfig['secret'] = $l2tpcfg['secret'];
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
unset($input_errors);
$pconfig = $_POST;
/* input validation */
@@ -225,7 +224,7 @@ include("head.inc");
</td>
</tr>
<tr>
<td><a id="help_for_n_l2tp_units" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Number of L2TP users"); ?></td>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Number of L2TP users"); ?></td>
<td>
<select id="n_l2tp_units" name="n_l2tp_units">
<?php
@@ -240,9 +239,6 @@ include("head.inc");
}
?>
</select>
<div class="hidden" data-for="help_for_n_l2tp_units">
<?=gettext("Hint: 10 is ten L2TP clients"); ?>
</div>
</td>
</tr>
<tr>
+1 -2
View File
@@ -1,6 +1,5 @@
PLUGIN_NAME= pptp
PLUGIN_VERSION= 1.7
PLUGIN_REVISION= 2
PLUGIN_VERSION= 1.8
PLUGIN_DEPENDS= clog mpd5
PLUGIN_COMMENT= PPTP server based on MPD5
PLUGIN_MAINTAINER= franco@opnsense.org
@@ -1,7 +1,7 @@
<?php
/*
* Coypright (C) 2016-2017 Franco Fichtner <franco@opnsense.org>
* Coypright (C) 2016-2018 Franco Fichtner <franco@opnsense.org>
* Copyright (C) 2008 Shrew Soft Inc. <mgrooms@shrew.net>
* Copyright (C) 2008 Ermal Luçi
* Copyright (C) 2004 Scott Ullrich <sullrich@gmail.com>
@@ -127,6 +127,8 @@ function if_pptp_configure_do()
return 1;
}
$selfip = get_interface_ip($pptpdcfg['interface']);
$iprange = $pptpdcfg['remoteip'] . ' ';
$iprange .= long2ip32(ip2long($pptpdcfg['remoteip']) + $pptpdcfg['n_pptp_units'] - 1);
@@ -158,7 +160,7 @@ EOD;
}
$mpdconf .= "\n";
} elseif (isset($config['dnsmasq']['enable']) || isset($config['unbound']['enable'])) {
$mpdconf .= " set ipcp dns " . get_interface_ip("lan");
$mpdconf .= " set ipcp dns {$selfip}";
if (isset($syscfg['dnsserver'][0])) {
$mpdconf .= " " . $syscfg['dnsserver'][0];
}
@@ -195,7 +197,7 @@ EOD;
set link enable chap-msv2
set link mtu 1460
set link keep-alive 10 60
set pptp self {$pptpdcfg['localip']}
set pptp self {$selfip}
set link enable incoming
EOD;
+52 -44
View File
@@ -1,31 +1,31 @@
<?php
/*
Copyright (C) 2014-2016 Deciso B.V.
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
* Copyright (C) 2014-2016 Deciso B.V.
* Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
require_once('guiconfig.inc');
require_once('interfaces.inc');
@@ -43,6 +43,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['wins'] = $pptpcfg['wins'];
$pconfig['req128'] = isset($pptpcfg['req128']);
$pconfig['n_pptp_units'] = $pptpcfg['n_pptp_units'];
$pconfig['interface'] = $pptpcfg['interface'];
$pconfig['pptp_dns1'] = $pptpcfg['dns1'];
$pconfig['pptp_dns2'] = $pptpcfg['dns2'];
$pconfig['radiusenable'] = isset($pptpcfg['radius']['server']['enable']);
@@ -60,9 +61,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['radius_acct_update'] = $pptpcfg['radius']['acct_update'];
$pconfig['radius_nasip'] = $pptpcfg['radius']['nasip'];
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($input_errors) && count($input_errors) > 0) {
unset($input_errors);
}
$pconfig = $_POST;
/* input validation */
@@ -107,6 +105,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pptpcfg['remoteip'] = $_POST['remoteip'];
$pptpcfg['localip'] = $_POST['localip'];
$pptpcfg['mode'] = $_POST['mode'];
$pptpcfg['interface'] = $_POST['interface'];
$pptpcfg['wins'] = $_POST['wins'];
$pptpcfg['n_pptp_units'] = $_POST['n_pptp_units'];
$pptpcfg['radius']['server']['ip'] = $_POST['radiusserver'];
@@ -213,24 +212,15 @@ include("head.inc");
</td>
</tr>
<tr>
<td><a id="help_for_n_pptp_units" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("No. PPTP users"); ?></td>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("Interface");?></td>
<td>
<select id="n_pptp_units" name="n_pptp_units">
<?php
$toselect = ($pconfig['n_pptp_units'] > 0) ? $pconfig['n_pptp_units'] : 16;
for ($x=1; $x<255; $x++) {
if ($x == $toselect) {
$SELECTED = " selected=\"selected\"";
} else {
$SELECTED = "";
}
echo "<option value=\"{$x}\"{$SELECTED}>{$x}</option>\n";
}
?>
<select name="interface" class="form-control" id="interface">
<?php foreach (get_configured_interface_with_descr() as $iface => $ifacename): ?>
<option value="<?=$iface;?>" <?=$iface == $pconfig['interface'] ? "selected=\"selected\"" : "";?>>
<?=htmlspecialchars($ifacename);?>
</option>
<?php endforeach ?>
</select>
<div class="hidden" data-for="help_for_n_pptp_units">
<?=gettext("Hint: 10 is ten PPTP clients"); ?>
</div>
</td>
</tr>
<tr>
@@ -251,6 +241,24 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?= gettext('Number of PPTP users') ?></td>
<td>
<select id="n_pptp_units" name="n_pptp_units">
<?php
$toselect = ($pconfig['n_pptp_units'] > 0) ? $pconfig['n_pptp_units'] : 16;
for ($x=1; $x<255; $x++) {
if ($x == $toselect) {
$SELECTED = " selected=\"selected\"";
} else {
$SELECTED = "";
}
echo "<option value=\"{$x}\"{$SELECTED}>{$x}</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td><a id="help_for_pptp_dns" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("PPTP DNS Servers"); ?></td>
<td>