Skip to contentSkip to conversation

pptp & NAT

DISCUSSION Sebastian Böhm 5 participants 6 messages Nov 4, 2005 – Nov 16, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

i finally got pptp and NAT working with the patch for bug #397 <https://bugzilla.netfilter.org/bugzilla/show_bug.cgi?id=397>.

Two questions left:

- 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)

- 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 ?

Thank you very much !

/sebastian

#1 lore raw
Quoted 7 lines · Sebastian Böhm

- 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.

Quoted 5 lines

- 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.

net/ipv4/netfilter/ip_nat_helper_pptp.c +26 -2
diff -u -p -u -r1.1.1.1 ip_nat_helper_pptp.c
@@ -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;
#2 lore raw
Quoted 2 lines · Philip Craig

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.

With this patch applied, it's working for me.

Quoted 8 lines
Quoted 5 lines

- 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.

Using the endian fix patch and this patch (both are attached to bug 397), this is working for me on a 2.6.14 kernel (really, git HEAD from yesterday plus these two patches). I've got 2 clients, one WindowsXP, one Fedora Core 4, hitting the same PPTP server at the same time. Sincere thanks to both you and Harald for this effort!

Thanks,
Matt

author
#3 lore raw

Am 05.11.2005 um 15:22 schrieb Matt Domsch:

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

- 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 ?

Quoted 9 lines
Quoted 2 lines

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

Using the endian fix patch and this patch (both are attached to bug 397), this is working for me on a 2.6.14 kernel (really, git HEAD from yesterday plus these two patches). I've got 2 clients, one WindowsXP, one Fedora Core 4, hitting the same PPTP server at the same time. Sincere thanks to both you and Harald for this effort!

what is not working for is to connect two pptp-servers from one client machine!

/sebastian

#4 lore raw
Quoted 9 lines · Sebastian

Am 05.11.2005 um 15:22 schrieb Matt Domsch:

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

- 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.

Quoted 7 lines
Quoted 5 lines

Using the endian fix patch and this patch (both are attached to bug 397), this is working for me on a 2.6.14 kernel (really, git HEAD from yesterday plus these two patches). I've got 2 clients, one WindowsXP, one Fedora Core 4, hitting the same PPTP server at the same time. Sincere thanks to both you and Harald for this effort!

what is not working for is to connect two pptp-servers from one client machine!

that should work even without any helper. could you please try with no pptp helpers loaded and verify it works?

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#5 lore raw

Hwo to applu this Re: pptp & NAT

In reply to Sebastian Böhm

Please!

Who could help me saying how to apply this patch??

https://bugzilla.netfilter.org/bugzilla/show_bug.cgi?id=397

Tks

----- Original Message ----- From: "Sebastian Böhm" <[email protected]>
To: <[email protected]>
Sent: Friday, November 04, 2005 1:53 AM
Subject: pptp & NAT

Quoted 19 lines

Hi,

i finally got pptp and NAT working with the patch for bug #397 <https://bugzilla.netfilter.org/bugzilla/show_bug.cgi?id=397>.

Two questions left:

- 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)

- 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 ?

Thank you very much !

/sebastian