Netlink for kernel<->user space communication?
Subsystems (2)
Hi.
I'm writing a kernel driver for the HSR protocol, a standard for high availability networks. I want to send messages from the kernel to user space about broken network links. I also want user space to be able to ask the kernel about its view of the status of nodes on the network.
Netlink seems like a good tool for this. (Is it?)
But do I use raw netlink? (Described here: http://www.linuxjournal.com/article/7356 - but this seems a bit out of date, the kernel API description differs from today's kernel implementation.)
Or do I use the "Kernel Connector" (Documentation/connector/connector.txt)? Do I use libnetlink?
Or do I use libnl? (This seems to be actively maintained.)
Or are there more and even better ways to do this?
I'm having a case of information overload here and would be grateful for some guidelines.
Thanks,
Arvid Brodin
Enea Services Stockholm AB - since February 16 a part of Xdin in the Alten Group. Soon we will be working under the common brand name Xdin. Read more at www.xdin.com.
Quoted 8 lines · On Tue, 24 Apr 2012 23:52:34 +0000 Arvid Brodin <[email protected]> wrote:
Hi.
I'm writing a kernel driver for the HSR protocol, a standard for high availability networks. I want to send messages from the kernel to user space about broken network links. I also want user space to be able to ask the kernel about its view of the status of nodes on the network.
Netlink seems like a good tool for this. (Is it?)
Yes.
Quoted 3 lines
But do I use raw netlink? (Described here: http://www.linuxjournal.com/article/7356 - but this seems a bit out of date, the kernel API description differs from today's kernel implementation.)
No. Your driver probably looks like a device so you should be using rtnetlink messages.
Quoted 1 line
Or do I use the "Kernel Connector" (
Documentation/connector/connector.txt)?
no.
Quoted 1 line
Do I use libnetlink?
if you extend iproute2 to support your link type, then yes,
but use the version inside iproute2 (rather than the older extracted libnetlink in some distros).
Quoted 1 line
Or do I use libnl? (This seems to be actively maintained.)
If you aren't going to be in iproute2 then use libmnl. libnl does lots of caching etc, which makes it good for monitoring and gui tools but a pain for simple management.
Advice is free, code is what counts.