ulogd: add ulogd_parse_configfile public function
PATCH v2 1/6 ulogd: add ulogd_parse_configfile public function
Provide a new function ulogd_parse_configfile() in the public interface, which wraps parse_config_file() to parse a section of the config file and communicates found errors to the user. It can be used as a drop-in replacement because arguments and return value are compatible.
This relieves plugins of the need to translate the individual error codes to human readable messages, and plugins are mostly interested if there is any error, not what specific error.
This reuses the existing parse_conffile() function with slight adjustments.
---
Changes in v2:
- Rebase onto master branch (b9f931e2f30e ("nfct: add icmpv6"))
- Renumber the patchset since v1 patch #1 and #5 are already applied
- Reduce indentation of case statements (Florian Westphal)
- Link to v1: https://lore.kernel.org/netfilter-devel/[email protected]/
include/ulogd/ulogd.h | 1 + src/ulogd.c | 104 ++++++++++++++++++++++-------------------- 2 files changed, 56 insertions(+), 49 deletions(-)
include/ulogd/ulogd.h +1 -0
@@ -362,6 +362,7 @@ void __ulogd_log(int level, char *file, int line, const char *message, ...)int ulogd_key_size (struct ulogd_key *key);int ulogd_wildcard_inputkeys (struct ulogd_pluginstance *upi); +int ulogd_parse_configfile (const char *section,struct config_keyset *ce);/*********************************************************************** * file descriptor handling
src/ulogd.c +55 -49
122 lines not on this page · raw message
--
2.48.1
PATCH v2 2/6 all: use config_parse_file function in all plugins
Replace all usages of config_parse_file() in plugins with the new ulogd_parse_configfile() function, adding error handling where it was missing. I used the same codestyle as the surrounding code, which varies between plugins.
---
Changes in v2:
- None
filter/ulogd_filter_MARK.c | 3 +-- input/flow/ulogd_inpflow_NFCT.c | 2 +- input/packet/ulogd_inppkt_NFLOG.c | 3 +-- input/packet/ulogd_inppkt_ULOG.c | 2 +- input/packet/ulogd_inppkt_UNIXSOCK.c | 3 +-- input/sum/ulogd_inpflow_NFACCT.c | 2 +- output/ipfix/ulogd_output_IPFIX.c | 2 +- output/pcap/ulogd_output_PCAP.c | 2 +- output/sqlite3/ulogd_output_SQLITE3.c | 3 ++- output/ulogd_output_GPRINT.c | 2 +- output/ulogd_output_GRAPHITE.c | 2 +- output/ulogd_output_JSON.c | 2 +- output/ulogd_output_LOGEMU.c | 2 +- output/ulogd_output_NACCT.c | 2 +- output/ulogd_output_OPRINT.c | 2 +- output/ulogd_output_SYSLOG.c | 7 ++++--- output/ulogd_output_XML.c | 2 +- util/db.c | 2 +- 18 files changed, 22 insertions(+), 23 deletions(-)
filter/ulogd_filter_MARK.c +1 -2
@@ -94,8 +94,7 @@ static int configure(struct ulogd_pluginstance *upi,ulogd_log (ULOGD_DEBUG ,"parsing config file section `%s', " "plugin `%s'\n" , upi->id, upi->plugin->name); -config_parse_file (upi->id, upi->config_kset); -return 0 ; +return ulogd_parse_configfile (upi->id, upi->config_kset); }static struct ulogd_plugin mark_pluging = {
input/flow/ulogd_inpflow_NFCT.c +1 -1
@@ -1054,7 +1054,7 @@ static int configure_nfct(struct ulogd_pluginstance *upi, {int ret; - ret =config_parse_file (upi->id, upi->config_kset); + ret =ulogd_parse_configfile (upi->id, upi->config_kset);if (ret <0 )return ret;
input/packet/ulogd_inppkt_NFLOG.c +1 -2
@@ -557,8 +557,7 @@ static int configure(struct ulogd_pluginstance *upi,ulogd_log (ULOGD_DEBUG ,"parsing config file section `%s', " "plugin `%s'\n" , upi->id, upi->plugin->name); -config_parse_file (upi->id, upi->config_kset); -return 0 ; +return ulogd_parse_configfile (upi->id, upi->config_kset); }static int become_system_logging (struct ulogd_pluginstance *upi,uint8_t pf)
input/packet/ulogd_inppkt_ULOG.c +1 -1
@@ -269,7 +269,7 @@ static int ulog_read_cb(int fd, unsigned int what, void *param)static int configure (struct ulogd_pluginstance *upi,struct ulogd_pluginstance_stack *stack) { -return config_parse_file (upi->id, upi->config_kset); +return ulogd_parse_configfile (upi->id, upi->config_kset); }static int init (struct ulogd_pluginstance *upi) {
input/packet/ulogd_inppkt_UNIXSOCK.c +1 -2
@@ -719,8 +719,7 @@ static int configure(struct ulogd_pluginstance *upi,ulogd_log (ULOGD_DEBUG ,"parsing config file section `%s', " "plugin `%s'\n" , upi->id, upi->plugin->name); -config_parse_file (upi->id, upi->config_kset); -return 0 ; +return ulogd_parse_configfile (upi->id, upi->config_kset); }static int start (struct ulogd_pluginstance *upi)
input/sum/ulogd_inpflow_NFACCT.c +1 -1
@@ -221,7 +221,7 @@ static int configure_nfacct(struct ulogd_pluginstance *upi, {int ret; - ret =config_parse_file (upi->id, upi->config_kset); + ret =ulogd_parse_configfile (upi->id, upi->config_kset);if (ret <0 )return ret;
output/ipfix/ulogd_output_IPFIX.c +1 -1
@@ -272,7 +272,7 @@ static int ipfix_configure(struct ulogd_pluginstance *pi, struct ulogd_pluginstaint oid, port, mtu, ret;char addr[16 ]; - ret =config_parse_file (pi->id, pi->config_kset); + ret =ulogd_parse_configfile (pi->id, pi->config_kset);if (ret <0 )return ret;
output/pcap/ulogd_output_PCAP.c +1 -1
@@ -260,7 +260,7 @@ static void signal_pcap(struct ulogd_pluginstance *upi, int signal)static int configure_pcap (struct ulogd_pluginstance *upi,struct ulogd_pluginstance_stack *stack) { -return config_parse_file (upi->id, upi->config_kset); +return ulogd_parse_configfile (upi->id, upi->config_kset); }static int start_pcap (struct ulogd_pluginstance *upi)
output/sqlite3/ulogd_output_SQLITE3.c +2 -1
@@ -363,7 +363,8 @@ sqlite3_configure(struct ulogd_pluginstance *pi, {/* struct sqlite_priv *priv = (void *)pi->private; */ -config_parse_file (pi->id, pi->config_kset); +if (ulogd_parse_configfile (pi->id, pi->config_kset) <0 ) +return -1 ;if (ulogd_wildcard_inputkeys (pi) <0 )return -1 ;
output/ulogd_output_GPRINT.c +1 -1
@@ -233,7 +233,7 @@ static int gprint_configure(struct ulogd_pluginstance *upi,if (ret <0 )return ret; - ret =config_parse_file (upi->id, upi->config_kset); + ret =ulogd_parse_configfile (upi->id, upi->config_kset);if (ret <0 )return ret;
output/ulogd_output_GRAPHITE.c +1 -1
@@ -214,7 +214,7 @@ static int configure_graphite(struct ulogd_pluginstance *pi, struct ulogd_pluginstance_stack *stack) {ulogd_log (ULOGD_DEBUG ,"parsing config file section %s\n" , pi->id); -return config_parse_file (pi->id, pi->config_kset); +return ulogd_parse_configfile (pi->id, pi->config_kset); }static struct ulogd_plugin graphite_plugin = {
output/ulogd_output_JSON.c +1 -1
@@ -494,7 +494,7 @@ static int json_configure(struct ulogd_pluginstance *upi,if (ret <0 )return ret; - ret =config_parse_file (upi->id, upi->config_kset); + ret =ulogd_parse_configfile (upi->id, upi->config_kset);if (ret <0 )return ret;
output/ulogd_output_LOGEMU.c +1 -1
@@ -178,7 +178,7 @@ static int configure_logemu(struct ulogd_pluginstance *pi, struct ulogd_pluginstance_stack *stack) {ulogd_log (ULOGD_DEBUG ,"parsing config file section %s\n" , pi->id); -return config_parse_file (pi->id, pi->config_kset); +return ulogd_parse_configfile (pi->id, pi->config_kset); }static struct ulogd_plugin logemu_plugin = {
output/ulogd_output_NACCT.c +1 -1
@@ -203,7 +203,7 @@ nacct_conf(struct ulogd_pluginstance *pi, {int ret; -if ((ret =config_parse_file (pi->id, pi->config_kset)) <0 ) +if ((ret =ulogd_parse_configfile (pi->id, pi->config_kset)) <0 )return ret;return 0 ;
output/ulogd_output_OPRINT.c +1 -1
@@ -161,7 +161,7 @@ static int oprint_configure(struct ulogd_pluginstance *upi,if (ret <0 )return ret; - ret =config_parse_file (upi->id, upi->config_kset); + ret =ulogd_parse_configfile (upi->id, upi->config_kset);if (ret <0 )return ret;
output/ulogd_output_SYSLOG.c +4 -3
@@ -83,12 +83,13 @@ static int _output_syslog(struct ulogd_pluginstance *upi)static int syslog_configure (struct ulogd_pluginstance *pi,struct ulogd_pluginstance_stack *stack) { -int syslog_facility, syslog_level; +int syslog_facility, syslog_level, ret;char *facility, *level;struct syslog_instance *li = (struct syslog_instance *) &pi->private; -/* FIXME: error handling */ -config_parse_file (pi->id, pi->config_kset); + ret =ulogd_parse_configfile (pi->id, pi->config_kset); +if (ret <0 ) +return ret; facility = pi->config_kset->ces[0 ].u.string; level = pi->config_kset->ces[1 ].u.string;
output/ulogd_output_XML.c +1 -1
@@ -190,7 +190,7 @@ static int xml_configure(struct ulogd_pluginstance *upi, {int ret; - ret =config_parse_file (upi->id, upi->config_kset); + ret =ulogd_parse_configfile (upi->id, upi->config_kset);if (ret <0 )return ret;
util/db.c +1 -1
@@ -153,7 +153,7 @@ int ulogd_db_configure(struct ulogd_pluginstance *upi,ulogd_log (ULOGD_NOTICE ,"(re)configuring\n" );/* First: Parse configuration file section for this instance */ - ret =config_parse_file (upi->id, upi->config_kset); + ret =ulogd_parse_configfile (upi->id, upi->config_kset);if (ret <0 ) {ulogd_log (ULOGD_ERROR ,"error parsing config file\n" );return ret;
--
2.48.1
PATCH v2 3/6 ulogd: raise error on unknown config key
In reply to Corubba SmithUntil a6fbeb96e889 ("new configuration file syntax (Magnus Boden)") this was already caught, and the enum member is still present.
Check if the for loop worked throught the whole array without hitting a matching config option, and return with the unknown key error code. Because there is no existing config_entry struct with that unknwon key to use with the established config_errce pointer, allocate a new struct. This potentially creates a memory leak if that config_entry is never freed again, but for me that is acceptable is this rare case.
Since the memory allocation for the struct can fail, also reuse the old out-of-memory error to indicate that.
---
Changes in v2:
- Reduce indentation of case statements (Florian Westphal)
src/conffile.c | 11 +++++++++++ src/ulogd.c | 2 ++ 2 files changed, 13 insertions(+)
src/conffile.c +11 -0
@@ -236,6 +236,17 @@ int config_parse_file(const char *section, struct config_keyset *kset)break ; }pr_debug ("parse_file: exiting main loop\n" ); + +if (i == kset->num_ces) { + config_errce =calloc (1 ,sizeof (struct config_entry )); +if (config_errce ==NULL ) { + err = -ERROOM ; + goto cpf_error; + } +strncpy (&config_errce->key[0 ], wordbuf,CONFIG_KEY_LEN -1 ); + err = -ERRUNKN ; + goto cpf_error; + } }
src/ulogd.c +2 -0
@@ -285,6 +285,8 @@ int ulogd_parse_configfile(const char *section, struct config_keyset *ce)ulogd_log (ULOGD_ERROR ,"unknown config key \"%s\"\n" , config_errce->key); +free (config_errce); + config_errce =NULL ;break ;case -ERRSECTION : ulogd_log(ULOGD_ERROR,
--
2.48.1
Florian Westphal
maintainerRe: [PATCH ulogd2,v2 3/6] ulogd: raise error on unknown config key
Quoted 28 lines · Corubba Smith
Until
a6fbeb96e889("new configuration file syntax (Magnus Boden)") this was already caught, and the enum member is still present.Check if the for loop worked throught the whole array without hitting a matching config option, and return with the unknown key error code. Because there is no existing
config_entrystruct with that unknwon key to use with the establishedconfig_errcepointer, allocate a new struct. This potentially creates a memory leak if thatconfig_entryis never freed again, but for me that is acceptable is this rare case.Since the memory allocation for the struct can fail, also reuse the old out-of-memory error to indicate that.
Signed-off-by Corubba Smith <[email protected]>---
Changes in v2:
- Reduce indentation of case statements (Florian Westphal)src/conffile.c | 11 +++++++++++ src/ulogd.c | 2 ++ 2 files changed, 13 insertions(+)src/conffile.c +0
-0@@ -236,6 +236,17 @@ int config_parse_file(const char *section, struct config_keyset *kset)break ;
src/conffile.c int config_parse_file(const char *section, struct config_keyset *kset) · line 246
Quoted 10 lines
src/conffile.c +8
-0}pr_debug ("parse_file: exiting main loop\n" ); + +if (i == kset->num_ces) { + config_errce =calloc (1 ,sizeof (struct config_entry )); +if (config_errce ==NULL ) { + err = -ERROOM ; + goto cpf_error; + } +strncpy (&config_errce->key[0 ], wordbuf,CONFIG_KEY_LEN -1 );
This raises a bogus compiler warning for me:
conffile.c:246:25: warning: '__builtin_strncpy' output may be truncated copying 30 bytes from a string of length 254 [-Wstringop-truncation]
246 | strncpy(config_errce->key, wordbuf, sizeof(config_errce->key));
What do you make of this?
- strncpy(&config_errce->key[0], wordbuf, CONFIG_KEY_LEN - 1);
+ snprintf(config_errce->key, sizeof(config_errce->key), "%s", wordbuf);
Re: [PATCH ulogd2,v2 3/6] ulogd: raise error on unknown config key
Quoted 48 lines · Florian Westphal
Quoted 28 lines · Corubba Smith
Until
a6fbeb96e889("new configuration file syntax (Magnus Boden)") this was already caught, and the enum member is still present.Check if the for loop worked throught the whole array without hitting a matching config option, and return with the unknown key error code. Because there is no existing
config_entrystruct with that unknwon key to use with the establishedconfig_errcepointer, allocate a new struct. This potentially creates a memory leak if thatconfig_entryis never freed again, but for me that is acceptable is this rare case.Since the memory allocation for the struct can fail, also reuse the old out-of-memory error to indicate that.
Signed-off-by Corubba Smith <[email protected]>---
Changes in v2:
- Reduce indentation of case statements (Florian Westphal)src/conffile.c | 11 +++++++++++ src/ulogd.c | 2 ++ 2 files changed, 13 insertions(+)src/conffile.c +0
-0@@ -236,6 +236,17 @@ int config_parse_file(const char *section, struct config_keyset *kset)break ;src/conffile.c int config_parse_file(const char *section, struct config_keyset *kset) · line 246
Quoted 10 lines
src/conffile.c +8
-0}pr_debug ("parse_file: exiting main loop\n" ); + +if (i == kset->num_ces) { + config_errce =calloc (1 ,sizeof (struct config_entry )); +if (config_errce ==NULL ) { + err = -ERROOM ; + goto cpf_error; + } +strncpy (&config_errce->key[0 ], wordbuf,CONFIG_KEY_LEN -1 );This raises a bogus compiler warning for me:
conffile.c:246:25: warning: '__builtin_strncpy' output may be truncated copying 30 bytes from a string of length 254 [-Wstringop-truncation]
246 |strncpy(config_errce->key, wordbuf, sizeof(config_errce->key));What do you make of this?
Review
Quoted 2 lines
(quoted diff) +1
-1- strncpy(&config_errce->key[0], wordbuf, CONFIG_KEY_LEN - 1); + snprintf(config_errce->key, sizeof(config_errce->key), "%s", wordbuf);
Today I learned: GCC will print certain warnings only when certain optimizations are applied. That warning is only there with -O2 or above, I was using -Og. That's why I didn't see or catch it.
Your suggestion using snprintf works, but feels a bit heavy-handed.
I like the suggestion in the GCC doc [0] of using memcpy for (potentially) not-NULL-terminated strings better. Since the target memory comes from calloc(), the last byte will always be NULL and properly terminate a potentially truncated string copied from wordbuf. So just memcpy the 29 bytes before that. It may copy data beyond the first NULL character in wordbuf, but with a maximum of 29 bytes it's not a big deal.
So my proposed fix would be:
- strncpy(&config_errce->key[0], wordbuf, CONFIG_KEY_LEN - 1);
+ memcpy(&config_errce->key[0], wordbuf, sizeof(config_errce->key) - 1);
Compiles without a warning, and tested to work as expected. Would you like a v3 of the whole patch, or is this addendum good enough?
[0] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation
--
Corubba
Florian Westphal
maintainerRe: [PATCH ulogd2,v2 3/6] ulogd: raise error on unknown config key
Quoted 7 lines · Corubba Smith
So my proposed fix would be:
(quoted diff) +1
-1- strncpy(&config_errce->key[0], wordbuf, CONFIG_KEY_LEN - 1); + memcpy(&config_errce->key[0], wordbuf, sizeof(config_errce->key) - 1);Compiles without a warning, and tested to work as expected. Would you like a v3 of the whole patch, or is this addendum good enough?
Please rebase and send a v3.
PATCH v2 4/6 ulogd: improve integer option parsing
In reply to Corubba SmithThe value union member in struct config_entry is declared as int since basically the beginning in e07722e46001 ("config stuff added"). The parsing was switched from the original atoi() in 015849995f7f ("Fix hexadecimal parsing in config file") to strtoul().
Switch the function for parsing to the signed strtol() variant since the result will be stored in a signed int, and it makes sense to support negative numbers. Detect when strtol() does not properly consume the whole argument and return a new format error. Also check the numerical value to make sure the signed int does not overflow, in which case a new range error is returned.
Unfortunately there is no strtoi() which would do the proper range check itself, so the intermediate long and range-check for int is required. I also considered changing the value union member from int to long, which would make it possible to use the parsed value as-is. But since this is part of the api towards plugins (including third party) such a potentially breaking change felt unwarranted. This also means that still only 16bit integer values are *guaranteed* to work, although most platforms use bigger widths for int.
---
Changes in v2:
- Reduce indentation of case statements (Florian Westphal)
include/ulogd/conffile.h | 2 ++ src/conffile.c | 17 ++++++++++++++++- src/ulogd.c | 10 ++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-)
include/ulogd/conffile.h +2 -0
@@ -19,6 +19,8 @@ enum {ERRUNKN ,/* unknown config key */ ERRSECTION ,/* section not found */ ERRTOOLONG ,/* string too long */ +ERRINTFORMAT ,/* integer format is invalid */ + ERRINTRANGE, /* integer value is out of range */ };/* maximum line length of config file entries */
src/conffile.c +16 -1
@@ -17,6 +17,7 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <limits.h> #include <ulogd/ulogd.h> #include <ulogd/common.h> #include <ulogd/conffile.h>
@@ -227,7 +228,21 @@ int config_parse_file(const char *section, struct config_keyset *kset) }break ;case CONFIG_TYPE_INT : - ce->u.value =strtoul (args,NULL ,0 ); + errno =0 ; +char *endptr =NULL ; +long parsed =strtol (args, &endptr,0 ); +if (endptr == args || *endptr !='\0' ) { + config_errce = ce; + err = -ERRINTFORMAT ; + goto cpf_error; + } +if (errno ==ERANGE || + parsed <INT_MIN || parsed >INT_MAX ) { + config_errce = ce; + err = -ERRINTRANGE ; + goto cpf_error; + } + ce->u.value = (int )parsed;break ;case CONFIG_TYPE_CALLBACK : (ce->u.parser)(args);
src/ulogd.c +10 -0
@@ -302,6 +302,16 @@ int ulogd_parse_configfile(const char *section, struct config_keyset *ce)ulogd_log (ULOGD_ERROR ,"string value is too long\n" );break ; +case -ERRINTFORMAT : +ulogd_log (ULOGD_ERROR , +"integer has invalid format for key \"%s\"\n" , + config_errce->key); +break ; +case -ERRINTRANGE : +ulogd_log (ULOGD_ERROR , +"integer is out of range for key \"%s\"\n" , + config_errce->key); +break ; }return ULOGD_IRET_ERR ;
--
2.48.1
PATCH v2 5/6 ulogd: provide default configure implementation
In reply to Corubba SmithProvide a default implementation for the configure hook which simply calls ulogd_parse_configfile(), so simple plugins only need to provide the config_keyset. This also triggers an "unknown key" error if a plugin defines no config_keyset (aka it has no options), but the config file contains directives for it.
---
Changes in v2:
- None
src/conffile.c | 7 ++++++- src/ulogd.c | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-)
src/conffile.c +6 -1
@@ -158,7 +158,12 @@ int config_parse_file(const char *section, struct config_keyset *kset) }if (!found) { - err = -ERRSECTION ; +if (kset->num_ces ==0 ) { +/* If there are no options, then no section isnt an error. */ + err =0 ; + }else { + err = -ERRSECTION ; + } goto cpf_error; }
src/ulogd.c +14 -7
@@ -869,15 +869,22 @@ create_stack_resolve_keys(struct ulogd_pluginstance_stack *stack) pi_cur->plugin->name);/* call plugin to tell us which keys it requires in * given configuration */ +int ret;if (pi_cur->plugin->configure) { -int ret = pi_cur->plugin->configure (pi_cur, - stack); -if (ret <0 ) { -ulogd_log (ULOGD_ERROR ,"error during " -"configure of plugin %s\n" , - pi_cur->plugin->name); -return ret; + ret = pi_cur->plugin->configure (pi_cur, stack); + }else { +struct config_keyset empty_kset = {.num_ces=0 }; +struct config_keyset *kset = &empty_kset; +if (pi_cur->config_kset) { + kset = pi_cur->config_kset; } + ret =ulogd_parse_configfile (pi_cur->id, kset); + } +if (ret <0 ) { +ulogd_log (ULOGD_ERROR ,"error during " +"configure of plugin %s\n" , + pi_cur->plugin->name); +return ret; } }
--
2.48.1
PATCH v2 6/6 all: remove trivial configure hooks
In reply to Corubba SmithThese are now covered by the default implementation.
---
Changes in v2:
- None
filter/ulogd_filter_MARK.c | 10 ---------- input/flow/ulogd_inpflow_NFCT.c | 13 ------------- input/packet/ulogd_inppkt_NFLOG.c | 10 ---------- input/packet/ulogd_inppkt_ULOG.c | 6 ------ input/packet/ulogd_inppkt_UNIXSOCK.c | 10 ---------- output/pcap/ulogd_output_PCAP.c | 7 ------- output/ulogd_output_GRAPHITE.c | 8 -------- output/ulogd_output_LOGEMU.c | 8 -------- output/ulogd_output_NACCT.c | 13 ------------- output/ulogd_output_XML.c | 13 ------------- 10 files changed, 98 deletions(-)
filter/ulogd_filter_MARK.c +0 -10
@@ -88,15 +88,6 @@ static int interp_mark(struct ulogd_pluginstance *pi)return ULOGD_IRET_OK ; } -static int configure (struct ulogd_pluginstance *upi, -struct ulogd_pluginstance_stack *stack) -{ -ulogd_log (ULOGD_DEBUG ,"parsing config file section `%s', " -"plugin `%s'\n" , upi->id, upi->plugin->name); - -return ulogd_parse_configfile (upi->id, upi->config_kset); -} -static struct ulogd_plugin mark_pluging = { .name ="MARK" , .input = {
@@ -109,7 +100,6 @@ static struct ulogd_plugin mark_pluging = { }, .interp = &interp_mark, .config_kset = &libulog_kset, - .configure = &configure, .version = VERSION, };
input/flow/ulogd_inpflow_NFCT.c +0 -13
@@ -1049,18 +1049,6 @@ static void polling_timer_cb(struct ulogd_timer *t, void *data)ulogd_add_timer (&cpi->timer,pollint_ce (upi->config_kset).u.value); } -static int configure_nfct (struct ulogd_pluginstance *upi, -struct ulogd_pluginstance_stack *stack) -{ -int ret; - - ret =ulogd_parse_configfile (upi->id, upi->config_kset); -if (ret <0 ) -return ret; - -return 0 ; -} -static void overrun_timeout (struct ulogd_timer *a,void *data) {int family =AF_UNSPEC ;
@@ -1577,7 +1565,6 @@ static struct ulogd_plugin nfct_plugin = { }, .config_kset = &nfct_kset, .interp = NULL, - .configure = &configure_nfct, .start = &constructor_nfct, .stop = &destructor_nfct, .signal = &signal_nfct,
input/packet/ulogd_inppkt_NFLOG.c +0 -10
@@ -551,15 +551,6 @@ release_ct:return ret; } -static int configure (struct ulogd_pluginstance *upi, -struct ulogd_pluginstance_stack *stack) -{ -ulogd_log (ULOGD_DEBUG ,"parsing config file section `%s', " -"plugin `%s'\n" , upi->id, upi->plugin->name); - -return ulogd_parse_configfile (upi->id, upi->config_kset); -} -static int become_system_logging (struct ulogd_pluginstance *upi,uint8_t pf) {struct nflog_input *ui = (struct nflog_input *) upi->private;
@@ -723,7 +714,6 @@ struct ulogd_plugin libulog_plugin = { .num_keys = ARRAY_SIZE(output_keys), }, .priv_size = sizeof(struct nflog_input), - .configure = &configure, .start = &start, .stop = &stop, .config_kset = &libulog_kset,
input/packet/ulogd_inppkt_ULOG.c +0 -6
@@ -266,11 +266,6 @@ static int ulog_read_cb(int fd, unsigned int what, void *param)return 0 ; } -static int configure (struct ulogd_pluginstance *upi, -struct ulogd_pluginstance_stack *stack) -{ -return ulogd_parse_configfile (upi->id, upi->config_kset); -}static int init (struct ulogd_pluginstance *upi) {struct ulog_input *ui = (struct ulog_input *) &upi->private;
@@ -325,7 +320,6 @@ struct ulogd_plugin libulog_plugin = { .keys = output_keys, .num_keys = ARRAY_SIZE(output_keys), }, - .configure = &configure, .start = &init, .stop = &fini, .config_kset = &libulog_kset,
input/packet/ulogd_inppkt_UNIXSOCK.c +0 -10
@@ -713,15 +713,6 @@ static int unixsock_server_read_cb(int fd, unsigned int what, void *param)return 0 ; } -static int configure (struct ulogd_pluginstance *upi, -struct ulogd_pluginstance_stack *stack) -{ -ulogd_log (ULOGD_DEBUG ,"parsing config file section `%s', " -"plugin `%s'\n" , upi->id, upi->plugin->name); - -return ulogd_parse_configfile (upi->id, upi->config_kset); -} -static int start (struct ulogd_pluginstance *upi) {struct unixsock_input *ui = (struct unixsock_input *) upi->private;
@@ -809,7 +800,6 @@ struct ulogd_plugin libunixsock_plugin = { .num_keys = ARRAY_SIZE(output_keys), }, .priv_size = sizeof(struct unixsock_input), - .configure = &configure, .start = &start, .stop = &stop, .config_kset = &libunixsock_kset,
output/pcap/ulogd_output_PCAP.c +0 -7
@@ -257,12 +257,6 @@ static void signal_pcap(struct ulogd_pluginstance *upi, int signal) } } -static int configure_pcap (struct ulogd_pluginstance *upi, -struct ulogd_pluginstance_stack *stack) -{ -return ulogd_parse_configfile (upi->id, upi->config_kset); -} -static int start_pcap (struct ulogd_pluginstance *upi) {return append_create_outfile (upi);
@@ -291,7 +285,6 @@ static struct ulogd_plugin pcap_plugin = { .config_kset = &pcap_kset, .priv_size = sizeof(struct pcap_instance), - .configure = &configure_pcap, .start = &start_pcap, .stop = &stop_pcap, .signal = &signal_pcap,
output/ulogd_output_GRAPHITE.c +0 -8
@@ -210,13 +210,6 @@ static int fini_graphite(struct ulogd_pluginstance *pi) {return 0 ; } -static int configure_graphite (struct ulogd_pluginstance *pi, -struct ulogd_pluginstance_stack *stack) -{ -ulogd_log (ULOGD_DEBUG ,"parsing config file section %s\n" , pi->id); -return ulogd_parse_configfile (pi->id, pi->config_kset); -} -static struct ulogd_plugin graphite_plugin = { .name ="GRAPHITE" , .input = {
@@ -230,7 +223,6 @@ static struct ulogd_plugin graphite_plugin = { .config_kset = &graphite_kset, .priv_size = sizeof(struct graphite_instance), - .configure = &configure_graphite, .start = &start_graphite, .stop = &fini_graphite,
output/ulogd_output_LOGEMU.c +0 -8
@@ -174,13 +174,6 @@ static int fini_logemu(struct ulogd_pluginstance *pi) {return 0 ; } -static int configure_logemu (struct ulogd_pluginstance *pi, -struct ulogd_pluginstance_stack *stack) -{ -ulogd_log (ULOGD_DEBUG ,"parsing config file section %s\n" , pi->id); -return ulogd_parse_configfile (pi->id, pi->config_kset); -} -static struct ulogd_plugin logemu_plugin = { .name ="LOGEMU" , .input = {
@@ -194,7 +187,6 @@ static struct ulogd_plugin logemu_plugin = { .config_kset = &logemu_kset, .priv_size = sizeof(struct logemu_instance), - .configure = &configure_logemu, .start = &start_logemu, .stop = &fini_logemu,
output/ulogd_output_NACCT.c +0 -13
@@ -197,18 +197,6 @@ sighup_handler_print(struct ulogd_pluginstance *pi, int signal) } } -static int -nacct_conf (struct ulogd_pluginstance *pi, -struct ulogd_pluginstance_stack *stack) -{ -int ret; - -if ((ret =ulogd_parse_configfile (pi->id, pi->config_kset)) <0 ) -return ret; - -return 0 ; -} -static int nacct_init (struct ulogd_pluginstance *pi) {
@@ -243,7 +231,6 @@ static struct ulogd_plugin nacct_plugin = { .output = { .type = ULOGD_DTYPE_SINK, }, - .configure = &nacct_conf, .interp = &nacct_interp, .start = &nacct_init, .stop = &nacct_fini,
output/ulogd_output_XML.c +0 -13
@@ -185,18 +185,6 @@ static int xml_output(struct ulogd_pluginstance *upi)return ULOGD_IRET_OK ; } -static int xml_configure (struct ulogd_pluginstance *upi, -struct ulogd_pluginstance_stack *stack) -{ -int ret; - - ret =ulogd_parse_configfile (upi->id, upi->config_kset); -if (ret <0 ) -return ret; - -return 0 ; -} -static int xml_fini (struct ulogd_pluginstance *pi) {struct xml_priv *op = (struct xml_priv *) &pi->private;
@@ -333,7 +321,6 @@ static struct ulogd_plugin xml_plugin = { .config_kset = &xml_kset, .priv_size = sizeof(struct xml_priv), - .configure = &xml_configure, .start = &xml_start, .stop = &xml_fini, .interp = &xml_output,
--
2.48.1