[netfilter-cvslog] r7384 - in trunk/libnetfilter_conntrack: include src src/conntrack src/deprecated/extensions src/deprecated/l3extensions

pablo at netfilter.org pablo at netfilter.org
Fri Feb 22 23:59:18 CET 2008


Author: pablo at netfilter.org
Date: 2008-02-22 23:59:18 +0100 (Fri, 22 Feb 2008)
New Revision: 7384

Added:
   trunk/libnetfilter_conntrack/src/deprecated/extensions/Makefile.am
   trunk/libnetfilter_conntrack/src/deprecated/l3extensions/Makefile.am
Removed:
   trunk/libnetfilter_conntrack/src/deprecated/extensions/Makefile.am
   trunk/libnetfilter_conntrack/src/deprecated/l3extensions/Makefile.am
Modified:
   trunk/libnetfilter_conntrack/include/internal.h
   trunk/libnetfilter_conntrack/src/Makefile.am
   trunk/libnetfilter_conntrack/src/conntrack/snprintf_default.c
   trunk/libnetfilter_conntrack/src/conntrack/snprintf_xml.c
   trunk/libnetfilter_conntrack/src/deprecated.c
   trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_icmp.c
   trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_sctp.c
   trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_tcp.c
   trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_udp.c
   trunk/libnetfilter_conntrack/src/deprecated/l3extensions/libnetfilter_conntrack_ipv4.c
   trunk/libnetfilter_conntrack/src/deprecated/l3extensions/libnetfilter_conntrack_ipv6.c
   trunk/libnetfilter_conntrack/src/main.c
Log:
- fix broken 'deprecated backward compatibility'
- fix glibc 2.7.20 compilation (based on patch from Paul P. Konkoff)


Modified: trunk/libnetfilter_conntrack/include/internal.h
===================================================================
--- trunk/libnetfilter_conntrack/include/internal.h	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/include/internal.h	2008-02-22 22:59:18 UTC (rev 7384)
@@ -214,4 +214,13 @@
 int __snprintf_expect(char *buf, unsigned int len, const struct nf_expect *exp, unsigned int type, unsigned int msg_output, unsigned int flags);
 int __snprintf_expect_default(char *buf, unsigned int len, const struct nf_expect *exp, unsigned int msg_type, unsigned int flags);
 
+/* backward compatibility of the deprecated API */
+extern struct nfct_l3proto ipv4;
+extern struct nfct_l3proto ipv6;
+
+extern struct nfct_proto tcp;
+extern struct nfct_proto udp;
+extern struct nfct_proto sctp;
+extern struct nfct_proto icmp;
+
 #endif

Modified: trunk/libnetfilter_conntrack/src/Makefile.am
===================================================================
--- trunk/libnetfilter_conntrack/src/Makefile.am	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/Makefile.am	2008-02-22 22:59:18 UTC (rev 7384)
@@ -13,7 +13,6 @@
 
 libnetfilter_conntrack_la_LIBADD = conntrack/libnfconntrack.la \
 				   expect/libnfexpect.la \
-			# deprecated extensions: scheduled to be removed
 			deprecated/l3extensions/libnfct_l3proto_ipv4.la \
 			deprecated/l3extensions/libnfct_l3proto_ipv6.la \
 			deprecated/extensions/libnfct_proto_tcp.la \

Modified: trunk/libnetfilter_conntrack/src/conntrack/snprintf_default.c
===================================================================
--- trunk/libnetfilter_conntrack/src/conntrack/snprintf_default.c	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/conntrack/snprintf_default.c	2008-02-22 22:59:18 UTC (rev 7384)
@@ -93,8 +93,8 @@
 	struct in6_addr dst;
 	char tmp[INET6_ADDRSTRLEN];
 
-	memcpy(&src.in6_u, &tuple->src.v6, sizeof(struct in6_addr));
-	memcpy(&dst.in6_u, &tuple->dst.v6, sizeof(struct in6_addr));
+	memcpy(&src, &tuple->src.v6, sizeof(struct in6_addr));
+	memcpy(&dst, &tuple->dst.v6, sizeof(struct in6_addr));
 
 	if (!inet_ntop(AF_INET6, &src, tmp, sizeof(tmp)))
 		return -1;

