Re: [PATCH libmnl] nlmsg: introduce mnl_nlmsg_batch_rest to get the rest length

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
>     ...
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux