[netfilter-cvslog] r4004 - trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter

laforge at netfilter.org laforge at netfilter.org
Sun Jun 26 14:45:47 CEST 2005


Author: laforge at netfilter.org
Date: 2005-06-26 14:45:46 +0200 (Sun, 26 Jun 2005)
New Revision: 4004

Modified:
   trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_conntrack_pptp.c
   trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_nat_pptp.c
Log:
we only look at 16 bits of gre key anymore. this simplifies gre-key/callid handling


Modified: trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_conntrack_pptp.c
===================================================================
--- trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_conntrack_pptp.c	2005-06-26 12:03:43 UTC (rev 4003)
+++ trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_conntrack_pptp.c	2005-06-26 12:45:46 UTC (rev 4004)
@@ -97,18 +97,18 @@
 	DEBUGP("completing tuples with ct info\n");
 	/* we can do this, since we're unconfirmed */
 	if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u.gre.key == 
-		htonl(master->help.ct_pptp_info.pac_call_id)) {	
+		htons(master->help.ct_pptp_info.pac_call_id)) {	
 		/* assume PNS->PAC */
 		ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.gre.key = 
-			htonl(master->help.ct_pptp_info.pns_call_id);
+			htons(master->help.ct_pptp_info.pns_call_id);
 		ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.gre.key =
-			htonl(master->help.ct_pptp_info.pns_call_id);
+			htons(master->help.ct_pptp_info.pns_call_id);
 	} else {
 		/* assume PAC->PNS */
 		ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.gre.key =
-			htonl(master->help.ct_pptp_info.pac_call_id);
+			htons(master->help.ct_pptp_info.pac_call_id);
 		ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.gre.key =
-			htonl(master->help.ct_pptp_info.pac_call_id);
+			htons(master->help.ct_pptp_info.pac_call_id);
 	}
 	
 #ifdef FIXME_LATER
@@ -179,19 +179,19 @@
 	struct ip_conntrack_tuple exp_tuples[] = {
 		/* tuple in original direction, PNS->PAC */
 		{ .src = { .ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip,
-			   .u = { .gre = { .key = htonl(ntohs(peer_callid)) } }
+			   .u = { .gre = { .key = peer_callid } }
 			 },
 		  .dst = { .ip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip,
-			   .u = { .gre = { .key = htonl(ntohs(callid)) } },
+			   .u = { .gre = { .key = callid } },
 			   .protonum = IPPROTO_GRE
 			 },
 		 },
 		/* tuple in reply direction, PAC->PNS */
 		{ .src = { .ip = master->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip,
-			   .u = { .gre = { .key = htonl(ntohs(callid)) } }
+			   .u = { .gre = { .key = callid } }
 			 },
 		  .dst = { .ip = master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip,
-			   .u = { .gre = { .key = htonl(ntohs(peer_callid)) } },
+			   .u = { .gre = { .key = peer_callid } },
 			   .protonum = IPPROTO_GRE
 			 },
 		 }

Modified: trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_nat_pptp.c
===================================================================
--- trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_nat_pptp.c	2005-06-26 12:03:43 UTC (rev 4003)
+++ trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_nat_pptp.c	2005-06-26 12:45:46 UTC (rev 4004)
@@ -91,34 +91,34 @@
 		DEBUGP("completing tuples with NAT info \n");
 		/* we can do this, since we're unconfirmed */
 		if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u.gre.key ==
-			htonl(ct_pptp_info->pac_call_id)) {	
+			htons(ct_pptp_info->pac_call_id)) {	
 			/* assume PNS->PAC */
 			ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.gre.key =
-				htonl(nat_pptp_info->pns_call_id);
+				htons(nat_pptp_info->pns_call_id);
 			ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.gre.key =
-				htonl(nat_pptp_info->pns_call_id);
+				htons(nat_pptp_info->pns_call_id);
 			newip = master->tuplehash[IP_CT_DIR_REPLY].tuple.src.ip;
-			newcid = htonl(nat_pptp_info->pac_call_id);
+			newcid = htons(nat_pptp_info->pac_call_id);
 		} else {
 			/* assume PAC->PNS */
 			ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.gre.key =
-				htonl(nat_pptp_info->pac_call_id);
+				htons(nat_pptp_info->pac_call_id);
 			ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.gre.key =
-				htonl(nat_pptp_info->pac_call_id);
+				htons(nat_pptp_info->pac_call_id);
 			newip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip;
-			newcid = htonl(nat_pptp_info->pns_call_id);
+			newcid = htons(nat_pptp_info->pns_call_id);
 		}
 	} else {
 		if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u.gre.key ==
-			htonl(ct_pptp_info->pac_call_id)) {	
+			htons(ct_pptp_info->pac_call_id)) {	
 			/* assume PNS->PAC */
 			newip = master->tuplehash[IP_CT_DIR_REPLY].tuple.dst.ip;
-			newcid = htonl(ct_pptp_info->pns_call_id);
+			newcid = htons(ct_pptp_info->pns_call_id);
 		}
 		else {
 			/* assume PAC->PNS */
 			newip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.ip;
-			newcid = htonl(ct_pptp_info->pac_call_id);
+			newcid = htons(ct_pptp_info->pac_call_id);
 		}
 	}
 
