Re: [PATCH nft 3/3,v2] netlink_linearize: skip set element expression in map statement key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux