All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Thomas Haller <thaller@redhat.com>
Cc: NetFilter <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH nft 2/2] json: drop handling missing json() hook for "struct expr_ops"
Date: Thu, 2 Nov 2023 16:54:46 +0100	[thread overview]
Message-ID: <ZUPGRh7JZFGXfGgE@calendula> (raw)
In-Reply-To: <1cef5666d280706a3ffa5c24b30962496ca8a833.camel@redhat.com>

On Thu, Nov 02, 2023 at 03:09:42PM +0100, Thomas Haller wrote:
> On Thu, 2023-11-02 at 12:27 +0100, Pablo Neira Ayuso wrote:
> > On Thu, Nov 02, 2023 at 12:20:29PM +0100, Thomas Haller wrote:
> > > By now, all "struct expr_ops" have a json() hook set. Thus, drop
> > > handling the possibility that they might not. From now on, it's a
> > > bug
> > > to create a ops without the hook.
> > > 
> > > It's not clear what the code tried to do. It bothered to implement
> > > a
> > > fallback via fmemopen(), but apparently that fallback is no
> > > considered a
> > > good solution as it also printed a "warning". Either the fallback
> > > is
> > > good and does not warrant a warning. Or the condition is to be
> > > avoided
> > > to begin with, which we should do by testing the expr_ops
> > > structures.
> > > 
> > > As the fallback path has an overhead to create the memory stream,
> > > the
> > > fallback path is indeed not great. That is the reason to outlaw a
> > > missing json() hook, to require that all hooks are present, and to
> > > drop
> > > the fallback path.
> > > 
> > > A missing hook is very easy to cover with unit tests. Such a test
> > > shall
> > > be added soon.
> > 
> > That's fine to simplify code.
> > 
> > But then, in 1/2 you better set some STUB that hits BUG() because we
> > should not ever see variable and symbol expression from json listing
> > path ever.
> > 
> 
> I think BUG() would not work. This does happen, as the tests in patches
> 
> Subject:	[PATCH nft 0/7] add and check dump files for JSON in tests/shell
> Date:	Tue, 31 Oct 2023 19:53:26 +0100
> 
> expose.

No listing from the kernel would use the variable expression.

What example would be triggering bug?

  reply	other threads:[~2023-11-02 15:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 11:20 [PATCH nft 1/2] json: implement json() hook for "symbol_expr_ops"/"variabl_expr_ops" Thomas Haller
2023-11-02 11:20 ` [PATCH nft 2/2] json: drop handling missing json() hook for "struct expr_ops" Thomas Haller
2023-11-02 11:27   ` Pablo Neira Ayuso
2023-11-02 14:09     ` Thomas Haller
2023-11-02 15:54       ` Pablo Neira Ayuso [this message]
2023-11-02 16:17         ` Thomas Haller
2023-11-02 20:51           ` Pablo Neira Ayuso
2023-11-03  8:45             ` Thomas Haller
2023-11-03 11:53               ` Pablo Neira Ayuso
2023-11-03 12:19                 ` Florian Westphal
2023-11-03 15:16                   ` Pablo Neira Ayuso
2023-11-03 12:14               ` Florian Westphal
2023-11-02 17:39   ` Thomas Haller
2023-11-02 19:49     ` Thomas Haller
2023-11-02 11:24 ` [PATCH nft 1/2] json: implement json() hook for "symbol_expr_ops"/"variabl_expr_ops" 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=ZUPGRh7JZFGXfGgE@calendula \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=thaller@redhat.com \
    /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.