]> git.ipfire.org Git - thirdparty/nftables.git/commit
expression: print sets and maps in pretty format
authorArturo Borrero Gonzalez <arturo@debian.org>
Tue, 2 May 2017 09:47:02 +0000 (11:47 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 15 May 2017 17:10:46 +0000 (19:10 +0200)
commita9dc3ceabc10f3bf43c7e9edc6d4a35ef3aa2358
treec58e110be6806e676deb20a69dd085bde4d7d1bb
parent723c4222b8771a5474307596dd4c09dbe428607b
expression: print sets and maps in pretty format

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 }
}
}

Signed-off-by: Arturo Borrero Gonzalez <arturo@debian.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/expression.c
src/netlink.c
tests/shell/testcases/maps/0003map_add_many_elements_0
tests/shell/testcases/maps/0004interval_map_create_once_0
tests/shell/testcases/maps/0005interval_map_add_many_elements_0