netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: pablo@netfilter.org, anayrey@gmail.com
Subject: [libnftnl PATCH 1/3] expr: masq: optional printing of flags attr in snprintf_default
Date: Thu, 02 Oct 2014 13:58:36 +0200	[thread overview]
Message-ID: <20141002115836.10972.3637.stgit@nfdev.cica.es> (raw)

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,


             reply	other threads:[~2014-10-02 11:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-02 11:58 Arturo Borrero Gonzalez [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141002115836.10972.3637.stgit@nfdev.cica.es \
    --to=arturo.borrero.glez@gmail.com \
    --cc=anayrey@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).