Modified: trunk/libnetfilter_conntrack/src/conntrack/snprintf_xml.c
===================================================================
--- trunk/libnetfilter_conntrack/src/conntrack/snprintf_xml.c	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/conntrack/snprintf_xml.c	2008-02-22 22:59:18 UTC (rev 7384)
@@ -100,7 +100,7 @@
 	static char tmp[INET6_ADDRSTRLEN];
 	const void *p = (type == __ADDR_SRC) ? &tuple->src.v6 : &tuple->dst.v6;
 
-	memcpy(&addr.in6_u, p, sizeof(struct in6_addr));
+	memcpy(&addr, p, sizeof(struct in6_addr));
 
 	if (!inet_ntop(AF_INET6, &addr, tmp, sizeof(tmp)))
 		return -1;

Deleted: trunk/libnetfilter_conntrack/src/deprecated/extensions/Makefile.am
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated/extensions/Makefile.am	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/deprecated/extensions/Makefile.am	2008-02-22 22:59:18 UTC (rev 7384)
@@ -1,14 +0,0 @@
-include $(top_srcdir)/Make_global.am
-
-AUTOMAKE_OPTIONS = no-dependencies foreign
-
-AM_CFLAGS=-fPIC -Wall
-LIBS= @LIBNFCONNTRACK_LIBS@
-
-noinst_LTLIBRARIES = libnfct_proto_tcp.la libnfct_proto_udp.la 	\
-		     libnfct_proto_icmp.la libnfct_proto_sctp.la
-
-libnfct_proto_tcp_la_SOURCES = libnetfilter_conntrack_tcp.c 
-libnfct_proto_udp_la_SOURCES = libnetfilter_conntrack_udp.c
-libnfct_proto_icmp_la_SOURCES = libnetfilter_conntrack_icmp.c
-libnfct_proto_sctp_la_SOURCES = libnetfilter_conntrack_sctp.c

Added: trunk/libnetfilter_conntrack/src/deprecated/extensions/Makefile.am
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated/extensions/Makefile.am	                        (rev 0)
+++ trunk/libnetfilter_conntrack/src/deprecated/extensions/Makefile.am	2008-02-22 22:59:18 UTC (rev 7384)
@@ -0,0 +1,14 @@
+include $(top_srcdir)/Make_global.am
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+
+AM_CFLAGS=-fPIC -Wall
+LIBS= @LIBNFCONNTRACK_LIBS@
+
+noinst_LTLIBRARIES = libnfct_proto_tcp.la libnfct_proto_udp.la 	\
+		     libnfct_proto_icmp.la libnfct_proto_sctp.la
+
+libnfct_proto_tcp_la_SOURCES = libnetfilter_conntrack_tcp.c 
+libnfct_proto_udp_la_SOURCES = libnetfilter_conntrack_udp.c
+libnfct_proto_icmp_la_SOURCES = libnetfilter_conntrack_icmp.c
+libnfct_proto_sctp_la_SOURCES = libnetfilter_conntrack_sctp.c

Modified: trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_icmp.c
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_icmp.c	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_icmp.c	2008-02-22 22:59:18 UTC (rev 7384)
@@ -72,7 +72,7 @@
 	return 1;
 }
 
-static struct nfct_proto icmp = {
+struct nfct_proto icmp = {
 	.name 			= "icmp",
 	.protonum		= IPPROTO_ICMP,
 	.parse_proto		= parse_proto,
@@ -81,10 +81,3 @@
 	.compare		= compare,
 	.version		= VERSION
 };
-
-static void __attribute__ ((constructor)) init(void);
-
-static void init(void)
-{
-	nfct_register_proto(&icmp);
-}

Modified: trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_sctp.c
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_sctp.c	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_sctp.c	2008-02-22 22:59:18 UTC (rev 7384)
@@ -80,7 +80,7 @@
 	return 1;
 }
 
-static struct nfct_proto sctp = {
+struct nfct_proto sctp = {
 	.name 			= "sctp",
 	.protonum		= IPPROTO_SCTP,
 	.parse_proto		= parse_proto,
@@ -91,10 +91,3 @@
 	.compare		= compare,
 	.version		= VERSION
 };
-
-static void __attribute__ ((constructor)) init(void);
-
-static void init(void)
-{
-	nfct_register_proto(&sctp);
-}

Modified: trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_tcp.c
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_tcp.c	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_tcp.c	2008-02-22 22:59:18 UTC (rev 7384)
@@ -121,7 +121,7 @@
 	return 1;
 }
 
