[netfilter-cvslog] r4231 - in trunk/conntrack: . extensions src

pablo at netfilter.org pablo at netfilter.org
Mon Aug 8 13:43:53 CEST 2005


Author: pablo at netfilter.org
Date: 2005-08-08 13:43:51 +0200 (Mon, 08 Aug 2005)
New Revision: 4231

Modified:
   trunk/conntrack/Makefile.am
   trunk/conntrack/config.h.in
   trunk/conntrack/configure.in
   trunk/conntrack/extensions/libct_proto_sctp.c
   trunk/conntrack/extensions/libct_proto_tcp.c
   trunk/conntrack/extensions/libct_proto_udp.c
   trunk/conntrack/src/conntrack.c
   trunk/conntrack/src/libct.c
Log:
Bumped version to 0.80



Modified: trunk/conntrack/Makefile.am
===================================================================
--- trunk/conntrack/Makefile.am	2005-08-08 11:40:51 UTC (rev 4230)
+++ trunk/conntrack/Makefile.am	2005-08-08 11:43:51 UTC (rev 4231)
@@ -5,7 +5,7 @@
 INCLUDES  = $(all_includes) -I$(top_srcdir)/include -I${KERNELDIR}
 SUBDIRS   = src extensions
 DIST_SUBDIRS = include src extensions
-LINKOPTS  = -ldl -lnfnetlink -lctnetlink
+LINKOPTS  = -ldl -lnfnetlink -lnfnetlink_conntrack
 AM_CFLAGS = -g
 
 $(OBJECTS): libtool

Modified: trunk/conntrack/config.h.in
===================================================================
--- trunk/conntrack/config.h.in	2005-08-08 11:40:51 UTC (rev 4230)
+++ trunk/conntrack/config.h.in	2005-08-08 11:43:51 UTC (rev 4231)
@@ -6,15 +6,16 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
-/* Define to 1 if you have the `ctnetlink' library (-lctnetlink). */
-#undef HAVE_LIBCTNETLINK
-
 /* Define to 1 if you have the `dl' library (-ldl). */
 #undef HAVE_LIBDL
 
 /* Define to 1 if you have the `nfnetlink' library (-lnfnetlink). */
 #undef HAVE_LIBNFNETLINK
 
+/* Define to 1 if you have the `nfnetlink_conntrack' library
+   (-lnfnetlink_conntrack). */
+#undef HAVE_LIBNFNETLINK_CONNTRACK
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 

Modified: trunk/conntrack/configure.in
===================================================================
--- trunk/conntrack/configure.in	2005-08-08 11:40:51 UTC (rev 4230)
+++ trunk/conntrack/configure.in	2005-08-08 11:43:51 UTC (rev 4231)
@@ -22,7 +22,7 @@
 
 AC_CHECK_LIB([dl], [dlopen])
 AC_CHECK_LIB([nfnetlink], [nfnl_listen])
-AC_CHECK_LIB([ctnetlink], [ctnl_register_handler] ,,,[-lnfnetlink])
+AC_CHECK_LIB([nfnetlink_conntrack], [ctnl_register_handler] ,,,[-lnfnetlink])
 
 # Checks for header files.
 dnl AC_HEADER_STDC

Modified: trunk/conntrack/extensions/libct_proto_sctp.c
===================================================================
--- trunk/conntrack/extensions/libct_proto_sctp.c	2005-08-08 11:40:51 UTC (rev 4230)
+++ trunk/conntrack/extensions/libct_proto_sctp.c	2005-08-08 11:43:51 UTC (rev 4231)
@@ -14,7 +14,7 @@
 #include <netinet/in.h> /* For htons */
 #include <linux/netfilter/nfnetlink_conntrack.h>
 #include "libct_proto.h"
