summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2005-10-28 00:29:24 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2005-10-28 00:29:24 +0000
commit0291945051adc675b6e322c453364a0c5a9a6b02 (patch)
treeada2a16077ea63b431c6ccfe342020cfb9291495
parentab803040bab7a5b02aa99f6ffdb782848163d964 (diff)
See ChangeLog
-rw-r--r--ChangeLog10
-rw-r--r--extensions/libct_proto_icmp.c6
-rw-r--r--extensions/libct_proto_sctp.c6
-rw-r--r--extensions/libct_proto_tcp.c6
-rw-r--r--extensions/libct_proto_udp.c6
-rw-r--r--include/conntrack.h3
-rw-r--r--src/conntrack.c53
7 files changed, 34 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d99d04..0b1d9ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-10-28
+<pablo@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@eurodev.net>
o Use conntrack VERSION instead of the old LIBCT_VERSION
diff --git a/extensions/libct_proto_icmp.c b/extensions/libct_proto_icmp.c
index ce42021..7b2b24a 100644
--- a/extensions/libct_proto_icmp.c
+++ b/extensions/libct_proto_icmp.c
@@ -109,14 +109,8 @@ static struct ctproto_handler icmp = {
};
void __attribute__ ((constructor)) init(void);
-void __attribute__ ((destructor)) fini(void);
void init(void)
{
register_proto(&icmp);
}
-
-void fini(void)
-{
- unregister_proto(&icmp);
-}
diff --git a/extensions/libct_proto_sctp.c b/extensions/libct_proto_sctp.c
index 5667d18..f2ced21 100644
--- a/extensions/libct_proto_sctp.c
+++ b/extensions/libct_proto_sctp.c
@@ -147,14 +147,8 @@ static struct ctproto_handler sctp = {
};
void __attribute__ ((constructor)) init(void);
-void __attribute__ ((destructor)) fini(void);
void init(void)
{
register_proto(&sctp);
}
-
-void fini(void)
-{
- unregister_proto(&sctp);
-}
diff --git a/extensions/libct_proto_tcp.c b/extensions/libct_proto_tcp.c
index 4f6e113..8969b48 100644
--- a/extensions/libct_proto_tcp.c
+++ b/extensions/libct_proto_tcp.c
@@ -170,14 +170,8 @@ static struct ctproto_handler tcp = {
};
void __attribute__ ((constructor)) init(void);
-void __attribute__ ((destructor)) fini(void);
void init(void)
{
register_proto(&tcp);
}
-
-void fini(void)
-{
- unregister_proto(&tcp);
-}
diff --git a/extensions/libct_proto_udp.c b/extensions/libct_proto_udp.c
index 02826cd..19af6f1 100644
--- a/extensions/libct_proto_udp.c
+++ b/extensions/libct_proto_udp.c
@@ -135,14 +135,8 @@ static struct ctproto_handler udp = {
};
void __attribute__ ((constructor)) init(void);
-void __attribute__ ((destructor)) fini(void);
void init(void)
{
register_proto(&udp);
}
-
-void fini(void)
-{
- unregister_proto(&udp);
-}
diff --git a/include/conntrack.h b/include/conntrack.h
index db96102..4aabd09 100644
--- a/include/conntrack.h
+++ b/include/conntrack.h
@@ -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 @@ struct ctproto_handler {
};
extern void register_proto(struct ctproto_handler *h);
-extern void unregister_proto(struct ctproto_handler *h);
#define NIPQUAD(addr) \
((unsigned char *)&addr)[0], \
diff --git a/src/conntrack.c b/src/conntrack.c
index 3b3b26a..01f5e46 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -193,7 +193,7 @@ static struct option original_opts[] = {
{"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 @@ static char commands_v_options[NUMBER_OF_CMD][NUMBER_OF_OPT] =
/* 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 @@ void register_proto(struct ctproto_handler *h)
list_add(&h->head, &proto_list);
}
-void unregister_proto(struct ctproto_handler *h)
-{
- list_del(&h->head);
-}
-
-static struct nfct_proto *findproto(char *name)
+static struct ctproto_handler *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 @@ static struct nfct_proto *findproto(char *name)
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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);