diff options
author | Arturo Borrero <arturo.borrero.glez@gmail.com> | 2014-10-02 13:58:36 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-10-03 14:04:21 +0200 |
commit | dfe156710a7efb1c676ef5d90729c02482a20f84 (patch) | |
tree | 29a0442db77f61ced99c78836823fd472a2abf2f /src/expr | |
parent | 0bff331b5586b995a5f7df81f8f7b290c96ac188 (diff) |
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 <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expr')
-rw-r--r-- | src/expr/masq.c | 6 |
1 files 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, |