-static struct nfct_proto tcp = {
+struct nfct_proto tcp = {
 	.name 			= "tcp",
 	.protonum		= IPPROTO_TCP,
 	.parse_protoinfo	= parse_protoinfo,
@@ -133,10 +133,3 @@
 	.compare		= compare,
 	.version		= VERSION
 };
-
-static void __attribute__ ((constructor)) init(void);
-
-static void init(void)
-{
-	nfct_register_proto(&tcp);
-}

Modified: trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_udp.c
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_udp.c	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/deprecated/extensions/libnetfilter_conntrack_udp.c	2008-02-22 22:59:18 UTC (rev 7384)
@@ -66,7 +66,7 @@
 	return 1;
 }
 
-static struct nfct_proto udp = {
+struct nfct_proto udp = {
 	.name 			= "udp",
 	.protonum		= IPPROTO_UDP,
 	.build_tuple_proto	= build_tuple_proto,
@@ -75,10 +75,3 @@
 	.compare		= compare,
 	.version		= VERSION,
 };
-
-static void __attribute__ ((constructor)) init(void);
-
-static void init(void)
-{
-	nfct_register_proto(&udp);
-}

Deleted: trunk/libnetfilter_conntrack/src/deprecated/l3extensions/Makefile.am
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated/l3extensions/Makefile.am	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/deprecated/l3extensions/Makefile.am	2008-02-22 22:59:18 UTC (rev 7384)
@@ -1,9 +0,0 @@
-include $(top_srcdir)/Make_global.am
-
-AM_CFLAGS=-fPIC -Wall
-LIBS = @LIBNFCONNTRACK_LIBS@
-
-noinst_LTLIBRARIES = libnfct_l3proto_ipv4.la libnfct_l3proto_ipv6.la
-
-libnfct_l3proto_ipv4_la_SOURCES = libnetfilter_conntrack_ipv4.c
-libnfct_l3proto_ipv6_la_SOURCES = libnetfilter_conntrack_ipv6.c

Added: trunk/libnetfilter_conntrack/src/deprecated/l3extensions/Makefile.am
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated/l3extensions/Makefile.am	                        (rev 0)
+++ trunk/libnetfilter_conntrack/src/deprecated/l3extensions/Makefile.am	2008-02-22 22:59:18 UTC (rev 7384)
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Make_global.am
+
+AM_CFLAGS=-fPIC -Wall
+LIBS = @LIBNFCONNTRACK_LIBS@
+
+noinst_LTLIBRARIES = libnfct_l3proto_ipv4.la libnfct_l3proto_ipv6.la
+
+libnfct_l3proto_ipv4_la_SOURCES = libnetfilter_conntrack_ipv4.c
+libnfct_l3proto_ipv6_la_SOURCES = libnetfilter_conntrack_ipv6.c

Modified: trunk/libnetfilter_conntrack/src/deprecated/l3extensions/libnetfilter_conntrack_ipv4.c
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated/l3extensions/libnetfilter_conntrack_ipv4.c	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/deprecated/l3extensions/libnetfilter_conntrack_ipv4.c	2008-02-22 22:59:18 UTC (rev 7384)
@@ -76,7 +76,7 @@
 	return 1;
 }
 
-static struct nfct_l3proto ipv4 = {
+struct nfct_l3proto ipv4 = {
 	.name			= "ipv4",
 	.protonum		= AF_INET,
 	.parse_proto		= parse_proto,
@@ -85,10 +85,3 @@
 	.compare		= compare,
 	.version		= VERSION
 };
-
-static void __attribute__ ((constructor)) init(void);
-
-static void init(void)
-{
-        nfct_register_l3proto(&ipv4);
-}

Modified: trunk/libnetfilter_conntrack/src/deprecated/l3extensions/libnetfilter_conntrack_ipv6.c
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated/l3extensions/libnetfilter_conntrack_ipv6.c	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/deprecated/l3extensions/libnetfilter_conntrack_ipv6.c	2008-02-22 22:59:18 UTC (rev 7384)
@@ -48,8 +48,8 @@
 	char tmp[INET6_ADDRSTRLEN];
 	int size;
 
-	memcpy(&src.in6_u, tuple->src.v6, sizeof(struct in6_addr));
-	memcpy(&dst.in6_u, tuple->dst.v6, sizeof(struct in6_addr));
+	memcpy(&src, tuple->src.v6, sizeof(struct in6_addr));
+	memcpy(&dst, tuple->dst.v6, sizeof(struct in6_addr));
 
 	if (!inet_ntop(AF_INET6, &src, tmp, sizeof(tmp)))
 		return 0;
@@ -97,7 +97,7 @@
 	return 1;
 }
 
