All of lore.kernel.org
 help / color / mirror / Atom feed
* [libnftnl PATCH 1/3] expr: masq: optional printing of flags attr in snprintf_default
@ 2014-10-02 11:58 Arturo Borrero Gonzalez
  2014-10-02 11:58 ` [libnftnl PATCH 2/3] tests: add tests for the masq expression Arturo Borrero Gonzalez
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arturo Borrero Gonzalez @ 2014-10-02 11:58 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pablo, anayrey

The flags attribute is optional. Thus we should print only if it
was originally set.

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 0 files changed

diff --git a/src/expr/masq.c b/src/expr/masq.c
index 6a1c609..c8a6a8d 100644
--- a/src/expr/masq.c
+++ b/src/expr/masq.c
@@ -169,8 +169,10 @@ static int nft_rule_expr_masq_snprintf_default(char *buf, size_t len,
 {
 	struct nft_expr_masq *masq = nft_expr_data(e);
 
-	return snprintf(buf, len, " flags %u ",
-			 masq->flags);
+	if (e->flags & (1 << NFT_EXPR_MASQ_FLAGS))
+		return snprintf(buf, len, "flags %u", masq->flags);
+
+	return 0;
 }
 
 static int nft_rule_expr_masq_snprintf(char *buf, size_t len, uint32_t type,


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

end of thread, other threads:[~2014-10-03 12:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-02 11:58 [libnftnl PATCH 1/3] expr: masq: optional printing of flags attr in snprintf_default Arturo Borrero Gonzalez
2014-10-02 11:58 ` [libnftnl PATCH 2/3] tests: add tests for the masq expression Arturo Borrero Gonzalez
2014-10-03 12:08   ` Pablo Neira Ayuso
2014-10-02 11:58 ` [libnftnl PATCH 3/3] tests: also test nat's flags attribute Arturo Borrero Gonzalez
2014-10-03 12:08   ` Pablo Neira Ayuso
2014-10-03 12:05 ` [libnftnl PATCH 1/3] expr: masq: optional printing of flags attr in snprintf_default Pablo Neira Ayuso

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.