netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: nf_tables: Add meta expression key for bridge interface name
Date: Tue, 25 Mar 2014 21:43:31 +0100	[thread overview]
Message-ID: <20140325204331.GA3491@localhost> (raw)
In-Reply-To: <1395765587-5399-1-git-send-email-tomasz.bursztyka@linux.intel.com>

Hi Tomasz,

Thanks for looking into this, comments below.

On Tue, Mar 25, 2014 at 06:39:47PM +0200, Tomasz Bursztyka wrote:
> NFT_META_IBRIFNAME to get packet input bridge interface name
> NFT_META_OBRIFNAME to get packet output bridge interface name
> 
> Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
> Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
> ---
> 
> Hi Pablo,
> 
> Does that design sounds proper?
> I added the nft type right away in nft_meta.c
> to reuse as much as possible, only the evaluation is a bit specific.
> 
> I haven't tested yet, I will do the support of this meta key for nft tool
> accordingly.
> 
> Tomasz
> 
>  include/uapi/linux/netfilter/nf_tables.h |  4 ++
>  net/netfilter/nft_meta.c                 | 79 +++++++++++++++++++++++++++++++-
>  2 files changed, 81 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
> index 83c985a..e3c98f9 100644
[...]
> @@ -304,8 +356,13 @@ nft_meta_select_ops(const struct nft_ctx *ctx,
>  	if (tb[NFTA_META_DREG] && tb[NFTA_META_SREG])
>  		return ERR_PTR(-EINVAL);
>  
> -	if (tb[NFTA_META_DREG])
> +	if (tb[NFTA_META_DREG]) {
> +#ifdef CONFIG_NF_TABLES_BRIDGE
> +		if (ctx->aif->family == NFPROTO_BRIDGE)
> +			return &nft_meta_bridge_get_ops;
> +#endif

I really think we have to use Patrick's new infrastructure that allows
us to add new expression flavours per family. It should just need a
couple of exported symbols in nft_meta.c that you can use from the new
net/bridge/netfilter/nft_meta.c file. We should avoid these ifdef
games.

  parent reply	other threads:[~2014-03-25 20:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-25 16:39 [PATCH] netfilter: nf_tables: Add meta expression key for bridge interface name Tomasz Bursztyka
2014-03-25 16:42 ` Tomasz Bursztyka
2014-03-25 20:43 ` Pablo Neira Ayuso [this message]
2014-03-26  7:15   ` Tomasz Bursztyka
2014-03-26 12:12 ` Patrick McHardy
2014-03-26 13:06   ` Tomasz Bursztyka

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=20140325204331.GA3491@localhost \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=tomasz.bursztyka@linux.intel.com \
    /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).