I've got two questions concerning the use of AF_NETLINK sockets.
I want to use a netlink socket to communicate with an application in
userspace. How do I properly destroy the kernel side of the link e.g. on
module unload?
How do I receive broadcasts on the userland side of the link? my code
currently looks like this:
--- snip ---
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_AX25);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return 1;
}
nladdr.nl_family = AF_NETLINK;
nladdr.nl_pid = 0;
nladdr.nl_groups = -1;
if (bind(fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) {
perror("bind");
return 1;
}
--- snap ---
The code in netlink/af_netlink.c seems to suggest that for broadcast
reception nl_groups should be set to 0, however the code in
netlink_broadcast() simply skips sockets that have nl_groups set to 0.
Setting it to -1 however works, but then I need to be root to run the
application. Is this the intended behaviour? I thought that only
multicast reception (reception on a certain multicast group) be
privileged, but I may be wrong here.
One additional thing: I'd like to register NETLINK_AX25, whom should I
ask? David? Alan? Alexey?
Gruss,
Matthias
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/