-#include "libctnetlink.h"
+#include <libnfnetlink_conntrack/libnfnetlink_conntrack.h>
 
 static struct option opts[] = {
 	{"orig-port-src", 1, 0, '1'},

Modified: trunk/conntrack/extensions/libct_proto_tcp.c
===================================================================
--- trunk/conntrack/extensions/libct_proto_tcp.c	2005-08-08 11:40:51 UTC (rev 4230)
+++ trunk/conntrack/extensions/libct_proto_tcp.c	2005-08-08 11:43:51 UTC (rev 4231)
@@ -14,7 +14,7 @@
 #include <netinet/in.h> /* For htons */
 #include <linux/netfilter/nfnetlink_conntrack.h>
 #include "libct_proto.h"
-#include "libctnetlink.h"
+#include <libnfnetlink_conntrack/libnfnetlink_conntrack.h>
 
 static struct option opts[] = {
 	{"orig-port-src", 1, 0, '1'},

Modified: trunk/conntrack/extensions/libct_proto_udp.c
===================================================================
--- trunk/conntrack/extensions/libct_proto_udp.c	2005-08-08 11:40:51 UTC (rev 4230)
+++ trunk/conntrack/extensions/libct_proto_udp.c	2005-08-08 11:43:51 UTC (rev 4231)
@@ -13,7 +13,7 @@
 #include <netinet/in.h> /* For htons */
 #include <linux/netfilter/nfnetlink_conntrack.h>
 #include "libct_proto.h"
-#include "libctnetlink.h"
+#include <libnfnetlink_conntrack/libnfnetlink_conntrack.h>
 
 static struct option opts[] = {
 	{"orig-port-src", 1, 0, '1'},

Modified: trunk/conntrack/src/conntrack.c
===================================================================
--- trunk/conntrack/src/conntrack.c	2005-08-08 11:40:51 UTC (rev 4230)
+++ trunk/conntrack/src/conntrack.c	2005-08-08 11:43:51 UTC (rev 4231)
@@ -47,7 +47,7 @@
 #include "libct_proto.h"
 
 #define PROGNAME "conntrack"
-#define VERSION "0.63"
+#define VERSION "0.80"
 
 #if 0
 #define DEBUGP printf
@@ -880,13 +880,11 @@
 		case EXP_CREATE:
 			if (options & CT_OPT_ORIG)
 				res = create_expectation(&orig, 
-							 CTA_TUPLE_ORIG,
 							 &exptuple,
 							 &mask,
 							 timeout);
 			else if (options & CT_OPT_REPL)
 				res = create_expectation(&reply,
-							 CTA_TUPLE_REPLY,
 							 &exptuple,
 							 &mask,
 							 timeout);
@@ -917,16 +915,16 @@
 
 		case EXP_DELETE:
 			if (options & CT_OPT_ORIG)
-				res = delete_expectation(&orig, CTA_TUPLE_ORIG);
+				res = delete_expectation(&orig);
 			else if (options & CT_OPT_REPL)
-				res = delete_expectation(&reply, CTA_TUPLE_REPLY);
+				res = delete_expectation(&reply);
 			break;
 
 		case CT_GET:
 			if (options & CT_OPT_ORIG)
-				res = get_conntrack(&orig, CTA_TUPLE_ORIG, id);
+				res = get_conntrack(&orig, id);
 			else if (options & CT_OPT_REPL)
-				res = get_conntrack(&reply, CTA_TUPLE_REPLY, id);
+				res = get_conntrack(&reply, id);
 			break;
 
 		case EXP_GET:

Modified: trunk/conntrack/src/libct.c
===================================================================
--- trunk/conntrack/src/libct.c	2005-08-08 11:40:51 UTC (rev 4230)
+++ trunk/conntrack/src/libct.c	2005-08-08 11:43:51 UTC (rev 4231)
@@ -162,7 +162,7 @@
 			parse_tuple(attr, &ct.tuple[CTNL_DIR_REPLY]);
 			break;
 		case CTA_STATUS:
-			ct.status = ntohl(*(unsigned int *)NFA_DATA(attr));
+			ct.status = *(unsigned int *)NFA_DATA(attr);
 			flags |= STATUS;
 			break;
 		case CTA_PROTOINFO:
@@ -268,25 +268,6 @@
 	return handler(sock, nlh, arg);
 }
 
-void parse_expect(struct nfattr *attr, struct ctnl_tuple *tuple, 
-		  struct ctnl_tuple *mask, unsigned long *timeout,
-		  u_int32_t *id)
-{
-	struct nfattr *tb[CTA_EXPECT_MAX];
-
-	memset(tb, 0, CTA_EXPECT_MAX*sizeof(struct nfattr *));
-
-	nfnl_parse_nested(tb, CTA_EXPECT_MAX, attr);
-	if (tb[CTA_EXPECT_TUPLE-1])
-		parse_tuple(tb[CTA_EXPECT_TUPLE-1], tuple);
-	if (tb[CTA_EXPECT_MASK-1])
-		parse_tuple(tb[CTA_EXPECT_MASK-1], mask);
-	if (tb[CTA_EXPECT_TIMEOUT-1])
-		*timeout = htonl(*(unsigned long *)NFA_DATA(tb[CTA_EXPECT_TIMEOUT-1]));
-	if (tb[CTA_EXPECT_ID-1])
-		*id = htonl(*(u_int32_t *)NFA_DATA(tb[CTA_EXPECT_ID-1]));
-}
-
 static int expect_handler(struct sockaddr_nl *sock, struct nlmsghdr *nlh, void *arg)
 {
 	struct nfgenmsg *nfmsg;
@@ -310,10 +291,20 @@
 
 	while (NFA_OK(attr, attrlen)) {
 		switch(attr->nfa_type) {
-			case CTA_EXPECT:
-				parse_expect(attr, &tuple, &mask, &timeout,
-					     &id);
+
+			case CTA_EXPECT_TUPLE:
+				parse_tuple(attr, &tuple);
 				break;
+			case CTA_EXPECT_MASK:
+				parse_tuple(attr, &mask);
+				break;
+			case CTA_EXPECT_TIMEOUT:
+				timeout = htonl(*(unsigned long *)
+						NFA_DATA(attr));
+				break;
+			case CTA_EXPECT_ID:
+				id = htonl(*(u_int32_t *)NFA_DATA(attr));	
+				break;
 		}
 		attr = NFA_NEXT(attr, attrlen);
 	}
@@ -348,12 +339,12 @@
 	ct.tuple[CTNL_DIR_ORIGINAL] = *orig;
 	ct.tuple[CTNL_DIR_REPLY] = *reply;
 	ct.timeout = htonl(timeout);
-	ct.status = htonl(status);
+	ct.status = status;
 	ct.protoinfo = *proto;
 	if (range)
 		ct.nat = *range;
 	
-	if ((ret = ctnl_open(&cth, 0)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK, 0)) < 0)
 		return ret;
 
 	ret = ctnl_new_conntrack(&cth, &ct);
@@ -376,10 +367,10 @@
 	ct.tuple[CTNL_DIR_ORIGINAL] = *orig;
 	ct.tuple[CTNL_DIR_REPLY] = *reply;
 	ct.timeout = htonl(timeout);
-	ct.status = htonl(status);
+	ct.status = status;
 	ct.protoinfo = *proto;
 	
-	if ((ret = ctnl_open(&cth, 0)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK, 0)) < 0)
 		return ret;
 
 	ret = ctnl_upd_conntrack(&cth, &ct);
@@ -393,7 +384,7 @@
 {
 	int ret;
 
-	if ((ret = ctnl_open(&cth, 0)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK, 0)) < 0)
 		return ret;
 
 	ret = ctnl_del_conntrack(&cth, tuple, dir);
@@ -411,7 +402,7 @@
 	};
 	int ret;
 
