All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Fernando Fernandez Mancera <ffmancera@riseup.net>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/2 nft] jump: Allow goto and jump to a variable using nft input files
Date: Wed, 15 May 2019 12:58:50 +0200	[thread overview]
Message-ID: <20190515105850.GA4851@orbyte.nwl.cc> (raw)
In-Reply-To: <20190514211340.913-2-ffmancera@riseup.net>

Hey,

On Tue, May 14, 2019 at 11:13:40PM +0200, Fernando Fernandez Mancera wrote:
[...]
> diff --git a/src/datatype.c b/src/datatype.c
> index 6aaf9ea..7e9ec5e 100644
> --- a/src/datatype.c
> +++ b/src/datatype.c
> @@ -297,11 +297,22 @@ static void verdict_type_print(const struct expr *expr, struct output_ctx *octx)
>  	}
>  }
>  
> +static struct error_record *verdict_type_parse(const struct expr *sym,
> +					       struct expr **res)
> +{
> +	*res = constant_expr_alloc(&sym->location, &string_type,
> +				   BYTEORDER_HOST_ENDIAN,
> +				   (strlen(sym->identifier) + 1) * BITS_PER_BYTE,
> +				   sym->identifier);
> +	return NULL;
> +}

One more thing: The above lacks error checking of any kind. I *think*
this is the place where one should make sure the symbol expression is
actually a string (but I'm not quite sure how you do that).

In any case, please try to exploit that variable support in the testcase
(or maybe a separate one), just to make sure we don't allow weird
things.

Thanks, Phil

  parent reply	other threads:[~2019-05-15 12:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14 21:13 [PATCH 1/2 nft] jump: Introduce chain_expr in jump and goto statements Fernando Fernandez Mancera
2019-05-14 21:13 ` [PATCH 2/2 nft] jump: Allow goto and jump to a variable using nft input files Fernando Fernandez Mancera
2019-05-14 22:55   ` Pablo Neira Ayuso
2019-05-15 10:46   ` Phil Sutter
2019-05-15 10:49     ` Fernando Fernandez Mancera
2019-05-15 10:58   ` Phil Sutter [this message]
2019-05-15 11:02     ` Fernando Fernandez Mancera
2019-05-15 11:12       ` Pablo Neira Ayuso
2019-05-15 11:46         ` Phil Sutter
2019-05-15 15:21           ` Pablo Neira Ayuso
2019-05-15 19:26             ` Phil Sutter
2019-05-15 19:56               ` Fernando Fernandez Mancera
2019-05-15 20:31                 ` Phil Sutter
2019-05-16 11:58                   ` Fernando Fernandez Mancera
2019-05-16 14:39                     ` Pablo Neira Ayuso
2019-05-16 14:42                       ` Fernando Fernandez Mancera
2019-05-14 22:54 ` [PATCH 1/2 nft] jump: Introduce chain_expr in jump and goto statements 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=20190515105850.GA4851@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=ffmancera@riseup.net \
    --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.