From: heitzenberger@astaro.com
To: netfilter-devel@vger.kernel.org
Cc: holger@eitzenberger.org
Subject: [ULOGD 06/15] Conffile cleanup, use common pr_debug()
Date: Sat, 02 Feb 2008 21:48:32 +0100 [thread overview]
Message-ID: <20080202205108.009892441@astaro.com> (raw)
In-Reply-To: 20080202204826.267107164@astaro.com
Hi,
Content-Disposition: inline; filename=ulogd-config-changes.diff
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Index: ulogd-netfilter/src/conffile.c
===================================================================
--- ulogd-netfilter.orig/src/conffile.c
+++ ulogd-netfilter/src/conffile.c
@@ -17,17 +17,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
+#include <ulogd/ulogd.h>
+#include <ulogd/common.h>
#include <ulogd/conffile.h>
-#ifdef DEBUG_CONF
-#define DEBUGC(format, args...) fprintf(stderr, format, ## args)
-#else
-#define DEBUGC(format, args...)
-#endif
/* points to config entry with error */
struct config_entry *config_errce = NULL;
@@ -101,6 +94,8 @@ int config_register_file(const char *fil
if (fname)
return 1;
+ pr_debug("%s: registered config file '%s'\n", __func__, file);
+
fname = (char *) malloc(strlen(file)+1);
if (!fname)
return -ERROOM;
@@ -121,12 +116,12 @@ int config_parse_file(const char *sectio
char linebuf[LINE_LEN+1];
char *line = linebuf;
+ pr_debug("%s: section='%s' file='%s'\n", __func__, section, fname);
+
cfile = fopen(fname, "r");
if (!cfile)
return -ERROPEN;
- DEBUGC("parsing section [%s]\n", section);
-
/* Search for correct section */
while (fgets(line, LINE_LEN, cfile)) {
char wordbuf[LINE_LEN];
@@ -137,7 +132,7 @@ int config_parse_file(const char *sectio
if (!(wordend = get_word(line, " \t\n[]", (char *) wordbuf)))
continue;
- DEBUGC("word: \"%s\"\n", wordbuf);
+ pr_debug("word: \"%s\"\n", wordbuf);
if (!strcmp(wordbuf, section)) {
found = 1;
break;
@@ -156,7 +151,7 @@ int config_parse_file(const char *sectio
char wordbuf[LINE_LEN];
char *wordend;
- DEBUGC("line read: %s\n", line);
+ pr_debug("line read: %s\n", line);
if (*line == '#')
continue;
@@ -164,14 +159,14 @@ int config_parse_file(const char *sectio
continue;
if (wordbuf[0] == '[' ) {
- DEBUGC("Next section '%s' encountered\n", wordbuf);
+ pr_debug("Next section '%s' encountered\n", wordbuf);
break;
}
- DEBUGC("parse_file: entering main loop\n");
+ pr_debug("parse_file: entering main loop\n");
for (i = 0; i < kset->num_ces; i++) {
struct config_entry *ce = &kset->ces[i];
- DEBUGC("parse main loop, key: %s\n", ce->key);
+ pr_debug("parse main loop, key: %s\n", ce->key);
if (strcmp(ce->key, (char *) &wordbuf)) {
continue;
}
@@ -181,7 +176,7 @@ int config_parse_file(const char *sectio
if (ce->hit && !(ce->options & CONFIG_OPT_MULTI))
{
- DEBUGC("->ce-hit and option not multi!\n");
+ pr_debug("->ce-hit and option not multi!\n");
config_errce = ce;
err = -ERRMULT;
goto cpf_error;
@@ -205,15 +200,15 @@ int config_parse_file(const char *sectio
}
break;
}
- DEBUGC("parse_file: exiting main loop\n");
+ pr_debug("parse_file: exiting main loop\n");
}
for (i = 0; i < kset->num_ces; i++) {
struct config_entry *ce = &kset->ces[i];
- DEBUGC("ce post loop, ce=%s\n", ce->key);
+ pr_debug("ce post loop, ce=%s\n", ce->key);
if ((ce->options & CONFIG_OPT_MANDATORY) && (ce->hit == 0)) {
- DEBUGC("Mandatory config directive \"%s\" not found\n",
+ pr_debug("Mandatory config directive \"%s\" not found\n",
ce->key);
config_errce = ce;
err = -ERRMAND;
--
next prev parent reply other threads:[~2008-02-02 20:51 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-02 20:48 [ULOGD 00/15] ulogd V2 improvements, round 2 heitzenberger
2008-02-02 20:48 ` [ULOGD 01/15] Add NACCT output plugin heitzenberger
2008-02-02 21:24 ` Pablo Neira Ayuso
2008-02-02 20:48 ` [ULOGD 02/15] common.h: added heitzenberger
2008-02-02 21:30 ` Pablo Neira Ayuso
2008-02-02 20:48 ` [ULOGD 03/15] Replace timer code by working version heitzenberger
2008-02-02 22:45 ` Pablo Neira Ayuso
2008-02-02 20:48 ` [ULOGD 04/15] Add IFI list heitzenberger
2008-02-02 21:36 ` Pablo Neira Ayuso
2008-02-02 21:50 ` Holger Eitzenberger
2008-02-02 22:56 ` Pablo Neira Ayuso
2008-02-02 20:48 ` [ULOGD 05/15] Add signalling subsystem heitzenberger
2008-02-19 19:38 ` Pablo Neira Ayuso
2008-02-20 8:43 ` Holger Eitzenberger
2008-02-20 12:20 ` Patrick McHardy
2008-02-20 12:23 ` Pablo Neira Ayuso
2008-02-02 20:48 ` heitzenberger [this message]
2008-02-02 21:43 ` [ULOGD 06/15] Conffile cleanup, use common pr_debug() Pablo Neira Ayuso
2008-02-02 20:48 ` [ULOGD 07/15] Renice to -1 on startup heitzenberger
2008-02-02 21:47 ` Pablo Neira Ayuso
2008-02-02 20:48 ` [ULOGD 08/15] Initial round to make plugins reconfigurable heitzenberger
2008-02-02 20:48 ` [ULOGD 09/15] llist: add llist_for_each_prev_safe() heitzenberger
2008-02-02 20:48 ` [ULOGD 10/15] Improve select performance heitzenberger
2008-02-19 19:58 ` Pablo Neira Ayuso
2008-02-02 20:48 ` [ULOGD 11/15] Add set_sockbuf_len() heitzenberger
2008-02-19 19:57 ` Pablo Neira Ayuso
2008-02-02 20:48 ` [ULOGD 12/15] Introduce global state, skip some stacks during reconfiguration heitzenberger
2008-02-02 20:48 ` [ULOGD 13/15] llist: turn poisoning off by default heitzenberger
2008-02-02 20:48 ` [ULOGD 14/15] SQLITE3: port to ulogd 2.00, mostly a rewrite heitzenberger
2008-02-02 20:48 ` [ULOGD 15/15] NFCT: rework and let it scale heitzenberger
2008-02-02 22:52 ` [ULOGD 00/15] ulogd V2 improvements, round 2 Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080202205108.009892441@astaro.com \
--to=heitzenberger@astaro.com \
--cc=holger@eitzenberger.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.