-static struct nfct_l3proto ipv6 = {
+struct nfct_l3proto ipv6 = {
 	.name			= "ipv6",
 	.protonum		= AF_INET6,
 	.parse_proto		= parse_proto,
@@ -106,10 +106,3 @@
 	.compare		= compare,
 	.version		= VERSION
 };
-
-static void __attribute__ ((constructor)) init(void);
-
-static void init(void)
-{
-        nfct_register_l3proto(&ipv6);
-}

Modified: trunk/libnetfilter_conntrack/src/deprecated.c
===================================================================
--- trunk/libnetfilter_conntrack/src/deprecated.c	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/deprecated.c	2008-02-22 22:59:18 UTC (rev 7384)
@@ -43,6 +43,17 @@
 static struct nfct_proto *findproto(char *name);
 static struct nfct_l3proto *findl3proto(char *name);
 
+void deprecated_backward_support()
+{
+	nfct_register_l3proto(&ipv4);
+	nfct_register_l3proto(&ipv6);
+
+	nfct_register_proto(&tcp);
+	nfct_register_proto(&udp);
+	nfct_register_proto(&icmp);
+	nfct_register_proto(&sctp);
+}
+
 /* handler used for nfnl_listen */
 static int callback_handler(struct sockaddr_nl *nladdr,
 			    struct nlmsghdr *n, void *arg)
@@ -207,10 +218,6 @@
 	if (!name) 
 		return handler;
 
-	lib_dir = getenv("LIBNETFILTER_CONNTRACK_DIR");
-	if (!lib_dir)
-		lib_dir = LIBNETFILTER_CONNTRACK_DIR;
-
 	list_for_each(i, &proto_list) {
 		cur = (struct nfct_proto *) i;
 		if (strcmp(cur->name, name) == 0) {
@@ -219,15 +226,9 @@
 		}
 	}
 
-	if (!handler) {
-		char path[sizeof("nfct_proto_.so") + strlen(VERSION)
-			 + strlen(name) + strlen(lib_dir)];
-                sprintf(path, "%s/nfct_proto_%s-%s.so", lib_dir, name, VERSION);
-		if (dlopen(path, RTLD_NOW))
-			handler = findproto(name);
-		else
-			fprintf(stderr, "%s\n", dlerror());
-	}
+	if (!handler)
+		fprintf(stderr, "libnetfilter_conntrack: "
+				"cannot find %s handler\n", name);
 
 	return handler;
 }
@@ -240,10 +241,6 @@
 	if (!name) 
 		return handler;
 
-	lib_dir = getenv("LIBNETFILTER_CONNTRACK_DIR");
-	if (!lib_dir)
-		lib_dir = LIBNETFILTER_CONNTRACK_DIR;
-
 	list_for_each(i, &l3proto_list) {
 		cur = (struct nfct_l3proto *) i;
 		if (strcmp(cur->name, name) == 0) {
@@ -252,15 +249,9 @@
 		}
 	}
 
-	if (!handler) {
-		char path[sizeof("nfct_l3proto_.so") + strlen(VERSION)
-			 + strlen(name) + strlen(lib_dir)];
-                sprintf(path, "%s/nfct_l3proto_%s-%s.so",lib_dir,name,VERSION);
-		if (dlopen(path, RTLD_NOW))
-			handler = findl3proto(name);
-		else
-			fprintf(stderr, "%s\n", dlerror());
-	}
+	if (!handler)
+		fprintf(stderr, "libnetfilter_conntrack: "
+				"cannot find %s handler\n", name);
 
 	return handler;
 }

Modified: trunk/libnetfilter_conntrack/src/main.c
===================================================================
--- trunk/libnetfilter_conntrack/src/main.c	2008-02-22 15:00:57 UTC (rev 7383)
+++ trunk/libnetfilter_conntrack/src/main.c	2008-02-22 22:59:18 UTC (rev 7384)
@@ -18,6 +18,8 @@
 {
 	struct nfct_handle *cth;
 
+	deprecated_backward_support();
+
 	cth = (struct nfct_handle *) malloc(sizeof(struct nfct_handle));
 	if (!cth)
 		return NULL;




More information about the netfilter-cvslog mailing list