netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH libnftnl 2/3] common: return nlmsghdr in nftnl_batch_{begin,end}()
Date: Wed, 15 Feb 2017 11:43:35 +0100	[thread overview]
Message-ID: <1487155416-7337-2-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1487155416-7337-1-git-send-email-pablo@netfilter.org>

Useful to append netlink attributes after the batch headers.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/libnftnl/common.h |  4 ++--
 src/common.c              | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/libnftnl/common.h b/include/libnftnl/common.h
index f67f1866560f..62c8f6b5e0a3 100644
--- a/include/libnftnl/common.h
+++ b/include/libnftnl/common.h
@@ -49,7 +49,7 @@ void nftnl_parse_err_free(struct nftnl_parse_err *);
 int nftnl_parse_perror(const char *str, struct nftnl_parse_err *err);
 
 int nftnl_batch_is_supported(void);
-void nftnl_batch_begin(char *buf, uint32_t seq);
-void nftnl_batch_end(char *buf, uint32_t seq);
+struct nlmsghdr *nftnl_batch_begin(char *buf, uint32_t seq);
+struct nlmsghdr *nftnl_batch_end(char *buf, uint32_t seq);
 
 #endif
diff --git a/src/common.c b/src/common.c
index 0f23785e05d3..a95883c19080 100644
--- a/src/common.c
+++ b/src/common.c
@@ -165,17 +165,17 @@ int nftnl_cmd_footer_fprintf(FILE *fp, uint32_t cmd, uint32_t type,
 			   nftnl_cmd_footer_fprintf_cb);
 }
 
-void nftnl_batch_begin(char *buf, uint32_t seq)
+struct nlmsghdr *nftnl_batch_begin(char *buf, uint32_t seq)
 {
-	__nftnl_nlmsg_build_hdr(buf, NFNL_MSG_BATCH_BEGIN, AF_UNSPEC, 0, seq,
-				NFNL_SUBSYS_NFTABLES);
+	return __nftnl_nlmsg_build_hdr(buf, NFNL_MSG_BATCH_BEGIN, AF_UNSPEC,
+				       0, seq, NFNL_SUBSYS_NFTABLES);
 }
 EXPORT_SYMBOL(nftnl_batch_begin);
 
-void nftnl_batch_end(char *buf, uint32_t seq)
+struct nlmsghdr *nftnl_batch_end(char *buf, uint32_t seq)
 {
-	__nftnl_nlmsg_build_hdr(buf, NFNL_MSG_BATCH_END, AF_UNSPEC, 0, seq,
-				NFNL_SUBSYS_NFTABLES);
+	return __nftnl_nlmsg_build_hdr(buf, NFNL_MSG_BATCH_END, AF_UNSPEC,
+				       0, seq, NFNL_SUBSYS_NFTABLES);
 }
 EXPORT_SYMBOL(nftnl_batch_end);
 
-- 
2.1.4


  reply	other threads:[~2017-02-15 10:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15 10:43 [PATCH libnftnl 1/3] common: get rid of nftnl_batch_build_hdr() Pablo Neira Ayuso
2017-02-15 10:43 ` Pablo Neira Ayuso [this message]
2017-02-15 10:43 ` [PATCH libnftnl 3/3] rule: add NFTA_RULE_ID attribute 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=1487155416-7337-2-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).