All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Cc: Netfilter Development Mailing list <netfilter-devel@vger.kernel.org>
Subject: Re: [nft PATCH 2/3] src/evaluate.c: improve rule management checks
Date: Thu, 7 Apr 2016 18:39:43 +0200	[thread overview]
Message-ID: <20160407163943.GA2367@salvia> (raw)
In-Reply-To: <CAOkSjBgH5PVfRisRXb3gqTi1Feaf+gVn=AFHVEFvH-zsBn1ZSA@mail.gmail.com>

On Mon, Mar 28, 2016 at 01:32:41PM +0200, Arturo Borrero Gonzalez wrote:
> +static int rule_evaluate_cmd(struct eval_ctx *ctx)
> +{
> +	struct handle *handle = &ctx->cmd->handle;
> +
> +	/* allowed:
> +	 * - insert [position] (no handle)
> +	 * - add [position] (no handle)
> +	 * - replace <handle> (no position)
> +	 * - delete <handle> (no position)
> +	 */
> +
> +	switch (ctx->cmd->op) {
> +	case CMD_INSERT:
> +		if (handle->handle.id && handle->position.id)
> +			return handle_position_error(ctx, "Could not insert "
> +						     "rule: wrong combination"
> +						     ", use only `position' "
> +						     "instead");

I know we have this "Could not insert rule:" thing in other four spots
in the evaluation.c, but those are my fault and I'll get rid of them
soon.

Given that we now have good error reporting through location, I
suggest you use the shortened version.

	return handle_position_error(ctx, "you cannot combine this");

The error reporting we have visualizes the problem to the user.

Thanks.

  reply	other threads:[~2016-04-07 16:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23 12:51 [nft PATCH 1/3] src/rule.c: don't print trailing statement whitespace Arturo Borrero Gonzalez
2016-03-23 12:51 ` [nft PATCH 2/3] src/evaluate.c: improve rule management checks Arturo Borrero Gonzalez
2016-03-23 16:08   ` Pablo Neira Ayuso
2016-03-28 11:32     ` Arturo Borrero Gonzalez
2016-04-07 16:39       ` Pablo Neira Ayuso [this message]
2016-03-23 12:51 ` [nft PATCH 3/3] tests/shell: add testcases for Netfilter bug #965 Arturo Borrero Gonzalez
2016-04-12 23:29   ` Pablo Neira Ayuso
2016-03-29 11:17 ` [nft PATCH 1/3] src/rule.c: don't print trailing statement whitespace 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=20160407163943.GA2367@salvia \
    --to=pablo@netfilter.org \
    --cc=arturo.borrero.glez@gmail.com \
    --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.