Several nlmsghdr in the message netlink packet

Thomas Graf tgraf at suug.ch
Fri Dec 13 09:55:15 EST 2013


On 12/11/13 at 06:21pm, Emmanuel Thierry wrote:
> Hello,
> 
> I'm working on a daemon that needs to send a lot of netlink messages in the same time. For performance purposes, i thought about sending all of it in batch in the same netlink message.
> I tried a proof of concept implementation with the code below, on the XFRM system. All nlmsghdr are independent, they all give a distinct order and all have distinct sequence numbers, they can issue distinct ACKs. As an example you can in the same batch add a policy and delete it afterward. So the netlink system clearly supports this.
> 
> However, i didn't see any function to ease this kind of operations in libnl3. This results in a really hacky code (see below).
> Did i miss something ? Is there a plan to support such a feature ?

You didn't miss anything. It does not exist yet. A standard API for what
you describe would be very welcome.

I guess it should be doable to modify the message object to support
chaining and have a function to finalize an existing message and
prepare the message object to allow constructing a new message
though the existing message API.



More information about the libnl mailing list