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

pablo at netfilter.org pablo at netfilter.org
Fri Oct 28 02:29:25 CEST 2005


Author: pablo at netfilter.org
Date: 2005-10-28 02:29:24 +0200 (Fri, 28 Oct 2005)
New Revision: 4393

Modified:
   trunk/conntrack/ChangeLog
   trunk/conntrack/extensions/libct_proto_icmp.c
   trunk/conntrack/extensions/libct_proto_sctp.c
   trunk/conntrack/extensions/libct_proto_tcp.c
   trunk/conntrack/extensions/libct_proto_udp.c
   trunk/conntrack/include/conntrack.h
   trunk/conntrack/src/conntrack.c
Log:
See ChangeLog



Modified: trunk/conntrack/ChangeLog
===================================================================
--- trunk/conntrack/ChangeLog	2005-10-28 00:28:35 UTC (rev 4392)
+++ trunk/conntrack/ChangeLog	2005-10-28 00:29:24 UTC (rev 4393)
@@ -1,3 +1,13 @@
+2005-10-28
+<pablo at eurodev.net>
+	o New option -i for dumping: conntrack -L [-i]
+	o Fixed warning in findproto due to a stupid wrong type definition
+	o sed 's/nfct_set_callback/nfct_register_callback/g'
+	o killed the 'retry' logic, *sigh* it is broken in some cases
+	o killed broken and unneeded protocol handler destructors (fini)
+	o killed unregister_proto
+	o Bumped version to 0.93
+
 2005-10-27
 <pablo at eurodev.net>
 	o Use conntrack VERSION instead of the old LIBCT_VERSION

Modified: trunk/conntrack/extensions/libct_proto_icmp.c
===================================================================
--- trunk/conntrack/extensions/libct_proto_icmp.c	2005-10-28 00:28:35 UTC (rev 4392)
+++ trunk/conntrack/extensions/libct_proto_icmp.c	2005-10-28 00:29:24 UTC (rev 4393)
@@ -109,14 +109,8 @@
 };
 
 void __attribute__ ((constructor)) init(void);
-void __attribute__ ((destructor)) fini(void);
 
 void init(void)
 {
 	register_proto(&icmp);
 }
-
-void fini(void)
-{
-	unregister_proto(&icmp);
-}

Modified: trunk/conntrack/extensions/libct_proto_sctp.c
===================================================================
--- trunk/conntrack/extensions/libct_proto_sctp.c	2005-10-28 00:28:35 UTC (rev 4392)
+++ trunk/conntrack/extensions/libct_proto_sctp.c	2005-10-28 00:29:24 UTC (rev 4393)
@@ -147,14 +147,8 @@
 };
 
 void __attribute__ ((constructor)) init(void);
-void __attribute__ ((destructor)) fini(void);
 
 void init(void)
 {
 	register_proto(&sctp);
 }
-
-void fini(void)
-{
-	unregister_proto(&sctp);
-}

Modified: trunk/conntrack/extensions/libct_proto_tcp.c
===================================================================
--- trunk/conntrack/extensions/libct_proto_tcp.c	2005-10-28 00:28:35 UTC (rev 4392)
+++ trunk/conntrack/extensions/libct_proto_tcp.c	2005-10-28 00:29:24 UTC (rev 4393)
@@ -170,14 +170,8 @@
 };
 
 void __attribute__ ((constructor)) init(void);
-void __attribute__ ((destructor)) fini(void);
 
 void init(void)
 {
 	register_proto(&tcp);
 }
-
-void fini(void)
-{
-	unregister_proto(&tcp);
-}

Modified: trunk/conntrack/extensions/libct_proto_udp.c
===================================================================
--- trunk/conntrack/extensions/libct_proto_udp.c	2005-10-28 00:28:35 UTC (rev 4392)
+++ trunk/conntrack/extensions/libct_proto_udp.c	2005-10-28 00:29:24 UTC (rev 4393)
@@ -135,14 +135,8 @@
 };
 
 void __attribute__ ((constructor)) init(void);
-void __attribute__ ((destructor)) fini(void);
 
 void init(void)
 {
 	register_proto(&udp);
 }
-
-void fini(void)
-{
-	unregister_proto(&udp);
-}

