diff options
author | laforge <laforge> | 2005-11-05 16:23:57 +0000 |
---|---|---|
committer | laforge <laforge> | 2005-11-05 16:23:57 +0000 |
commit | c17abcc0a45298f4846f18f5b4a0edfbad2144ba (patch) | |
tree | 0a1b96a003abbfd5da8601bd5aa2df82ccdb1c87 | |
parent | a579cd853bc878ec93d51756011113eedd3dfcd0 (diff) |
introduce version field for plugins, refuse loading plugins with different version
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | filter/raw2packet/ulogd_raw2packet_BASE.c | 1 | ||||
-rw-r--r-- | filter/ulogd_filter_IFINDEX.c | 1 | ||||
-rw-r--r-- | filter/ulogd_filter_PWSNIFF.c | 1 | ||||
-rw-r--r-- | include/ulogd/ulogd.h | 5 | ||||
-rw-r--r-- | input/flow/ulogd_inpflow_NFCT.c | 1 | ||||
-rw-r--r-- | input/packet/ulogd_inppkt_NFLOG.c | 1 | ||||
-rw-r--r-- | input/packet/ulogd_inppkt_ULOG.c | 1 | ||||
-rw-r--r-- | output/mysql/ulogd_output_MYSQL.c | 1 | ||||
-rw-r--r-- | output/pcap/ulogd_output_PCAP.c | 1 | ||||
-rw-r--r-- | output/ulogd_output_IPFIX.c | 1 | ||||
-rw-r--r-- | output/ulogd_output_LOGEMU.c | 1 | ||||
-rw-r--r-- | output/ulogd_output_OPRINT.c | 1 | ||||
-rw-r--r-- | output/ulogd_output_SYSLOG.c | 1 | ||||
-rw-r--r-- | src/ulogd.c | 11 |
16 files changed, 24 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am index 98f971a..c8e5273 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ man_MANS = ulogd.8 EXTRA_DIST = $(man_MANS) INCLUDES = $(all_includes) -I$(top_srcdir)/include -SUBDIRS = src input filter output +SUBDIRS = libipulog src input filter output DIST_SUBDIRS = src input filter output $(OBJECTS): libtool diff --git a/configure.in b/configure.in index 949efd9..e3b73fd 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT -AM_INIT_AUTOMAKE(ulogd, 2.0.0alpha) +AM_INIT_AUTOMAKE(ulogd, 2.0.0beta) AM_CONFIG_HEADER(config.h) dnl Checks for programs. diff --git a/filter/raw2packet/ulogd_raw2packet_BASE.c b/filter/raw2packet/ulogd_raw2packet_BASE.c index 8273810..38be028 100644 --- a/filter/raw2packet/ulogd_raw2packet_BASE.c +++ b/filter/raw2packet/ulogd_raw2packet_BASE.c @@ -553,6 +553,7 @@ static struct ulogd_plugin base_plugin = { .type = ULOGD_DTYPE_PACKET, }, .interp = &_interp_iphdr, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void); diff --git a/filter/ulogd_filter_IFINDEX.c b/filter/ulogd_filter_IFINDEX.c index fbe8ccf..dc4ea46 100644 --- a/filter/ulogd_filter_IFINDEX.c +++ b/filter/ulogd_filter_IFINDEX.c @@ -143,6 +143,7 @@ static struct ulogd_plugin ifindex_plugin = { .start = &ifindex_start, .stop = &ifindex_fini, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void); diff --git a/filter/ulogd_filter_PWSNIFF.c b/filter/ulogd_filter_PWSNIFF.c index 56f3b41..2296929 100644 --- a/filter/ulogd_filter_PWSNIFF.c +++ b/filter/ulogd_filter_PWSNIFF.c @@ -171,6 +171,7 @@ static struct ulogd_plugin pwsniff_plugin = { .type = ULOGD_DTYPE_PACKET, }, .interp = &interp_pwsniff, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void) diff --git a/include/ulogd/ulogd.h b/include/ulogd/ulogd.h index e864e8e..16a2f7a 100644 --- a/include/ulogd/ulogd.h +++ b/include/ulogd/ulogd.h @@ -21,6 +21,7 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#define ULOGD_VERSION "2.0.0beta" /* All types with MSB = 1 make use of value.ptr * other types use one of the union's member */ @@ -117,6 +118,8 @@ struct ulogd_pluginstance; struct ulogd_plugin { /* global list of plugins */ struct list_head list; + /* version */ + char *version; /* name of this plugin (predefined by plugin) */ char name[ULOGD_MAX_KEYLEN]; /* ID for this plugin (dynamically assigned) */ @@ -223,7 +226,7 @@ struct ulogd_key *keyh_getres(unsigned int id); /* the key hash itself */ extern struct ulogd_keyh_entry *ulogd_keyh; -#define IS_VALID(x) (x.flags & ULOGD_RETF_VALID) +#define IS_VALID(x) ((x).flags & ULOGD_RETF_VALID) #define SET_VALID(x) (x.flags |= ULOGD_RETF_VALID) #define IS_NEEDED(x) (x.flags & ULOGD_RETF_NEEDED) #define SET_NEEDED(x) (x.flags |= ULOGD_RETF_NEEDED) diff --git a/input/flow/ulogd_inpflow_NFCT.c b/input/flow/ulogd_inpflow_NFCT.c index 9ce4218..11d6f8d 100644 --- a/input/flow/ulogd_inpflow_NFCT.c +++ b/input/flow/ulogd_inpflow_NFCT.c @@ -257,6 +257,7 @@ static struct ulogd_plugin nfct_plugin = { .start = &constructor_nfct, .stop = &destructor_nfct, .priv_size = sizeof(struct nfct_pluginstance), + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void); diff --git a/input/packet/ulogd_inppkt_NFLOG.c b/input/packet/ulogd_inppkt_NFLOG.c index 5860a18..9116763 100644 --- a/input/packet/ulogd_inppkt_NFLOG.c +++ b/input/packet/ulogd_inppkt_NFLOG.c @@ -383,6 +383,7 @@ struct ulogd_plugin libulog_plugin = { .start = &start, .stop = &stop, .config_kset = &libulog_kset, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void); diff --git a/input/packet/ulogd_inppkt_ULOG.c b/input/packet/ulogd_inppkt_ULOG.c index c4c5809..7596c8e 100644 --- a/input/packet/ulogd_inppkt_ULOG.c +++ b/input/packet/ulogd_inppkt_ULOG.c @@ -271,6 +271,7 @@ struct ulogd_plugin libulog_plugin = { .start = &init, .stop = &fini, .config_kset = &libulog_kset, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) initializer(void) diff --git a/output/mysql/ulogd_output_MYSQL.c b/output/mysql/ulogd_output_MYSQL.c index 78d9cb4..38e54be 100644 --- a/output/mysql/ulogd_output_MYSQL.c +++ b/output/mysql/ulogd_output_MYSQL.c @@ -515,6 +515,7 @@ static struct ulogd_plugin mysql_plugin = { .stop = &stop_mysql, .signal = &signal_mysql, .interp = &interp_mysql, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void); diff --git a/output/pcap/ulogd_output_PCAP.c b/output/pcap/ulogd_output_PCAP.c index 047ce38..fa2b955 100644 --- a/output/pcap/ulogd_output_PCAP.c +++ b/output/pcap/ulogd_output_PCAP.c @@ -279,6 +279,7 @@ static struct ulogd_plugin pcap_plugin = { .stop = &stop_pcap, .signal = &signal_pcap, .interp = &interp_pcap, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void); diff --git a/output/ulogd_output_IPFIX.c b/output/ulogd_output_IPFIX.c index 9cef10e..966a56f 100644 --- a/output/ulogd_output_IPFIX.c +++ b/output/ulogd_output_IPFIX.c @@ -176,6 +176,7 @@ static struct ulogd_plugin ipfix_plugin = { .interp = &_output_ipfix, .signal = &signal_handler_ipfix, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void); diff --git a/output/ulogd_output_LOGEMU.c b/output/ulogd_output_LOGEMU.c index 949530a..e46a19c 100644 --- a/output/ulogd_output_LOGEMU.c +++ b/output/ulogd_output_LOGEMU.c @@ -163,6 +163,7 @@ static struct ulogd_plugin logemu_plugin = { .interp = &_output_logemu, .signal = &signal_handler_logemu, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void); diff --git a/output/ulogd_output_OPRINT.c b/output/ulogd_output_OPRINT.c index b6f38bd..a35634a 100644 --- a/output/ulogd_output_OPRINT.c +++ b/output/ulogd_output_OPRINT.c @@ -210,6 +210,7 @@ static struct ulogd_plugin oprint_plugin = { .stop = &oprint_fini, .signal = &sighup_handler_print, .config_kset = &oprint_kset, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void); diff --git a/output/ulogd_output_SYSLOG.c b/output/ulogd_output_SYSLOG.c index 97254fd..2ee1ae0 100644 --- a/output/ulogd_output_SYSLOG.c +++ b/output/ulogd_output_SYSLOG.c @@ -168,6 +168,7 @@ static struct ulogd_plugin syslog_plugin = { .configure = &syslog_configure, .start = &syslog_start, .interp = &_output_syslog, + .version = ULOGD_VERSION, }; void __attribute__ ((constructor)) init(void); diff --git a/src/ulogd.c b/src/ulogd.c index 5eca76a..6c94779 100644 --- a/src/ulogd.c +++ b/src/ulogd.c @@ -40,15 +40,11 @@ * - further unification towards generic network event logging * and support for lnstat * - * 17 Apr 2005 Harald Welte <laforge@gnumonks.org> - * - - * * 07 Oct 2005 Harald Welte <laforge@gnumonks.org> * - finally get ulogd2 into a running state + * */ -#define ULOGD_VERSION "2.00alpha" - #include <unistd.h> #include <stdio.h> #include <stdlib.h> @@ -156,6 +152,11 @@ static struct ulogd_plugin *find_plugin(const char *name) /* the function called by all plugins for registering themselves */ void ulogd_register_plugin(struct ulogd_plugin *me) { + if (strcmp(me->version, ULOGD_VERSION)) { + ulogd_log(ULOGD_NOTICE, "plugin `%s' has incompatible version %s\n", + me->version); + return; + } if (find_plugin(me->name)) { ulogd_log(ULOGD_NOTICE, "plugin `%s' already registered\n", me->name); |