All of lore.kernel.org
 help / color / mirror / Atom feed
* nft list sets changed behavior
@ 2023-06-18  0:42 nft.ogxzcrqhuhgchbvxcs4j7wws
  2023-06-18 11:22 ` Kerin Millar
  0 siblings, 1 reply; 7+ messages in thread
From: nft.ogxzcrqhuhgchbvxcs4j7wws @ 2023-06-18  0:42 UTC (permalink / raw)
  To: netfilter

After updating to Debian 12 my tools relying on 'nft -j list sets' fail. 
It now does not include the elements in those lists like it did on 11.

Is this hidden behind an 'anti-terse' flag now?

Web searches, the changelog on the site, and manpages didn't reveal 
anything.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nft list sets changed behavior
  2023-06-18  0:42 nft list sets changed behavior nft.ogxzcrqhuhgchbvxcs4j7wws
@ 2023-06-18 11:22 ` Kerin Millar
  2023-06-18 12:12   ` nft.ogxzcrqhuhgchbvxcs4j7wws
  0 siblings, 1 reply; 7+ messages in thread
From: Kerin Millar @ 2023-06-18 11:22 UTC (permalink / raw)
  To: nft.ogxzcrqhuhgchbvxcs4j7wws; +Cc: netfilter

On Sun, 18 Jun 2023 02:42:46 +0200
nft.ogxzcrqhuhgchbvxcs4j7wws@qmail.sunbirdgrove.com wrote:

> After updating to Debian 12 my tools relying on 'nft -j list sets' fail. 
> It now does not include the elements in those lists like it did on 11.
> 
> Is this hidden behind an 'anti-terse' flag now?
> 
> Web searches, the changelog on the site, and manpages didn't reveal 
> anything.

Running `nft list sets` doesn't list elements either. Unfortunately, whatever the intended behaviour may be, it is not documented at all. The nft(8) page states that the "list" verb should "display the elements in the specified set", which can only describe the "list set [family] table set" syntax, rather than the "list sets [family]" syntax.

I agree with the implication that to have "list sets" include the elements, unless -t is given, would be more consistent and logical. I would suggest filing a bug for further discussion.

-- 
Kerin Millar

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nft list sets changed behavior
  2023-06-18 11:22 ` Kerin Millar
@ 2023-06-18 12:12   ` nft.ogxzcrqhuhgchbvxcs4j7wws
  2023-06-18 13:35     ` Florian Westphal
  0 siblings, 1 reply; 7+ messages in thread
From: nft.ogxzcrqhuhgchbvxcs4j7wws @ 2023-06-18 12:12 UTC (permalink / raw)
  To: netfilter

Thanks for your reply. On Debian 11 it did list the elements for at 
least a year, that's why I'm surprised about this change. 0.9.8 vs. 1.0.6.

I'll look into filing a bug.

On 6/18/23 13:22, Kerin Millar wrote:
> On Sun, 18 Jun 2023 02:42:46 +0200
> nft.ogxzcrqhuhgchbvxcs4j7wws@qmail.sunbirdgrove.com wrote:
> 
>> After updating to Debian 12 my tools relying on 'nft -j list sets' fail.
>> It now does not include the elements in those lists like it did on 11.
>>
>> Is this hidden behind an 'anti-terse' flag now?
>>
>> Web searches, the changelog on the site, and manpages didn't reveal
>> anything.
> 
> Running `nft list sets` doesn't list elements either. Unfortunately, whatever the intended behaviour may be, it is not documented at all. The nft(8) page states that the "list" verb should "display the elements in the specified set", which can only describe the "list set [family] table set" syntax, rather than the "list sets [family]" syntax.
> 
> I agree with the implication that to have "list sets" include the elements, unless -t is given, would be more consistent and logical. I would suggest filing a bug for further discussion.
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nft list sets changed behavior
  2023-06-18 12:12   ` nft.ogxzcrqhuhgchbvxcs4j7wws
@ 2023-06-18 13:35     ` Florian Westphal
  2023-06-18 13:44       ` nft.ogxzcrqhuhgchbvxcs4j7wws
  2023-06-18 15:21       ` Pablo Neira Ayuso
  0 siblings, 2 replies; 7+ messages in thread
From: Florian Westphal @ 2023-06-18 13:35 UTC (permalink / raw)
  To: nft.ogxzcrqhuhgchbvxcs4j7wws; +Cc: netfilter, netfilter-devel

moving to nf-devel

nft.ogxzcrqhuhgchbvxcs4j7wws@qmail.sunbirdgrove.com <nft.ogxzcrqhuhgchbvxcs4j7wws@qmail.sunbirdgrove.com> wrote:
> Thanks for your reply. On Debian 11 it did list the elements for at least a
> year, that's why I'm surprised about this change. 0.9.8 vs. 1.0.6.
> 
> I'll look into filing a bug.

No need, consider the bug filed.

Pablo, we have a behaviour change in
"nft -j list sets".

1.0.0:
nft -j list sets : lists sets with elements.
nft list sets : no elements.

1.0.1+:
nft -j list sets : no elements.
nft list sets : no elements.

So 1.0.1+ it at least consistent, no set elements
are shown.

But it breaks at least one user setup:
> > > After updating to Debian 12 my tools relying on 'nft -j list sets' fail.
> > > It now does not include the elements in those lists like it did on 11.

I see three possible solutions:
1 - accept the breakage.
2 - repair the inconsistency so we get 1.0.0 and
    earlier behaviour back.
3 - make "list sets" *always* include set elements,
    unless --terse was given.

