From dfe156710a7efb1c676ef5d90729c02482a20f84 Mon Sep 17 00:00:00 2001 From: Arturo Borrero Date: Thu, 2 Oct 2014 13:58:36 +0200 Subject: expr: masq: optional printing of flags attr in snprintf_default The flags attribute is optional. Thus we should print only if it was originally set. Signed-off-by: Arturo Borrero Gonzalez Signed-off-by: Pablo Neira Ayuso --- src/expr/masq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/expr/masq.c b/src/expr/masq.c index 6a1c609..b39a43a 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 0x%x ", masq->flags); + + return 0; } static int nft_rule_expr_masq_snprintf(char *buf, size_t len, uint32_t type, -- cgit v1.2.3