@@ -128,7 +128,7 @@
 		((union ip_conntrack_manip_proto ) { newcid }); 
 	DEBUGP("change ip to %u.%u.%u.%u\n", 
 		NIPQUAD(newip));
-	DEBUGP("change key to 0x%x\n", ntohl(newcid));
+	DEBUGP("change key to 0x%x\n", ntohs(newcid));
 	ip_nat_setup_info(ct, &range, hooknum);
 
 	UNLOCK_BH(&ip_pptp_lock);
@@ -267,20 +267,20 @@
 		reply_t = &ct->tuplehash[IP_CT_DIR_REPLY].tuple;
 		if (t.src.ip == orig_t->src.ip && t.dst.ip == orig_t->dst.ip) {
 			/* expectation for PNS->PAC direction */
-			t.src.u.gre.key = htonl(nat_pptp_info->pns_call_id);
-			t.dst.u.gre.key = htonl(ct_pptp_info->pac_call_id);
+			t.src.u.gre.key = htons(nat_pptp_info->pns_call_id);
+			t.dst.u.gre.key = htons(ct_pptp_info->pac_call_id);
 			inv_t.src.ip = reply_t->src.ip;
 			inv_t.dst.ip = reply_t->dst.ip;
-			inv_t.src.u.gre.key = htonl(nat_pptp_info->pac_call_id);
-			inv_t.dst.u.gre.key = htonl(ct_pptp_info->pns_call_id);
+			inv_t.src.u.gre.key = htons(nat_pptp_info->pac_call_id);
+			inv_t.dst.u.gre.key = htons(ct_pptp_info->pns_call_id);
 		} else {
 			/* expectation for PAC->PNS direction */
-			t.src.u.gre.key = htonl(nat_pptp_info->pac_call_id);
-			t.dst.u.gre.key = htonl(ct_pptp_info->pns_call_id);
+			t.src.u.gre.key = htons(nat_pptp_info->pac_call_id);
+			t.dst.u.gre.key = htons(ct_pptp_info->pns_call_id);
 			inv_t.src.ip = orig_t->src.ip;
 			inv_t.dst.ip = orig_t->dst.ip;
-			inv_t.src.u.gre.key = htonl(nat_pptp_info->pns_call_id);
-			inv_t.dst.u.gre.key = htonl(ct_pptp_info->pac_call_id);
+			inv_t.src.u.gre.key = htons(nat_pptp_info->pns_call_id);
+			inv_t.dst.u.gre.key = htons(ct_pptp_info->pac_call_id);
 		}
 
 		if (!ip_conntrack_expect_related(oldexp)) {




More information about the netfilter-cvslog mailing list