Thoughts? I'd go with 3, I dislike the
different behaviour that 2) implies and we already
have --terse, we just need to make use of it here.

I'd even favour 1 over 2.

This change came with
commit a1a6b0a5c3c4b4b305fa34a77932ee1c6452d1c8
cache: finer grain cache population for list commands

so it would be easy to resolve, e.g.:

diff --git a/src/cache.c b/src/cache.c
--- a/src/cache.c
+++ b/src/cache.c
@@ -235,6 +235,8 @@ static unsigned int evaluate_cache_list(struct nft_ctx *nft, struct cmd *cmd,
        case CMD_OBJ_SETS:
        case CMD_OBJ_MAPS:
                flags |= NFT_CACHE_TABLE | NFT_CACHE_SET;
+               if (!nft_output_terse(&nft->output))
+                       flags |= NFT_CACHE_SETELEM;
                break;
        case CMD_OBJ_FLOWTABLE:
                if (filter &&

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nft list sets changed behavior
  2023-06-18 13:35     ` Florian Westphal
@ 2023-06-18 13:44       ` nft.ogxzcrqhuhgchbvxcs4j7wws
  2023-06-18 15:21       ` Pablo Neira Ayuso
  1 sibling, 0 replies; 7+ messages in thread
From: nft.ogxzcrqhuhgchbvxcs4j7wws @ 2023-06-18 13:44 UTC (permalink / raw)
  To: netfilter-devel

 > No need, consider the bug filed.

Thank you!

 > Thoughts? I'd go with 3

If you care for input on -devel, I'd also go with 3, that's intuitive 
like the rest. (nft -t list set inet filter foo, nft -t list ruleset)

I already switched to looping over it, but when you need all data 
anyway, it's a few less calls.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nft list sets changed behavior
  2023-06-18 13:35     ` Florian Westphal
  2023-06-18 13:44       ` nft.ogxzcrqhuhgchbvxcs4j7wws
@ 2023-06-18 15:21       ` Pablo Neira Ayuso
  2023-06-18 16:05         ` Kerin Millar
  1 sibling, 1 reply; 7+ messages in thread
From: Pablo Neira Ayuso @ 2023-06-18 15:21 UTC (permalink / raw)
  To: Florian Westphal; +Cc: nft.ogxzcrqhuhgchbvxcs4j7wws, netfilter, netfilter-devel

On Sun, Jun 18, 2023 at 03:35:09PM +0200, Florian Westphal wrote:
> moving to nf-devel
> 
> nft.ogxzcrqhuhgchbvxcs4j7wws@qmail.sunbirdgrove.com <nft.ogxzcrqhuhgchbvxcs4j7wws@qmail.sunbirdgrove.com> wrote:
[...]
> > > > After updating to Debian 12 my tools relying on 'nft -j list sets' fail.
> > > > It now does not include the elements in those lists like it did on 11.
> 
> I see three possible solutions:
> 1 - accept the breakage.
> 2 - repair the inconsistency so we get 1.0.0 and
>     earlier behaviour back.
> 3 - make "list sets" *always* include set elements,
>     unless --terse was given.
> 
> Thoughts? I'd go with 3, I dislike the
> different behaviour that 2) implies and we already
> have --terse, we just need to make use of it here.

I'd go with 3 too, so --terse is honored.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: nft list sets changed behavior
  2023-06-18 15:21       ` Pablo Neira Ayuso
@ 2023-06-18 16:05         ` Kerin Millar
  0 siblings, 0 replies; 7+ messages in thread
From: Kerin Millar @ 2023-06-18 16:05 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Florian Westphal, nft.ogxzcrqhuhgchbvxcs4j7wws, netfilter-devel

On Sun, 18 Jun 2023 17:21:38 +0200
Pablo Neira Ayuso <pablo@netfilter.org> wrote:

> On Sun, Jun 18, 2023 at 03:35:09PM +0200, Florian Westphal wrote:
> > moving to nf-devel
> > 
> > nft.ogxzcrqhuhgchbvxcs4j7wws@qmail.sunbirdgrove.com <nft.ogxzcrqhuhgchbvxcs4j7wws@qmail.sunbirdgrove.com> wrote:
> [...]
> > > > > After updating to Debian 12 my tools relying on 'nft -j list sets' fail.
> > > > > It now does not include the elements in those lists like it did on 11.
> > 
> > I see three possible solutions:
> > 1 - accept the breakage.
> > 2 - repair the inconsistency so we get 1.0.0 and
> >     earlier behaviour back.
> > 3 - make "list sets" *always* include set elements,
> >     unless --terse was given.
> > 
> > Thoughts? I'd go with 3, I dislike the
> > different behaviour that 2) implies and we already
> > have --terse, we just need to make use of it here.
> 
> I'd go with 3 too, so --terse is honored.

I think so too. While there is a theoretical risk of breaking someone's script in the case that they were relying upon the 'new' behaviour, the present behaviour makes very little sense.

-- 
Kerin Millar

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-18 16:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-18  0:42 nft list sets changed behavior nft.ogxzcrqhuhgchbvxcs4j7wws
2023-06-18 11:22 ` Kerin Millar
2023-06-18 12:12   ` nft.ogxzcrqhuhgchbvxcs4j7wws
2023-06-18 13:35     ` Florian Westphal
2023-06-18 13:44       ` nft.ogxzcrqhuhgchbvxcs4j7wws
2023-06-18 15:21       ` Pablo Neira Ayuso
2023-06-18 16:05         ` Kerin Millar

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.