netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Leblond <eric@regit.org>
To: netfilter-devel@vger.kernel.org
Cc: eric@regit.org
Subject: [PATCH 2/3] conf: add flag to allow option setup tuning
Date: Sat, 19 Jan 2013 10:50:34 +0100	[thread overview]
Message-ID: <1358589035-1275-3-git-send-email-eric@regit.org> (raw)
In-Reply-To: <1358589035-1275-1-git-send-email-eric@regit.org>

This patch adds a flag to the config_entry structure to be able to
tune setup. First usage is to ask config parser not to update a key
if it has been already set.

Signed-off-by: Eric Leblond <eric@regit.org>
---
 include/ulogd/conffile.h |    4 ++++
 src/conffile.c           |    3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/ulogd/conffile.h b/include/ulogd/conffile.h
index 7431243..aa35809 100644
--- a/include/ulogd/conffile.h
+++ b/include/ulogd/conffile.h
@@ -41,11 +41,15 @@ enum {
 #define CONFIG_OPT_MANDATORY	0x0001
 #define CONFIG_OPT_MULTI	0x0002
 
+/* valid flag part */
+#define CONFIG_FLAG_VAL_PROTECTED	(1<<0)
+
 struct config_entry {
 	char key[CONFIG_KEY_LEN];	/* name of config directive */
 	u_int8_t type;			/* type; see above */
 	u_int8_t options;		/* options; see above  */
 	u_int8_t hit;			/* found? */
+	u_int8_t flag;			/* tune setup of option */
 	union {
 		char string[CONFIG_VAL_STRING_LEN];
 		int value;
diff --git a/src/conffile.c b/src/conffile.c
index b27187e..8dbd726 100644
--- a/src/conffile.c
+++ b/src/conffile.c
@@ -167,7 +167,8 @@ int config_parse_file(const char *section, struct config_keyset *kset)
 		for (i = 0; i < kset->num_ces; i++) {
 			struct config_entry *ce = &kset->ces[i];
 			pr_debug("parse main loop, key: %s\n", ce->key);
-			if (strcmp(ce->key, (char *) &wordbuf)) {
+			if ((strcmp(ce->key, (char *) &wordbuf)) ||
+			     ce->flag & CONFIG_FLAG_VAL_PROTECTED) {
 				continue;
 			}
 
-- 
1.7.10.4


  parent reply	other threads:[~2013-01-19  9:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-19  9:50 [ulogd patch 0/3] improve ulogd command line Eric Leblond
2013-01-19  9:50 ` [PATCH 1/3] ulogd: add -v option to display message on stderr Eric Leblond
2013-01-19  9:50 ` Eric Leblond [this message]
2013-01-19  9:50 ` [PATCH 3/3] Add -l option to set log level from command line Eric Leblond
2013-01-25 22:28 ` [ulogd patch 0/3] improve ulogd " Eric Leblond

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=1358589035-1275-3-git-send-email-eric@regit.org \
    --to=eric@regit.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).