summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-05-24 13:39:38 -0400
committerjim-p <jimp@pfsense.org>2011-05-24 13:39:38 -0400
commit4e12754d1ae3405a8910686a7fa0bb012c01d8da (patch)
tree992e1af1d1bdabb1b3886412e9778f75c93e98c5
parentbdb6bd30651fc219acf5a0171752164d680a1c7b (diff)
downloadpfsense-4e12754d1ae3405a8910686a7fa0bb012c01d8da.zip
pfsense-4e12754d1ae3405a8910686a7fa0bb012c01d8da.tar.gz
Fix automatic and manual outbound NAT for PPTP. Fixes #954
-rw-r--r--etc/inc/filter.inc10
-rwxr-xr-xusr/local/www/firewall_nat_out.php12
2 files changed, 8 insertions, 14 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index bdb3541..f0c718a 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -1326,12 +1326,10 @@ function filter_nat_rules_generate() {
}
}
/* PPTP subnet */
- if(isset($FilterIflist['pptp']) && $FilterIflist['pptp']['mode'] == "server" ) {
- $pptp_subnet = $FilterIflist['pptp']['sn'];
- if(is_private_ip($FilterIflist['pptp']['sa']) && !empty($pptp_subnet)) {
- $numberofnathosts++;
- $tonathosts .= "{$FilterIflist['pptp']['sa']}/{$pptp_subnet} ";
- }
+ if(($config['pptpd']['mode'] == "server" ) && is_private_ip($config['pptpd']['remoteip'])) {
+ $pptp_subnets = ip_range_to_subnet_array($config['pptpd']['remoteip'], long2ip32(ip2long($config['pptpd']['remoteip'])+$config['pptpd']['n_pptp_units']));
+ $numberofnathosts += count($pptp_subnets);
+ $tonathosts .= implode(" ", $pptp_subnets) . " ";
}
/* PPPoE subnet */
if(isset($FilterIflist['pppoe']) && $FilterIflist['pppoe']['mode'] == "server") {
diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php
index 4649795..e6b5900 100755
--- a/usr/local/www/firewall_nat_out.php
+++ b/usr/local/www/firewall_nat_out.php
@@ -126,15 +126,11 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
$a_out[] = $natent;
/* PPTP subnet */
- if($config['pptpd']['mode'] == "server") {
- if (is_ipaddr($config['pptpd']['localip'])) {
- if($config['pptpd']['pptp_subnet'] <> "")
- $ossubnet = $config['pptpd']['pptp_subnet'];
- else
- $ossubnet = "32";
- $osn = gen_subnet($config['pptpd']['localip'], $ossubnet);
+ if (($config['pptpd']['mode'] == "server") && is_private_ip($config['pptpd']['remoteip'])) {
+ $pptp_subnets = ip_range_to_subnet_array($config['pptpd']['remoteip'], long2ip32(ip2long($config['pptpd']['remoteip'])+$config['pptpd']['n_pptp_units']));
+ foreach ($pptp_subnets as $pptpsn) {
$natent = array();
- $natent['source']['network'] = "{$osn}/{$ossubnet}";
+ $natent['source']['network'] = $pptpsn;
$natent['sourceport'] = "";
$natent['descr'] = gettext("Auto created rule for PPTP server");
$natent['target'] = "";
OpenPOWER on IntegriCloud