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

laforge at netfilter.org laforge at netfilter.org
Tue Jun 14 18:03:32 CEST 2005


Author: laforge at netfilter.org
Date: 2005-06-14 18:03:32 +0200 (Tue, 14 Jun 2005)
New Revision: 3982

Modified:
   trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_conntrack_proto_gre.c
   trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_nat_proto_gre.c
Log:
first steps to merge it in post-2.6.11 api


Modified: trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_conntrack_proto_gre.c
===================================================================
--- trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_conntrack_proto_gre.c	2005-06-13 01:06:10 UTC (rev 3981)
+++ trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_conntrack_proto_gre.c	2005-06-14 16:03:32 UTC (rev 3982)
@@ -1,5 +1,5 @@
 /*
- * ip_conntrack_proto_gre.c - Version 2.0 
+ * ip_conntrack_proto_gre.c - Version 3.0 
  *
  * Connection tracking protocol helper module for GRE.
  *
@@ -17,7 +17,7 @@
  *
  * Documentation about PPTP can be found in RFC 2637
  *
- * (C) 2000-2004 by Harald Welte <laforge at gnumonks.org>
+ * (C) 2000-2005 by Harald Welte <laforge at gnumonks.org>
  *
  * Development of this code funded by Astaro AG (http://www.astaro.com/)
  *
@@ -96,9 +96,10 @@
 	return key;
 }
 
-/* add a single keymap entry, associate with specified expect */
-int ip_ct_gre_keymap_add(struct ip_conntrack_expect *exp,
-			 struct ip_conntrack_tuple *t, int reply)
+/* add a single keymap entry, associate with specified master ct */
+int
+ip_ct_gre_keymap_add(struct ip_conntrack *ct,
+		     struct ip_conntrack_tuple *t, int reply)
 {
 	struct ip_ct_gre_keymap *km;
 
@@ -112,9 +113,9 @@
 	memcpy(&km->tuple, t, sizeof(*t));
 
 	if (!reply)
-		exp->proto.gre.keymap_orig = km;
+		ct->proto.gre.keymap_orig = km;
 	else
-		exp->proto.gre.keymap_reply = km;
+		ct->proto.gre.keymap_reply = km;
 
 	DEBUGP("adding new entry %p: ", km);
 	DUMP_TUPLE_GRE(&km->tuple);
@@ -138,22 +139,22 @@
 	WRITE_UNLOCK(&ip_ct_gre_lock);
 }
 
-/* destroy the keymap entries associated with specified expect */
-void ip_ct_gre_keymap_destroy(struct ip_conntrack_expect *exp)
+/* destroy the keymap entries associated with specified master ct */
+void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct)
 {
 	DEBUGP("entering for exp %p\n", exp);
 	WRITE_LOCK(&ip_ct_gre_lock);
-	if (exp->proto.gre.keymap_orig) {
-		DEBUGP("removing %p from list\n", exp->proto.gre.keymap_orig);
-		list_del(&exp->proto.gre.keymap_orig->list);
-		kfree(exp->proto.gre.keymap_orig);
-		exp->proto.gre.keymap_orig = NULL;
+	if (ct->proto.gre.keymap_orig) {
+		DEBUGP("removing %p from list\n", ct->proto.gre.keymap_orig);
+		list_del(&ct->proto.gre.keymap_orig->list);
+		kfree(ct->proto.gre.keymap_orig);
+		ct->proto.gre.keymap_orig = NULL;
 	}
-	if (exp->proto.gre.keymap_reply) {
-		DEBUGP("removing %p from list\n", exp->proto.gre.keymap_reply);
-		list_del(&exp->proto.gre.keymap_reply->list);
-		kfree(exp->proto.gre.keymap_reply);
-		exp->proto.gre.keymap_reply = NULL;
+	if (ct->proto.gre.keymap_reply) {
+		DEBUGP("removing %p from list\n", ct->proto.gre.keymap_reply);
+		list_del(&ct->proto.gre.keymap_reply->list);
+		kfree(ct->proto.gre.keymap_reply);
+		ct->proto.gre.keymap_reply = NULL;
 	}
 	WRITE_UNLOCK(&ip_ct_gre_lock);
 }
@@ -241,7 +242,7 @@
 
 /* Returns verdict for packet, and may modify conntrack */
 static int gre_packet(struct ip_conntrack *ct,
-		      struct sk_buff *skb,
+		      const struct sk_buff *skb,
 		      enum ip_conntrack_info conntrackinfo)
 {
 	/* If we've seen traffic both ways, this is a GRE connection.
@@ -277,12 +278,12 @@
  * and is about to be deleted from memory */
 static void gre_destroy(struct ip_conntrack *ct)
 {
-	struct ip_conntrack_expect *master = ct->master;
+	struct ip_conntrack *master = ct->master;
 
 	DEBUGP(" entering\n");
 
 	if (!master) {
-		DEBUGP("no master exp for ct %p\n", ct);
+		DEBUGP("no master conntrack for gre-ct %p\n", ct);
 		return;
 	}
 
@@ -300,7 +301,6 @@
 	.packet		 = gre_packet,
 	.new		 = gre_new,
 	.destroy	 = gre_destroy,
-	.exp_matches_pkt = NULL,
 	.me 		 = THIS_MODULE
 };
 

Modified: trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_nat_proto_gre.c
===================================================================
--- trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_nat_proto_gre.c	2005-06-13 01:06:10 UTC (rev 3981)
+++ trunk/patch-o-matic-ng/pptp-conntrack-nat/linux-2.6.11/net/ipv4/netfilter/ip_nat_proto_gre.c	2005-06-14 16:03:32 UTC (rev 3982)
@@ -68,7 +68,7 @@
 		 const struct ip_conntrack *conntrack)
 {
 	u_int32_t min, i, range_size;
-	u_int32_t key = 0, *keyptr;
+	u_int16_t key = 0, *keyptr;
 
 	if (maniptype == IP_NAT_MANIP_SRC)
 		keyptr = &tuple->src.u.gre.key;
@@ -101,7 +101,7 @@
 static int
 gre_manip_pkt(struct sk_buff **pskb,
 	      unsigned int iphdroff,
-	      const struct ip_conntrack_manip *manip,
+	      const struct ip_conntrack_tuple *tuple,
 	      enum ip_nat_manip_type maniptype)
 {
 	struct gre_hdr *greh;
@@ -131,15 +131,15 @@
 				/* FIXME: Never tested this code... */
 				*(gre_csum(greh)) = 
 					ip_nat_cheat_check(~*(gre_key(greh)),
-							manip->u.gre.key,
+							tuple->dst.u.gre.key,
 							*(gre_csum(greh)));
 			}
-			*(gre_key(greh)) = manip->u.gre.key;
+			*(gre_key(greh)) = tuple->dst.u.gre.key;
 			break;
 		case GRE_VERSION_PPTP:
 			DEBUGP("call_id -> 0x%04x\n", 
-				ntohl(manip->u.gre.key));
-			pgreh->call_id = htons(ntohl(manip->u.gre.key));
+				ntohl(tuple->dst.u.gre.key));
+			pgreh->call_id = htons(ntohl(tuple->dst.u.gre.key));
 			break;
 		default:
 			DEBUGP("can't nat unknown GRE version\n");




More information about the netfilter-cvslog mailing list