Linux Netfilter development
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Eric Leblond <eric@inl.fr>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [ULOGD PATCH 2/5] New MARK filtering module.
Date: Fri, 06 Jun 2008 15:29:49 +0200	[thread overview]
Message-ID: <48493BCD.4020605@trash.net> (raw)
In-Reply-To: <1212758035-19538-3-git-send-email-eric@inl.fr>

Eric Leblond wrote:
> +static struct config_keyset libulog_kset = {
> +	.num_ces = 2,
> +	.ces = {
> +		{
> +			.key 	 = "mark",
> +			.type 	 = CONFIG_TYPE_INT,
> +			.options = CONFIG_OPT_NONE,
> +			.u.value = 0,
> +		},
> +		{
> +			.key 	 = "mask",
> +			.type 	 = CONFIG_TYPE_INT,
> +			.options = CONFIG_OPT_NONE,
> +			.u.value = 0xffffffff,
> +		},
> +
> +	}
> +};
> +	
> +#define mark_ce(x)	(x->ces[0])
> +#define mask_ce(x)	(x->ces[1])


This magic value stuff is an error-prone mess in my opinion.
Could we for future modules agree to always do something like
this:

enum foo_keys {
	FOO_MARK,
	FOO_MASK,
	...
};

struct config_keyset foo_kset = {
...
	.ces = {
		[FOO_MARK] = {
			...
		},
	},
};

Or maybe resolve them at runtime using the key string in
performance uncritical paths?


  parent reply	other threads:[~2008-06-06 13:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-06 13:13 [ULOGD PATCH 0/5] New filter module MARK and misc fixes Eric Leblond
2008-06-06 13:13 ` [ULOGD PATCH 1/5] Fix logic of propagation trough the stack Eric Leblond
2008-06-06 13:13   ` [ULOGD PATCH 2/5] New MARK filtering module Eric Leblond
2008-06-06 13:13     ` [ULOGD PATCH 3/5] Enable reading of hex or dec integer in config file Eric Leblond
2008-06-06 13:13       ` [ULOGD PATCH 4/5] Use ULOGD_IRET_* as return for all interp functions Eric Leblond
2008-06-06 13:13         ` [ULOGD PATCH 5/5] Update configfile for MARK module Eric Leblond
2008-06-12  9:19           ` Pablo Neira Ayuso
2008-06-12  9:19         ` [ULOGD PATCH 4/5] Use ULOGD_IRET_* as return for all interp functions Pablo Neira Ayuso
2008-06-06 13:23       ` [ULOGD PATCH 3/5] Enable reading of hex or dec integer in config file Patrick McHardy
2008-06-12  9:19       ` Pablo Neira Ayuso
2008-06-06 13:29     ` Patrick McHardy [this message]
2008-06-06 13:34       ` [ULOGD PATCH 2/5] New MARK filtering module Eric Leblond
2008-06-08 10:12       ` [ULOGD PATCH] Resent, new " Eric Leblond
2008-06-12  9:18         ` Pablo Neira Ayuso
2008-06-12  9:18   ` [ULOGD PATCH 1/5] Fix logic of propagation trough the stack 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=48493BCD.4020605@trash.net \
    --to=kaber@trash.net \
    --cc=eric@inl.fr \
    --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