Linux Netfilter development
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/3] evaluate: allow to use string with binary operations
Date: Tue, 14 Jan 2014 12:22:52 +0000	[thread overview]
Message-ID: <20140114122251.GB27277@macbook.localnet> (raw)
In-Reply-To: <1389699030-6301-3-git-send-email-pablo@netfilter.org>

On Tue, Jan 14, 2014 at 12:30:29PM +0100, Pablo Neira Ayuso wrote:
> This allows us to match ifname masks, eg.
> 
> nft add rule filter output meta oifname and eth == eth counter
> 
> I've been investigating other possibility, such as adding
> ofiname-mask, which requires several patches and transformations
> to make it look binop tree, but I still think this looks like
> a natural way (and simple, look at the patch, it's rather small)
> to represent this in the nftables.

I was just going to suggest adding a shortcut for this since its exposing
a lot of low-level detail. The transformation should be quite easy during
evaluation, could you elaborate on the problems?

> 
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
>  src/evaluate.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/evaluate.c b/src/evaluate.c
> index 94fee64..49f0f74 100644
> --- a/src/evaluate.c
> +++ b/src/evaluate.c
> @@ -534,7 +534,8 @@ static int expr_evaluate_binop(struct eval_ctx *ctx, struct expr **expr)
>  		return -1;
>  	right = op->right;
>  
> -	if (expr_basetype(left)->type != TYPE_INTEGER)
> +	if (expr_basetype(left)->type != TYPE_INTEGER &&
> +	    expr_basetype(left)->type != TYPE_STRING)
>  		return expr_binary_error(ctx, left, op,
>  					 "Binary operation (%s) is undefined "
>  					 "for %s types",
> -- 
> 1.7.10.4

  reply	other threads:[~2014-01-14 12:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14 11:30 [PATCH 0/3 nft] [RFC] more syntax changes Pablo Neira Ayuso
2014-01-14 11:30 ` [PATCH 1/3] scanner: replace binary characters '&' '|' and '!' by their names Pablo Neira Ayuso
2014-01-14 12:00   ` Pablo Neira Ayuso
2014-01-14 12:24     ` Patrick McHardy
2014-01-14 12:21   ` Patrick McHardy
2014-01-14 11:30 ` [PATCH 2/3] evaluate: allow to use string with binary operations Pablo Neira Ayuso
2014-01-14 12:22   ` Patrick McHardy [this message]
2014-01-14 15:25     ` Pablo Neira Ayuso
2014-01-14 15:49       ` Patrick McHardy
2014-01-15  9:29         ` Pablo Neira Ayuso
2014-01-15 15:58           ` Pablo Neira Ayuso
2014-01-15 16:05             ` Patrick McHardy
2014-01-14 11:30 ` [PATCH 3/3] scanner: rename address selector from 'eth' to 'ether' Pablo Neira Ayuso
2014-01-14 12:23   ` Patrick McHardy
2014-01-14 11:47 ` [PATCH 0/3 nft] [RFC] more syntax changes Arturo Borrero Gonzalez

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=20140114122251.GB27277@macbook.localnet \
    --to=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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