All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo@debian.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH v3] expression: print sets and maps in pretty format
Date: Mon, 15 May 2017 19:10:00 +0200	[thread overview]
Message-ID: <20170515171000.GA5442@salvia> (raw)
In-Reply-To: <149371834124.14706.14801320069862319378.stgit@nfdev2.cica.es>

On Tue, May 02, 2017 at 11:47:02AM +0200, Arturo Borrero Gonzalez wrote:
> Print elements per line instead of all in a single line.
> The elements which can be 'short' are printed 5 per line,
> and others, like IPv4 addresses are printed 2 per line.
> 
> Example:
> 
> % nft list ruleset -nnn
> table ip t {
> 	set s {
> 		type inet_service
> 		elements = { 1, 2, 3, 4, 10,
> 			     432, 433, 434, 435, 436,
> 			     437, 438, 439, 440, 441,
> 			     442, 443, 444, 445, 446,
> 			     447, 448, 449, 450, 12345 }
> 	}
> 
> 	map m {
> 		type inet_service . iface_index : verdict
> 		elements = { 123 . "lo" : accept,
> 			     1234 . "lo" : accept,
> 			     12345 . "lo" : accept,
> 			     12346 . "lo" : accept,
> 			     12347 . "lo" : accept }
> 	}
> 
> 	set s3 {
> 		type ipv4_addr
> 		elements = { 1.1.1.1, 2.2.2.2,
> 			     3.3.3.3 }
> 	}
> }

Applied.

It would be really great if someone can just fetch the column length
from the terminal via ioctl(), then do poor man adjustment, eg.

Assuming ipv4 address maximum length is:

        strlen("255.255.255.255");

then, divide the column length by this, so we fit as many elements as
possible by this. And so on, for each datatype.

      reply	other threads:[~2017-05-15 17:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02  9:47 [nft PATCH v3] expression: print sets and maps in pretty format Arturo Borrero Gonzalez
2017-05-15 17:10 ` 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=20170515171000.GA5442@salvia \
    --to=pablo@netfilter.org \
    --cc=arturo@debian.org \
    --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 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.