Skip to contentSkip to conversation

PPTP helper: Fix endianness bug in GRE key / CallID NAT

PATCH In review Harald Welte 1 participant 1 message Nov 3, 2005

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

PATCH 2/2 PPTP helper: Fix endianness bug in GRE key / CallID NAT

Hi Acme!

Please merge this to both 2.6.15 mainline and 2.6.14.x stable series, thanks.

[NETFILTER] PPTP helper: Fix endianness bug in GRE key / CallID NAT

This endianness bug slipped through while changing the 'gre.key' field in the conntrack tuple from 32bit to 16bit.

None of my tests caught the problem, since the linux pptp client always has '0' as call id / gre key. Only windows clients actually trigger the bug.

---
commit 66d73ebf14b8bb18647eabca9975d7ceb787cb29
tree b92bab972b99c11ead4ca05d152ab78f741fc41f
parent f6447dcd8a4f13b144c9f49df76682c31562a003
author Harald Welte <[email protected]> Thu, 03 Nov 2005 12:55:06 +0100 committer Harald Welte <[email protected]> Thu, 03 Nov 2005 12:55:06 +0100

 net/ipv4/netfilter/ip_nat_proto_gre.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/netfilter/ip_nat_proto_gre.c +2 -2
@@ -139,8 +139,8 @@ gre_manip_pkt(struct sk_buff **pskb,
 			break;
 		case GRE_VERSION_PPTP:
 			DEBUGP("call_id -> 0x%04x\n", 
-				ntohl(tuple->dst.u.gre.key));
-			pgreh->call_id = htons(ntohl(tuple->dst.u.gre.key));
+				ntohs(tuple->dst.u.gre.key));
+			pgreh->call_id = tuple->dst.u.gre.key;
 			break;
 		default:
 			DEBUGP("can't nat unknown GRE version\n");
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