From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [nft PATCH] netlink: Use nftnl_expr_fprintf() in netlink_dump_expr()
Date: Wed, 4 Oct 2017 23:41:11 +0200 [thread overview]
Message-ID: <20171004214111.2755-1-phil@nwl.cc> (raw)
This gets rid of the temporary buffer.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Please note that this patch depends on the previously submitted libnftnl
patch "expr: Introduce nftnl_expr_fprintf()". Since that patch is
obviously not contained in libnftnl-1.0.8, this one should not be
applied until nftables-v0.8 has been released.
---
src/netlink.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/netlink.c b/src/netlink.c
index d5d410a847624..c9859ef151213 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -520,13 +520,11 @@ void netlink_dump_rule(const struct nftnl_rule *nlr, struct netlink_ctx *ctx)
void netlink_dump_expr(const struct nftnl_expr *nle,
FILE *fp, unsigned int debug_mask)
{
- char buf[4096];
-
if (!(debug_mask & DEBUG_NETLINK))
return;
- nftnl_expr_snprintf(buf, sizeof(buf), nle, 0, 0);
- fprintf(fp, "%s\n", buf);
+ nftnl_expr_fprintf(fp, nle, 0, 0);
+ fprintf(fp, "\n");
}
static int list_rule_cb(struct nftnl_rule *nlr, void *arg)
--
2.13.1
next reply other threads:[~2017-10-04 21:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-04 21:41 Phil Sutter [this message]
2017-10-17 13:20 ` [nft PATCH] netlink: Use nftnl_expr_fprintf() in netlink_dump_expr() 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=20171004214111.2755-1-phil@nwl.cc \
--to=phil@nwl.cc \
--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).