libnl userspace to userspace

Thomas Graf tgraf at infradead.org
Mon Mar 26 08:10:10 EDT 2012


On Mon, Mar 19, 2012 at 09:32:03AM -0600, Scott Bonar wrote:
> I have no problem using libnl-3 to communicate from
> userspace-to-kernel, but I also would like to use it as an IPC
> method between 2 userspace apps and have been unsuccessful.
> 
> So my questions are:
> //a) has anyone done this and do you have a simple recipe I can follow?

Basically all you need to do is to set the peer port of your local socket
to the port id of the remote socket in the other process using
nl_socket_set_peer_port()

See:
http://www.infradead.org/~tgr/libnl/doc/core.html#_socket_attributes

I have never used this but it should work. Let me know if you run into
any issues.

> b) my current issue is that even though I am registering my genl
> family, it does not seem to be getting pushed to the socket, so when
> the client app tries to resolve the family to an ID it gets an
> error.  Any thoughts on what I might be doing wrong?

Ah, I see what you are trying to do. The resolving only works for
families which are registered by the kernel. There is no kernel API
which allows userspace to modify the registration table.

You can theoretically use generic netlink between userspace processes
but nobody has done it so far. There are no APIs and no automation in
libnl yet.



More information about the libnl mailing list