Modified: trunk/conntrack/include/conntrack.h
===================================================================
--- trunk/conntrack/include/conntrack.h	2005-10-28 00:28:35 UTC (rev 4392)
+++ trunk/conntrack/include/conntrack.h	2005-10-28 00:29:24 UTC (rev 4393)
@@ -6,7 +6,7 @@
 #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
 
 #define PROGNAME "conntrack"
-#define VERSION "0.92"
+#define VERSION "0.93"
 
 /* FIXME: These should be independent from kernel space */
 #define IPS_ASSURED (1 << 2)
@@ -43,7 +43,6 @@
 };
 
 extern void register_proto(struct ctproto_handler *h);
-extern void unregister_proto(struct ctproto_handler *h);
 
 #define NIPQUAD(addr) \
 	((unsigned char *)&addr)[0], \

Modified: trunk/conntrack/src/conntrack.c
===================================================================
--- trunk/conntrack/src/conntrack.c	2005-10-28 00:28:35 UTC (rev 4392)
+++ trunk/conntrack/src/conntrack.c	2005-10-28 00:29:24 UTC (rev 4393)
@@ -193,7 +193,7 @@
 	{"mask-dst", 1, 0, '}'},
 	{"nat-range", 1, 0, 'a'},
 	{"mark", 1, 0, 'm'},
-	{"id", 1, 0, 'i'},
+	{"id", 2, 0, 'i'},
 	{0, 0, 0, 0}
 };
 
@@ -218,7 +218,7 @@
 /* Well, it's better than "Re: Linux vs FreeBSD" */
 {
           /*   -s  -d  -r  -q  -p  -t  -u  -z  -e  -x  -y  -k  -l  -a  -m  -i*/
-/*CT_LIST*/   {'x','x','x','x','x','x','x',' ','x','x','x','x','x','x','x','x'},
+/*CT_LIST*/   {'x','x','x','x','x','x','x',' ','x','x','x','x','x','x','x',' '},
 /*CT_CREATE*/ {' ',' ',' ',' ','+','+','+','x','x','x','x','x','x',' ',' ','x'},
 /*CT_UPDATE*/ {' ',' ',' ',' ','+','+','+','x','x','x','x','x','x','x',' ',' '},
 /*CT_DELETE*/ {' ',' ',' ',' ',' ','x','x','x','x','x','x','x','x','x','x',' '},
@@ -249,15 +249,10 @@
 	list_add(&h->head, &proto_list);
 }
 
