netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo@debian.org>
Cc: Netfilter Development Mailing list
	<netfilter-devel@vger.kernel.org>,
	Florian Westphal <fw@strlen.de>
Subject: Re: [nft RFC PATCH] rule: introduce new option to print set elements per line
Date: Tue, 25 Apr 2017 12:15:19 +0200	[thread overview]
Message-ID: <20170425101519.GA4535@salvia> (raw)
In-Reply-To: <CAOkSjBiEXbX9dOgRYu6Zyqmijc1DCksr1Zm7d+bcL+tNHZuyEg@mail.gmail.com>

On Tue, Apr 25, 2017 at 11:35:24AM +0200, Arturo Borrero Gonzalez wrote:
> On 25 April 2017 at 11:22, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > Hi Arturo,
> >
> > On Fri, Apr 21, 2017 at 12:30:24PM +0200, Arturo Borrero Gonzalez wrote:
> >> Add a new option to nft to print set elements per line instead
> >> of all in a single line.
> >> This is useful when printing a ruleset with very big sets.
> >>
> >> The new option is -t/--elements.
> >>
> >> Annonymous sets/maps/concats are not affected by this. The default
> >> behaviour is not changed.
> >>
> >> Example:
> >>
> >> % nft list ruleset -t -nn
> >> table ip t {
> >>       set s {
> >>               type inet_service
> >>               elements = { 1,
> >>                               2,
> >>                               3,
> >>                               4,
> >>                               12345 }
> >
> > Can we do a more intelligent folding? Via TIOCGWINSZ we can obtain the
> > number of columns so we can try to fit as many elements as possible
> > without wrapping around. Instead of one element per line? I know what
> > I'm asking is harder, but I would like that we explore this path
> > before adding this.
> >
> > And I think we should do this by default, no need for an option.
> > Unless you are a robot, you want an output that you can actually read
> > without lots of lines wrapping around, eg. a very large sets with
> > thousands of elements.
> 
> Ok, by default then.
> 
> Regarding a more intelligent output, the complexity increases quickly,
> since it would require to 'parse' the set before printing it (you
> know, knowing the element printed length, the terminal window size, et
> all). I guess that doing this right may slow down the output a lot,
> similar to what happens in math programs outputs (gnu octave).
> 
> What about an intermediate way?
> 
> if integers, print 4 o 5 per line.
> if maps, contactenations, IPs or strings, print one per line

Give a shot a let's see how this looks like.

      parent reply	other threads:[~2017-04-25 10:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21 10:30 [nft RFC PATCH] rule: introduce new option to print set elements per line Arturo Borrero Gonzalez
2017-04-25  9:20 ` [nft,RFC] " Florian Westphal
2017-04-25  9:22 ` [nft RFC PATCH] " Pablo Neira Ayuso
2017-04-25  9:35   ` Arturo Borrero Gonzalez
2017-04-25  9:44     ` Florian Westphal
2017-04-25 10:15       ` Pablo Neira Ayuso
2017-04-25 10:15     ` Pablo Neira Ayuso [this message]

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=20170425101519.GA4535@salvia \
    --to=pablo@netfilter.org \
    --cc=arturo@debian.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /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).