diff mbox

[nft,v2] rule: delete extra space in sets printing

Message ID 145270561444.23138.11119007913809214107.stgit@r2d2.cica.es
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Arturo Borrero Jan. 13, 2016, 5:21 p.m. UTC
The extra space is printed when sets are printed in tabulated format.

table inet test {
	set test {
		  ^
		type ipv4_addr
	}
}

However, the space is still required in printing in plain format (ie, monitor).

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
v2: use string test provided by Pablo and put an example of the problem
    in the patch description.

 src/rule.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Pablo Neira Ayuso March 3, 2016, 6:59 p.m. UTC | #1
On Wed, Jan 13, 2016 at 06:21:41PM +0100, Arturo Borrero Gonzalez wrote:
> The extra space is printed when sets are printed in tabulated format.
> 
> table inet test {
> 	set test {
> 		  ^
> 		type ipv4_addr
> 	}
> }
> 
> However, the space is still required in printing in plain format (ie, monitor).

Arturo, I going back in my queue of pending things (I left some stuff
behind because of NetDev 1.1).

So I'm now pushing this into the repo. Thanks for your patience.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/rule.c b/src/rule.c
index 18ff592..2f03b98 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -267,7 +267,10 @@  static void set_print_declaration(const struct set *set,
 	if (opts->table != NULL)
 		printf(" %s", opts->table);
 
-	printf(" %s { %s", set->handle.set, opts->nl);
+	printf(" %s {%s", set->handle.set, opts->nl);
+
+	if (!opts->nl[0])
+		printf(" ");
 
 	printf("%s%stype %s", opts->tab, opts->tab, set->keytype->name);
 	if (set->flags & SET_F_MAP)