From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH libnftnl] expr: lookup: print flags only if they are available
Date: Thu, 21 Jul 2016 19:16:23 +0200 [thread overview]
Message-ID: <1469121383-20673-1-git-send-email-pablo@netfilter.org> (raw)
Follow same approach as with other objects, print what it is set only.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/expr/lookup.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/expr/lookup.c b/src/expr/lookup.c
index 16cfce2..97478c2 100644
--- a/src/expr/lookup.c
+++ b/src/expr/lookup.c
@@ -264,8 +264,10 @@ nftnl_expr_lookup_snprintf_default(char *buf, size_t size,
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
}
- ret = snprintf(buf + offset, len, "0x%x ", l->flags);
- SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ if (e->flags & (1 << NFTNL_EXPR_LOOKUP_FLAGS)) {
+ ret = snprintf(buf + offset, len, "0x%x ", l->flags);
+ SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
+ }
return offset;
}
--
2.1.4
reply other threads:[~2016-07-21 17:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1469121383-20673-1-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.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).