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: [nft PATCH 10/28] datatype: Increase symbolic constant printer robustness
Date: Fri, 31 Oct 2025 00:22:28 +0100	[thread overview]
Message-ID: <aQPzNJYx6rTE4xTT@calendula> (raw)
In-Reply-To: <aQPoPIVk8Matl0i9@orbyte.nwl.cc>

On Thu, Oct 30, 2025 at 11:35:40PM +0100, Phil Sutter wrote:
> On Thu, Oct 30, 2025 at 10:56:04PM +0100, Pablo Neira Ayuso wrote:
> > On Thu, Oct 30, 2025 at 12:00:48PM +0100, Phil Sutter wrote:
> > > On Wed, Oct 29, 2025 at 07:36:34PM +0100, Pablo Neira Ayuso wrote:
> > > > On Thu, Oct 23, 2025 at 06:13:59PM +0200, Phil Sutter wrote:
> > > > > Do not segfault if passed symbol table is NULL.
> > > >
> > > > Is this a fix, or a cleanup?
> > >
> > > It is a fix but for a case which normally doesn't happen. It is
> > > triggered by the macro in patch 26 due to the ad-hoc struct output_ctx
> > > definition not populating the symbol tables.
> > 
> > For the debug thing that is unused? ie. #define expr_print_debug(expr)
> 
> Yes, exactly. It basically does:
> 
> | {
> | 	struct output_ctx octx = { .output_fp = stdout };
> | 
> | 	expr_print(expr, &octx);
> | }
> 
> Depending on type of 'expr', this may then call
> symbolic_constant_print(NULL, ...).
> 
> > This cannot ever happen in the code:
> > 
> > src/datatype.c: return symbolic_constant_print(octx->tbl.mark, expr, true, octx);
> > src/meta.c:     return symbolic_constant_print(&pkttype_type_tbl, expr, false, octx);
> > src/meta.c:     return symbolic_constant_print(octx->tbl.devgroup, expr, true, octx);
> > src/meta.c:     return symbolic_constant_print(&day_type_tbl, expr, true, octx);
> > src/proto.c:    return symbolic_constant_print(&ethertype_tbl, expr, false, octx);
> > src/rt.c:       return symbolic_constant_print(octx->tbl.realm, expr, true, octx);
> > 
> > And here:
> > 
> > void datatype_print(const struct expr *expr, struct output_ctx *octx)
> > {
> > ...
> >                 if (dtype->sym_tbl != NULL)
> >                         return symbolic_constant_print(dtype->sym_tbl, expr,
> >                                                        false, octx);
> > 
> > Sorry but this is all sufficiently complex to add misleading hints.
> > 
> > If you need to extend anything, then please have a look at extending
> > --debug to expose more information that you need.
> > 
> > Sorry, I do not see this is an improvement.
> 
> OK, no problem. I can just drop patch 26 and this one from the series.

I inclined to think that this is scaffolding that has helped you to
develop this series, but I am not sure expr_print_debug() will be of
use for me in the future.

  reply	other threads:[~2025-10-30 23:22 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 16:13 [nft PATCH 00/28] Fix netlink debug output on Big Endian Phil Sutter
2025-10-23 16:13 ` [nft PATCH 01/28] datatype: Fix boolean type " Phil Sutter
2025-10-23 16:13 ` [nft PATCH 02/28] optimize: Fix verdict expression comparison Phil Sutter
2025-10-23 16:13 ` [nft PATCH 03/28] tests: py: any/tcpopt.t.json: Fix JSON equivalent Phil Sutter
2025-10-23 16:13 ` [nft PATCH 04/28] tests: py: any/ct.t.json.output: Drop leftover entry Phil Sutter
2025-10-23 16:13 ` [nft PATCH 05/28] tests: py: inet/osf.t: Fix element ordering in JSON equivalents Phil Sutter
2025-10-23 16:13 ` [nft PATCH 06/28] tests: py: Fix for using wrong payload path Phil Sutter
2025-10-23 16:13 ` [nft PATCH 07/28] tests: py: Implement payload_record() Phil Sutter
2025-10-23 16:13 ` [nft PATCH 08/28] tests: py: Do not rely upon '[end]' marker Phil Sutter
2025-10-23 16:13 ` [nft PATCH 09/28] netlink: No need to reference array when passing as pointer Phil Sutter
2025-10-23 16:13 ` [nft PATCH 10/28] datatype: Increase symbolic constant printer robustness Phil Sutter
2025-10-29 18:36   ` Pablo Neira Ayuso
2025-10-30 11:00     ` Phil Sutter
2025-10-30 21:56       ` Pablo Neira Ayuso
2025-10-30 22:35         ` Phil Sutter
2025-10-30 23:22           ` Pablo Neira Ayuso [this message]
2025-10-23 16:14 ` [nft PATCH 11/28] tests: py: ip6/vmap.t: Drop double whitespace in rule Phil Sutter
2025-10-23 16:14 ` [nft PATCH 12/28] netlink: Zero nft_data_linearize objects when populating Phil Sutter
2025-10-29 18:37   ` Pablo Neira Ayuso
2025-10-30 11:08     ` Phil Sutter
2025-10-30 22:02       ` Pablo Neira Ayuso
2025-10-30 22:54         ` Phil Sutter
2025-10-23 16:14 ` [nft PATCH 13/28] Define string-based data types as Big Endian Phil Sutter
2025-10-29 18:22   ` Pablo Neira Ayuso
2025-10-30 10:20     ` Phil Sutter
2025-10-23 16:14 ` [nft PATCH 14/28] segtree: No byteorder conversion for string prefix len calculation Phil Sutter
2025-10-23 16:14 ` [nft PATCH 15/28] Fix byteorder conversion of concatenated value expressions and ranges Phil Sutter
2025-10-23 16:14 ` [nft PATCH 16/28] expression: Set range expression 'len' field Phil Sutter
2025-10-23 16:14 ` [nft PATCH 17/28] segtree: Export complete data before editing Phil Sutter
2025-10-23 16:14 ` [nft PATCH 18/28] segtree: Drop problematic constant expr len adjustment Phil Sutter
2025-10-23 16:14 ` [nft PATCH 19/28] netlink: Introduce struct nft_data_linearize::byteorder Phil Sutter
2025-10-23 16:14 ` [nft PATCH 20/28] netlink: Introduce struct nft_data_linearize::sizes Phil Sutter
2025-10-29 18:34   ` Pablo Neira Ayuso
2025-10-30 10:53     ` Phil Sutter
2025-10-23 16:14 ` [nft PATCH 21/28] netlink: Make use of nftnl_{expr,set_elem}_set_imm() Phil Sutter
2025-10-23 16:14 ` [nft PATCH 22/28] mergesort: Linearize concatentations in network byte order Phil Sutter
2025-10-29 18:27   ` Pablo Neira Ayuso
2025-10-30 10:47     ` Phil Sutter
2025-10-23 16:14 ` [nft PATCH 23/28] tests: Adjust JSON records to improved element sorting Phil Sutter
2025-10-23 16:14 ` [nft PATCH 24/28] tests: py: tools: Add regen_payloads.sh Phil Sutter
2025-10-23 16:14 ` [nft PATCH 25/28] tests: py: Update payload records Phil Sutter
2025-10-23 16:14 ` [nft PATCH 26/28] utils: Introduce expr_print_debug() Phil Sutter
2025-10-29 12:46   ` Florian Westphal
2025-10-29 18:31   ` Pablo Neira Ayuso
2025-10-30 10:16     ` Phil Sutter
2025-10-23 16:14 ` [nft PATCH 27/28] utils: Cover for missing newline after BUG() messages Phil Sutter
2025-10-29 12:47   ` Florian Westphal
2025-10-30 10:17     ` Phil Sutter
2025-10-23 16:14 ` [nft PATCH 28/28] Drop no longer needed newline in " Phil Sutter
2025-10-29 18:33   ` Pablo Neira Ayuso
2025-10-30 10:51     ` Phil Sutter
2025-10-23 20:45 ` [nft PATCH 00/28] Fix netlink debug output on Big Endian Florian Westphal
2025-10-23 20:47   ` 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=aQPzNJYx6rTE4xTT@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).