netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft 3/3,v2] netlink_linearize: skip set element expression in map statement key
Date: Wed, 27 Sep 2023 10:42:36 +0200	[thread overview]
Message-ID: <ZRPq/JMoVffTEDM4@calendula> (raw)
In-Reply-To: <ZRMNB+3/4rzYb08p@orbyte.nwl.cc>

On Tue, Sep 26, 2023 at 06:55:35PM +0200, Phil Sutter wrote:
> On Tue, Sep 26, 2023 at 06:02:16PM +0200, Pablo Neira Ayuso wrote:
> [...]
> > diff --git a/src/parser_json.c b/src/parser_json.c
> > index 16961d6013af..78895befbc6c 100644
> > --- a/src/parser_json.c
> > +++ b/src/parser_json.c
> > @@ -2416,6 +2416,63 @@ static struct stmt *json_parse_set_stmt(struct json_ctx *ctx,
> >  	return stmt;
> >  }
> >  
> > +static struct stmt *json_parse_map_stmt(struct json_ctx *ctx,
> > +					const char *key, json_t *value)
> > +{
> > +	struct expr *expr, *expr2, *expr_data;
> > +	json_t *elem, *data, *stmt_json;
> > +	const char *opstr, *set;
> > +	struct stmt *stmt;
> > +	int op;
> > +
> > +	if (json_unpack_err(ctx, value, "{s:s, s:o, s:o, s:s}",
> > +			    "op", &opstr, "elem", &elem, "data", &data, "map", &set))
> > +		return NULL;
> > +
> > +	if (!strcmp(opstr, "add")) {
> > +		op = NFT_DYNSET_OP_ADD;
> > +	} else if (!strcmp(opstr, "update")) {
> > +		op = NFT_DYNSET_OP_UPDATE;
> > +	} else if (!strcmp(opstr, "delete")) {
> > +		op = NFT_DYNSET_OP_DELETE;
> > +	} else {
> > +		json_error(ctx, "Unknown set statement op '%s'.", opstr);
> 
> s/set/map/

Thanks, amended here and pushed it out.

Did you ever follow up on your pull request for libjansson or did you
find a way to dynamically allocate the error reporting area that they
complain about?

Error reporting with libjansson is very rudimentary, there is no way
to tell what precisely in the command that is represented in JSON is
actually causing the error, this coarse grain error reporting is too
broad.

Thanks.

  reply	other threads:[~2023-09-27  8:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26 16:02 [PATCH nft 3/3,v2] netlink_linearize: skip set element expression in map statement key Pablo Neira Ayuso
2023-09-26 16:55 ` Phil Sutter
2023-09-27  8:42   ` Pablo Neira Ayuso [this message]
2023-09-27 11:10     ` Phil Sutter
2023-09-27 11:19       ` Pablo Neira Ayuso
2023-09-27 13:09         ` Phil Sutter
2023-09-27 14:41           ` Phil Sutter
2023-09-27 16:52             ` Pablo Neira Ayuso
2023-09-28 14:26               ` Phil Sutter

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=ZRPq/JMoVffTEDM4@calendula \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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).