Send multicast generic netlink message from userspace

Thomas Graf tgraf at infradead.org
Tue Nov 9 18:26:52 EST 2010


Lenny,

On Tue, Nov 09, 2010 at 05:05:16PM -0500, Veytser, Leonid - 0665 - MITLL wrote:
> Is there a libnl equivalent to genlmsg_multicast? I need to send a netlink multicast message from userspace and receive it in other userpace processes. Is there anyway to do this with libnl?

No there is not. Currently your only option is to either set
the sockets peer address to the group affecting all messages,
i.e. nl_socket_set_peer_groups() or use nl_sendmsg() and
specify the correct group in the struct msghdr:

struct sockaddr_nl addr = {
	.nl_family = AF_NETLINK,
	.nl_groups = MY_MCAST_GROUP,
};

struct msghdr hdr = {
	.msg_name = (void *) &addr,
	.msg_namelen = sizeof(addr),
	.msg_iov = nlh,
	.msg_iovlen = 1,
};

nl_sendmsg(sock, msg, &hdr);



More information about the libnl mailing list