Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Philip Craig <philipc@snapgear.com>
To: "Sebastian Böhm" <seb@exse.net>
Cc: netfilter@lists.netfilter.org
Subject: Re: pptp & NAT
Date: Fri, 04 Nov 2005 14:00:59 +1000	[thread overview]
Message-ID: <436ADCFB.6070201@snapgear.com> (raw)
In-Reply-To: <436ADB4C.7070800@exse.net>

[-- Attachment #1: Type: text/plain, Size: 1035 bytes --]

On 11/04/2005 01:53 PM, Sebastian Böhm wrote:
> - sometimes (every 10th connection attempt or so) the connections fails 
> with "GRE: read(fd=5,buffer=8056720,len=8260) from network failed: 
> status = -1 error = Protocol
> not available" reading in the server logs. I use windows clients with 
> linux server. somewhere I read that I should load ip_gre on the firewall 
> or block a specific icmp packet, is that correct ? (I dont like to block 
> icmp, icmp is there for reason)

Please try the attached patch.  It has fixed a problem for someone else,
and I think this problem may be the same, but I'm not sure.

> - I am unable to estabish two pptp connections from one client, I can 
> connect to one pptp server and I can connect to a second pptp server, 
> but the second connection never accepts any traffic, when I stop the 
> first connection, the second connection begins to work. Is this a bug or 
> a known missing feature ?

This is intended to work.  I haven't personally tested it in
2.6.14 though.

[-- Attachment #2: pptp-2.6.14.patch --]
[-- Type: text/plain, Size: 2093 bytes --]

diff -u -p -u -r1.1.1.1 ip_nat_helper_pptp.c
--- linux-2.6.x/net/ipv4/netfilter/ip_nat_helper_pptp.c	28 Oct 2005 04:39:25 -0000	1.1.1.1
+++ linux-2.6.x/net/ipv4/netfilter/ip_nat_helper_pptp.c	3 Nov 2005 09:18:01 -0000
@@ -73,6 +73,7 @@ static void pptp_nat_expected(struct ip_
 	struct ip_conntrack_tuple t;
 	struct ip_ct_pptp_master *ct_pptp_info;
 	struct ip_nat_pptp *nat_pptp_info;
+	struct ip_nat_range range;
 
 	ct_pptp_info = &master->help.ct_pptp_info;
 	nat_pptp_info = &master->nat.help.nat_pptp_info;
@@ -110,7 +111,30 @@ static void pptp_nat_expected(struct ip_
 		DEBUGP("not found!\n");
 	}
 
-	ip_nat_follow_master(ct, exp);
+	/* This must be a fresh one. */
+	BUG_ON(ct->status & IPS_NAT_DONE_MASK);
+
+	/* Change src to where master sends to */
+	range.flags = IP_NAT_RANGE_MAP_IPS;
+	range.min_ip = range.max_ip
+		= ct->master->tuplehash[!exp->dir].tuple.dst.ip;
+	if (exp->dir == IP_CT_DIR_ORIGINAL) {
+		range.flags |= IP_NAT_RANGE_PROTO_SPECIFIED;
+		range.min = range.max = exp->saved_proto;
+	}
+	/* hook doesn't matter, but it has to do source manip */
+	ip_nat_setup_info(ct, &range, NF_IP_POST_ROUTING);
+
+	/* For DST manip, map port here to where it's expected. */
+	range.flags = IP_NAT_RANGE_MAP_IPS;
+	range.min_ip = range.max_ip
+		= ct->master->tuplehash[!exp->dir].tuple.src.ip;
+	if (exp->dir == IP_CT_DIR_REPLY) {
+		range.flags |= IP_NAT_RANGE_PROTO_SPECIFIED;
+		range.min = range.max = exp->saved_proto;
+	}
+	/* hook doesn't matter, but it has to do destination manip */
+	ip_nat_setup_info(ct, &range, NF_IP_PRE_ROUTING);
 }
 
 /* outbound packets == from PNS to PAC */
@@ -213,7 +237,7 @@ pptp_exp_gre(struct ip_conntrack_expect 
 
 	/* alter expectation for PNS->PAC direction */
 	invert_tuplepr(&inv_t, &expect_orig->tuple);
-	expect_orig->saved_proto.gre.key = htons(nat_pptp_info->pac_call_id);
+	expect_orig->saved_proto.gre.key = htons(ct_pptp_info->pns_call_id);
 	expect_orig->tuple.src.u.gre.key = htons(nat_pptp_info->pns_call_id);
 	expect_orig->tuple.dst.u.gre.key = htons(ct_pptp_info->pac_call_id);
 	inv_t.src.ip = reply_t->src.ip;

  reply	other threads:[~2005-11-04  4:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-04  3:53 pptp & NAT Sebastian Böhm
2005-11-04  4:00 ` Philip Craig [this message]
2005-11-05 14:22   ` Matt Domsch
2005-11-05 22:48     ` Sebastian
2005-11-06  9:26       ` Harald Welte
2005-11-16 14:05 ` Hwo to applu this " Sebastião Antônio Campos (GWA)
  -- strict thread matches above, loose matches on Subject: below --
2007-03-09 16:33 PPTP NAT Andrei-Florian Staicu
     [not found] <1042821169.13896.22.camel@torwood>
2003-01-18 15:41 ` Harald Welte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=436ADCFB.6070201@snapgear.com \
    --to=philipc@snapgear.com \
    --cc=netfilter@lists.netfilter.org \
    --cc=seb@exse.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox