From 7e28837a6073600129d2fc06c23c40726ef5976a Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org" Date: Sat, 9 Jun 2007 19:24:07 +0000 Subject: remove dlopen infrastructure: simplification, it was too much for it --- ChangeLog | 1 + Makefile.am | 2 +- configure.in | 9 --------- extensions/Makefile.am | 16 +++++----------- extensions/libct_proto_icmp.c | 4 +--- extensions/libct_proto_tcp.c | 4 +--- extensions/libct_proto_udp.c | 4 +--- include/conntrack.h | 4 ++++ src/Makefile.am | 2 +- src/conntrack.c | 20 ++++---------------- 10 files changed, 19 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index c045f1f..86a9a46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ o remove bogus option to get a conntrack in test.sh example file o add aliases --sport and --dport to make it more iptables-like o add support for `-L --src-nat' and `-L --dst-nat' to show natted connections o update conntrack(8) manpage +o remove dlopen infrastructure version 0.9.3 (2006/05/22) ------------------------------ diff --git a/Makefile.am b/Makefile.am index 6f0e6fb..05c311f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 man_MANS = conntrack.8 EXTRA_DIST = $(man_MANS) Make_global.am ChangeLog TODO examples -SUBDIRS = src extensions +SUBDIRS = extensions src DIST_SUBDIRS = include src extensions LINKOPTS = -lnfnetlink -lnetfilter_conntrack -lpthread AM_CFLAGS = -g diff --git a/configure.in b/configure.in index 06c787f..41a001c 100644 --- a/configure.in +++ b/configure.in @@ -98,15 +98,6 @@ dnl AC_FUNC_MALLOC dnl AC_FUNC_VPRINTF dnl AC_CHECK_FUNCS([memset]) -dnl-------------------------------- - -if test ! -z "$libdir"; then - MODULE_DIR="\\\"$libdir/conntrack-tools/\\\"" - CFLAGS="$CFLAGS -DCONNTRACK_LIB_DIR=$MODULE_DIR" -fi - -dnl-------------------------------- - dnl AC_CONFIG_FILES([Makefile dnl debug/Makefile dnl debug/src/Makefile diff --git a/extensions/Makefile.am b/extensions/Makefile.am index db97c4d..cf45688 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -1,14 +1,8 @@ include $(top_srcdir)/Make_global.am -AM_CFLAGS=-fPIC -Wall -LIBS= +noinst_LTLIBRARIES = libct_proto_tcp.la libct_proto_udp.la \ + libct_proto_icmp.la -pkglib_LTLIBRARIES = ct_proto_tcp.la ct_proto_udp.la \ - ct_proto_icmp.la - -ct_proto_tcp_la_SOURCES = libct_proto_tcp.c -ct_proto_tcp_la_LDFLAGS = -module -avoid-version -ct_proto_udp_la_SOURCES = libct_proto_udp.c -ct_proto_udp_la_LDFLAGS = -module -avoid-version -ct_proto_icmp_la_SOURCES = libct_proto_icmp.c -ct_proto_icmp_la_LDFLAGS = -module -avoid-version +libct_proto_tcp_la_SOURCES = libct_proto_tcp.c +libct_proto_udp_la_SOURCES = libct_proto_udp.c +libct_proto_icmp_la_SOURCES = libct_proto_icmp.c diff --git a/extensions/libct_proto_icmp.c b/extensions/libct_proto_icmp.c index 5c7717a..765ced4 100644 --- a/extensions/libct_proto_icmp.c +++ b/extensions/libct_proto_icmp.c @@ -91,9 +91,7 @@ static struct ctproto_handler icmp = { .version = VERSION, }; -static void __attribute__ ((constructor)) init(void); - -static void init(void) +void register_icmp(void) { register_proto(&icmp); } diff --git a/extensions/libct_proto_tcp.c b/extensions/libct_proto_tcp.c index 1f0cde6..5a40cef 100644 --- a/extensions/libct_proto_tcp.c +++ b/extensions/libct_proto_tcp.c @@ -215,9 +215,7 @@ static struct ctproto_handler tcp = { .version = VERSION, }; -static void __attribute__ ((constructor)) init(void); - -static void init(void) +void register_tcp(void) { register_proto(&tcp); } diff --git a/extensions/libct_proto_udp.c b/extensions/libct_proto_udp.c index ff9c3d2..cb131d6 100644 --- a/extensions/libct_proto_udp.c +++ b/extensions/libct_proto_udp.c @@ -176,9 +176,7 @@ static struct ctproto_handler udp = { .version = VERSION, }; -static void __attribute__ ((constructor)) init(void); - -static void init(void) +void register_udp(void) { register_proto(&udp); } diff --git a/include/conntrack.h b/include/conntrack.h index 31f4f4f..f344d72 100644 --- a/include/conntrack.h +++ b/include/conntrack.h @@ -170,4 +170,8 @@ struct ctproto_handler { extern void register_proto(struct ctproto_handler *h); +extern void register_tcp(void); +extern void register_udp(void); +extern void register_icmp(void); + #endif diff --git a/src/Makefile.am b/src/Makefile.am index a67e09a..8647d04 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,7 +7,7 @@ CLEANFILES = read_config_yy.c read_config_lex.c sbin_PROGRAMS = conntrack conntrackd conntrack_SOURCES = conntrack.c -conntrack_LDFLAGS = -rdynamic +conntrack_LDADD = ../extensions/libct_proto_tcp.la ../extensions/libct_proto_udp.la ../extensions/libct_proto_icmp.la conntrackd_SOURCES = alarm.c main.c run.c hash.c buffer.c \ local.c log.c mcast.c netlink.c proxy.c lock.c \ diff --git a/src/conntrack.c b/src/conntrack.c index a14ee4b..eece45b 100644 --- a/src/conntrack.c +++ b/src/conntrack.c @@ -136,8 +136,6 @@ static char commands_v_options[NUMBER_OF_CMD][NUMBER_OF_OPT] = /*EXP_EVENT*/ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, }; -static char *lib_dir = CONNTRACK_LIB_DIR; - static LIST_HEAD(proto_list); static unsigned int options; @@ -163,10 +161,6 @@ static struct ctproto_handler *findproto(char *name) if (!name) return handler; - lib_dir = getenv("CONNTRACK_LIB_DIR"); - if (!lib_dir) - lib_dir = CONNTRACK_LIB_DIR; - list_for_each(i, &proto_list) { cur = (struct ctproto_handler *) i; if (strcmp(cur->name, name) == 0) { @@ -175,16 +169,6 @@ static struct ctproto_handler *findproto(char *name) } } - if (!handler) { - char path[sizeof("ct_proto_.so") - + strlen(name) + strlen(lib_dir)]; - sprintf(path, "%s/ct_proto_%s.so", lib_dir, name); - if (dlopen(path, RTLD_NOW)) - handler = findproto(name); - else - fprintf(stderr, "%s\n", dlerror()); - } - return handler; } @@ -700,6 +684,10 @@ int main(int argc, char *argv[]) memset(__mask, 0, sizeof(__mask)); memset(__exp, 0, sizeof(__exp)); + register_tcp(); + register_udp(); + register_icmp(); + 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::f:o:", opts, NULL)) != -1) { -- cgit v1.2.3