From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
Cc: The netfilter developer mailinglist <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH libmnl] nlmsg: introduce mnl_nlmsg_batch_rest to get the rest length
Date: Fri, 14 Apr 2017 00:27:00 +0200 [thread overview]
Message-ID: <20170413222700.GA5024@salvia> (raw)
In-Reply-To: <20170403061127.GA2329@gmail.com>
On Mon, Apr 03, 2017 at 03:11:27PM +0900, Ken-ichirou MATSUZAWA wrote:
> Recent languages implements array to hold its length. This patch
> enables to help to wrap these. As of this C library, we can use
> this like below without double sized buffer.
>
> char buf[MNL_SOCKET_BUFFER_SIZE];
>
> b = mnl_nlmsg_batch_start(buf, sizeof(buf));
> nlbuf = mnl_nlmsg_batch_current(b);
> rest = mnl_nlmsg_batch_rest(b);
> if (rest < NLMSG_HDRLEN)
> return false;
Only for this usecase above?
> nlh = mnl_nlmsg_put_header(nlbuf);
Probably we need mnl_nlmsg_put_header_check()?
> ...
> if (!mnl_attr_put_u8_check(nlh, rest, 1, 2))
> return false;
> ...
next prev parent reply other threads:[~2017-04-13 22:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-03 6:11 [PATCH libmnl] nlmsg: introduce mnl_nlmsg_batch_rest to get the rest length Ken-ichirou MATSUZAWA
2017-04-13 22:27 ` Pablo Neira Ayuso [this message]
2017-04-20 3:32 ` Ken-ichirou MATSUZAWA
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=20170413222700.GA5024@salvia \
--to=pablo@netfilter.org \
--cc=chamaken@gmail.com \
--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).