-void unregister_proto(struct ctproto_handler *h)
+static struct ctproto_handler *findproto(char *name)
 {
-	list_del(&h->head);
-}
-
-static struct nfct_proto *findproto(char *name)
-{
 	struct list_head *i;
-	struct nfct_proto *cur = NULL, *handler = NULL;
+	struct ctproto_handler *cur = NULL, *handler = NULL;
 
 	if (!name) 
 		return handler;
@@ -267,7 +262,7 @@
 		lib_dir = CONNTRACK_LIB_DIR;
 
 	list_for_each(i, &proto_list) {
-		cur = (struct nfct_proto *) i;
+		cur = (struct ctproto_handler *) i;
 		if (strcmp(cur->name, name) == 0) {
 			handler = cur;
 			break;
@@ -717,7 +712,7 @@
 	unsigned int id = NFCT_ANY_ID;
 	unsigned int type = 0, extra_flags = 0, event_mask = 0;
 	int manip = -1;
-	int res = 0, retry = 2;
+	int res = 0;
 
 	memset(&proto, 0, sizeof(union nfct_protoinfo));
 	memset(&orig, 0, sizeof(struct nfct_tuple));
@@ -727,7 +722,7 @@
 	memset(&range, 0, sizeof(struct nfct_nat));
 
 	while ((c = getopt_long(argc, argv, 
-		"L::I::U::D::G::E::F::hVs:d:r:q:p:t:u:e:a:z[:]:{:}:m:i:", 
+		"L::I::U::D::G::E::F::hVs:d:r:q:p:t:u:e:a:z[:]:{:}:m:i::", 
 		opts, NULL)) != -1) {
 	switch(c) {
 		case 'L':
@@ -866,7 +861,9 @@
 			mark = atol(optarg);
 			break;
 		case 'i':
-			id = atol(optarg);
+			options |= CT_OPT_ID;
+			if (optarg)
+				id = atol(optarg);
 			break;
 		default:
 			if (h && h->parse_opts 
@@ -896,14 +893,17 @@
 		exit_error(PARAMETER_PROBLEM, "Missing protocol arguments!\n");
 	}
 
-	while (retry > 0) {
-		retry--;
 		switch(command) {
 		case CT_LIST:
 			cth = nfct_open(CONNTRACK, NFCT_ANY_GROUP);
 			if (!cth)
 				exit_error(OTHER_PROBLEM, "Not enough memory");
-			nfct_set_callback(cth, nfct_default_conntrack_display);
+
+			if (options & CT_OPT_ID)
+				nfct_register_callback(cth, nfct_default_conntrack_display_id);
+			else
+				nfct_register_callback(cth, nfct_default_conntrack_display);
+			
 			if (options & CT_OPT_ZERO)
 				res = nfct_dump_conntrack_table_reset_counters(cth);
 			else
@@ -915,7 +915,7 @@
 			cth = nfct_open(EXPECT, NFCT_ANY_GROUP);
 			if (!cth)
 				exit_error(OTHER_PROBLEM, "Not enough memory");
-			nfct_set_callback(cth, nfct_default_expect_display);
+			nfct_register_callback(cth, nfct_default_expect_display);
 			res = nfct_dump_expect_list(cth);
 			nfct_close(cth);
 			break;
@@ -1029,7 +1029,7 @@
 			cth = nfct_open(CONNTRACK, NFCT_ANY_GROUP);
 			if (!cth)
 				exit_error(OTHER_PROBLEM, "Not enough memory");
-			nfct_set_callback(cth, nfct_default_conntrack_display);
+			nfct_register_callback(cth, nfct_default_conntrack_display);
 			if (options & CT_OPT_ORIG)
 				res = nfct_get_conntrack(cth, &orig,
 							 NFCT_DIR_ORIGINAL, id);
@@ -1043,7 +1043,7 @@
 			cth = nfct_open(EXPECT, NFCT_ANY_GROUP);
 			if (!cth)
 				exit_error(OTHER_PROBLEM, "Not enough memory");
-			nfct_set_callback(cth, nfct_default_expect_display);
+			nfct_register_callback(cth, nfct_default_expect_display);
 			if (options & CT_OPT_ORIG)
 				res = nfct_get_expectation(cth, &orig, id);
 			else if (options & CT_OPT_REPL)
@@ -1074,7 +1074,7 @@
 					exit_error(OTHER_PROBLEM, 
 						   "Not enough memory");
 				signal(SIGINT, event_sighandler);
-				nfct_set_callback(cth, nfct_default_conntrack_display);
+				nfct_register_callback(cth, nfct_default_conntrack_display);
 				res = nfct_event_conntrack(cth);
 			} else {
 				cth = nfct_open(CONNTRACK, NFCT_ANY_GROUP);
@@ -1082,7 +1082,7 @@
 					exit_error(OTHER_PROBLEM, 
 						   "Not enough memory");
 				signal(SIGINT, event_sighandler);
-				nfct_set_callback(cth, nfct_default_conntrack_display);
+				nfct_register_callback(cth, nfct_default_conntrack_display);
 				res = nfct_event_conntrack(cth);
 			}
 			nfct_close(cth);
@@ -1095,7 +1095,7 @@
 					exit_error(OTHER_PROBLEM, 
 						   "Not enough memory");
 				signal(SIGINT, event_sighandler);
-				nfct_set_callback(cth, nfct_default_expect_display);
+				nfct_register_callback(cth, nfct_default_expect_display);
 				res = nfct_event_expectation(cth);
 			} else {
 				cth = nfct_open(EXPECT, NFCT_ANY_GROUP);
@@ -1103,7 +1103,7 @@
 					exit_error(OTHER_PROBLEM, 
 						   "Not enough memory");
 				signal(SIGINT, event_sighandler);
-				nfct_set_callback(cth, nfct_default_expect_display);
+				nfct_register_callback(cth, nfct_default_expect_display);
 				res = nfct_event_expectation(cth);
 			}
 			nfct_close(cth);
@@ -1121,13 +1121,6 @@
 			usage(argv[0]);
 			break;
 		}
-		/* Maybe ip_conntrack_netlink isn't insmod'ed */
-		if (res < 0 && retry)
-			/* Give it a try just once */
-			iptables_insmod("ip_conntrack_netlink", NULL);
-		else
-			retry--;
-	}
 
 	if (opts != original_opts) {
 		free(opts);




More information about the netfilter-cvslog mailing list