-	if ((ret = ctnl_open(&cth, 0)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK, 0)) < 0)
 		return ret;
 
 	ctnl_register_handler(&cth, &h);
@@ -430,7 +421,7 @@
 		.handler = handler
 	};
 	
-	if ((ret = ctnl_open(&cth, 0)) < 0) 
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK, 0)) < 0) 
 		return ret;
 
 	ctnl_register_handler(&cth, &h);
@@ -463,7 +454,7 @@
 	};
 	int ret;
 
-	if ((ret = ctnl_open(&cth, event_mask)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK, event_mask)) < 0)
 		return ret;
 
 	signal(SIGINT, event_sighandler);
@@ -527,7 +518,7 @@
 	};
 	int ret;
 
-	if ((ret = ctnl_open(&cth, 0)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK_EXP, 0)) < 0)
 		return ret;
 
 	ctnl_register_handler(&cth, &h);
@@ -542,7 +533,7 @@
 {
 	int ret;
 	
-	if ((ret = ctnl_open(&cth, 0)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK, 0)) < 0)
 		return ret;
 
 	ret = ctnl_flush_conntrack(&cth);
@@ -551,8 +542,7 @@
 	return ret;
 }
 
-int get_expect(struct ctnl_tuple *tuple,
-	       enum ctattr_type t)
+int get_expect(struct ctnl_tuple *tuple)
 {
 	struct ctnl_msg_handler h = {
 		.type = IPCTNL_MSG_EXP_NEW,
@@ -560,43 +550,42 @@
 	};
 	int ret;
 
-	if ((ret = ctnl_open(&cth, 0)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK_EXP, 0)) < 0)
 		return 0;
 
 	ctnl_register_handler(&cth, &h);
 
-	ret = ctnl_get_expect(&cth, tuple, t);
+	ret = ctnl_get_expect(&cth, tuple);
 	ctnl_close(&cth);
 
 	return ret;
 }
 
 int create_expectation(struct ctnl_tuple *tuple,
-		       enum ctattr_type t,
 		       struct ctnl_tuple *exptuple,
 		       struct ctnl_tuple *mask,
 		       unsigned long timeout)
 {
 	int ret;
 	
-	if ((ret = ctnl_open(&cth, 0)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK_EXP, 0)) < 0)
 		return ret;
 
 
-	ret = ctnl_new_expect(&cth, tuple, t, exptuple, mask, timeout);
+	ret = ctnl_new_expect(&cth, tuple, exptuple, mask, timeout);
 	ctnl_close(&cth);
 
 	return ret;
 }
 
-int delete_expectation(struct ctnl_tuple *tuple, enum ctattr_type t)
+int delete_expectation(struct ctnl_tuple *tuple)
 {
 	int ret;
 	
-	if ((ret = ctnl_open(&cth, 0)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK_EXP, 0)) < 0)
 		return ret;
 
-	ret = ctnl_del_expect(&cth, tuple, t);
+	ret = ctnl_del_expect(&cth, tuple);
 	ctnl_close(&cth);
 
 	return ret;
@@ -614,7 +603,7 @@
 	};
 	int ret;
 	
-	if ((ret = ctnl_open(&cth, event_mask)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK_EXP, event_mask)) < 0)
 		return ret;
 
 	ctnl_register_handler(&cth, &hnew);
@@ -629,7 +618,7 @@
 {
 	int ret;
 	
-	if ((ret = ctnl_open(&cth, 0)) < 0)
+	if ((ret = ctnl_open(&cth, NFNL_SUBSYS_CTNETLINK_EXP, 0)) < 0)
 		return ret;
 
 	ret = ctnl_flush_expect(&cth);




More information about the netfilter-cvslog mailing list