From ea8216abbf38d4afcd8e1bed0e948df9111984ac Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org" Date: Sun, 6 Nov 2005 03:22:01 +0000 Subject: o move nfct_handler to libnetfilter_conntrack.c, better for encapsulation o fixed ICMP ID handling o fix -> libtool: link: libtool library `nfct_proto_*.la' must begin with `lib' o remove wrong flag at extensions/Makefile.am o bumped version to 0.0.26 o fixed versioning :( --- configure.in | 2 +- extensions/Makefile.am | 20 ++++++++++---------- extensions/libnetfilter_conntrack_icmp.c | 10 ++++------ extensions/libnetfilter_conntrack_sctp.c | 2 +- extensions/libnetfilter_conntrack_tcp.c | 2 +- extensions/libnetfilter_conntrack_udp.c | 2 +- .../libnetfilter_conntrack/libnetfilter_conntrack.h | 4 ---- src/libnetfilter_conntrack.c | 7 +++++-- 8 files changed, 23 insertions(+), 26 deletions(-) diff --git a/configure.in b/configure.in index c7a6ec6..6a55a53 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ AC_INIT AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(libnetfilter_conntrack, 0.0.20) +AM_INIT_AUTOMAKE(libnetfilter_conntrack, 0.0.26) AC_PROG_CC AM_PROG_LIBTOOL diff --git a/extensions/Makefile.am b/extensions/Makefile.am index 70a30c0..e66abda 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -8,14 +8,14 @@ INCLUDES=-I../include -I${KERNELDIR} CFLAGS=-fPIC -Wall LIBS= -pkglib_LTLIBRARIES = nfct_proto_tcp.la nfct_proto_udp.la \ - nfct_proto_icmp.la nfct_proto_sctp.la +pkglib_LTLIBRARIES = libnfct_proto_tcp.la libnfct_proto_udp.la \ + libnfct_proto_icmp.la libnfct_proto_sctp.la -nfct_proto_tcp_la_SOURCES = libnetfilter_conntrack_tcp.c -nfct_proto_tcp_la_LDFLAGS = -module -lnetfilter_conntrack -nfct_proto_udp_la_SOURCES = libnetfilter_conntrack_udp.c -nfct_proto_udp_la_LDFLAGS = -module -lnetfilter_conntrack -nfct_proto_icmp_la_SOURCES = libnetfilter_conntrack_icmp.c -nfct_proto_icmp_la_LDFLAGS = -module -lnetfilter_conntrack -nfct_proto_sctp_la_SOURCES = libnetfilter_conntrack_sctp.c -nfct_proto_sctp_la_LDFLAGS = -module -lnetfilter_conntrack +libnfct_proto_tcp_la_SOURCES = libnetfilter_conntrack_tcp.c +libnfct_proto_tcp_la_LDFLAGS = -module +libnfct_proto_udp_la_SOURCES = libnetfilter_conntrack_udp.c +libnfct_proto_udp_la_LDFLAGS = -module +libnfct_proto_icmp_la_SOURCES = libnetfilter_conntrack_icmp.c +libnfct_proto_icmp_la_LDFLAGS = -module +libnfct_proto_sctp_la_SOURCES = libnetfilter_conntrack_sctp.c +libnfct_proto_sctp_la_LDFLAGS = -module diff --git a/extensions/libnetfilter_conntrack_icmp.c b/extensions/libnetfilter_conntrack_icmp.c index 3526c4b..4e94dc1 100644 --- a/extensions/libnetfilter_conntrack_icmp.c +++ b/extensions/libnetfilter_conntrack_icmp.c @@ -38,15 +38,13 @@ static void build_tuple_proto(struct nfnlhdr *req, int size, &t->l4dst.icmp.code, sizeof(u_int8_t)); nfnl_addattr_l(&req->nlh, size, CTA_PROTO_ICMP_TYPE, &t->l4dst.icmp.type, sizeof(u_int8_t)); - /* This is an ICMP echo */ - if (t->l4dst.icmp.type == 8) - nfnl_addattr_l(&req->nlh, size, CTA_PROTO_ICMP_ID, - &t->l4src.icmp.id, sizeof(u_int16_t)); + nfnl_addattr_l(&req->nlh, size, CTA_PROTO_ICMP_ID, + &t->l4src.icmp.id, sizeof(u_int16_t)); } static int print_proto(char *buf, struct nfct_tuple *t) { - /* The ID only makes sense for type=8 (ECHO) but we want to + /* The ID only makes sense some ICMP messages but we want to * display the same output that /proc/net/ip_conntrack does */ return (sprintf(buf, "type=%d code=%d id=%d ",t->l4dst.icmp.type, t->l4dst.icmp.code, @@ -59,7 +57,7 @@ static struct nfct_proto icmp = { .parse_proto = parse_proto, .build_tuple_proto = build_tuple_proto, .print_proto = print_proto, - .version = LIBNETFILTER_CONNTRACK_VERSION + .version = VERSION }; static void __attribute__ ((constructor)) init(void); diff --git a/extensions/libnetfilter_conntrack_sctp.c b/extensions/libnetfilter_conntrack_sctp.c index 564d641..1b5c648 100644 --- a/extensions/libnetfilter_conntrack_sctp.c +++ b/extensions/libnetfilter_conntrack_sctp.c @@ -63,7 +63,7 @@ static struct nfct_proto sctp = { .build_tuple_proto = build_tuple_proto, .print_proto = print_proto, .print_protoinfo = print_protoinfo, - .version = LIBNETFILTER_CONNTRACK_VERSION + .version = VERSION }; static void __attribute__ ((constructor)) init(void); diff --git a/extensions/libnetfilter_conntrack_tcp.c b/extensions/libnetfilter_conntrack_tcp.c index bb96698..c7b26b2 100644 --- a/extensions/libnetfilter_conntrack_tcp.c +++ b/extensions/libnetfilter_conntrack_tcp.c @@ -102,7 +102,7 @@ static struct nfct_proto tcp = { .build_protoinfo = build_protoinfo, .print_protoinfo = print_protoinfo, .print_proto = print_proto, - .version = LIBNETFILTER_CONNTRACK_VERSION + .version = VERSION }; static void __attribute__ ((constructor)) init(void); diff --git a/extensions/libnetfilter_conntrack_udp.c b/extensions/libnetfilter_conntrack_udp.c index 2fe3da2..88d51b7 100644 --- a/extensions/libnetfilter_conntrack_udp.c +++ b/extensions/libnetfilter_conntrack_udp.c @@ -47,7 +47,7 @@ static struct nfct_proto udp = { .build_tuple_proto = build_tuple_proto, .parse_proto = parse_proto, .print_proto = print_proto, - .version = LIBNETFILTER_CONNTRACK_VERSION, + .version = VERSION, }; static void __attribute__ ((constructor)) init(void); diff --git a/include/libnetfilter_conntrack/libnetfilter_conntrack.h b/include/libnetfilter_conntrack/libnetfilter_conntrack.h index 843df09..d52c381 100644 --- a/include/libnetfilter_conntrack/libnetfilter_conntrack.h +++ b/include/libnetfilter_conntrack/libnetfilter_conntrack.h @@ -13,8 +13,6 @@ #include #include -#define LIBNETFILTER_CONNTRACK_VERSION "0.2.5" - enum { CONNTRACK = NFNL_SUBSYS_CTNETLINK, EXPECT = NFNL_SUBSYS_CTNETLINK_EXP @@ -198,8 +196,6 @@ enum { struct nfct_handle; typedef int (*nfct_callback)(void *arg, unsigned int flags, int, void *data); -typedef int (*nfct_handler)(struct nfct_handle *cth, struct nlmsghdr *nlh, - void *arg); /* * [Allocate|free] a conntrack diff --git a/src/libnetfilter_conntrack.c b/src/libnetfilter_conntrack.c index 63e5719..7ed76c4 100644 --- a/src/libnetfilter_conntrack.c +++ b/src/libnetfilter_conntrack.c @@ -22,6 +22,9 @@ #define NFCT_BUFSIZE 4096 +typedef int (*nfct_handler)(struct nfct_handle *cth, struct nlmsghdr *nlh, + void *arg); + /* Harald says: "better for encapsulation" ;) */ struct nfct_handle { struct nfnl_handle nfnlh; @@ -927,9 +930,9 @@ int nfct_event_conntrack(struct nfct_handle *cth) void nfct_register_proto(struct nfct_proto *h) { - if (strcmp(h->version, LIBNETFILTER_CONNTRACK_VERSION) != 0) { + if (strcmp(h->version, VERSION) != 0) { fprintf(stderr, "plugin `%s': version %s (I'm %s)\n", - h->name, h->version, LIBNETFILTER_CONNTRACK_VERSION); + h->name, h->version, VERSION); exit(1); } list_add(&h->head, &proto_list); -- cgit v1.2.3