Re: AF_NETLINK - two questions.

root@ms2.inr.ac.ru
Fri, 18 Sep 1998 22:43:20 +0400 (MSK DST)


Hello!

> 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?

Look at drivers/net/ethertap.c.
sock_release(kernel_sock) is enough.

> How do I receive broadcasts on the userland side of the link? my code
> currently looks like this:

It is correct.

> 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.

No, it should be set to mask of groups, which application wants to listen.
-1 (really ~0U) is full set.

> Setting it to -1 however works, but then I need to be root to run the
> application. Is this the intended behaviour?

Yes, it is intended. Not-privileged user is not allowed either
listen broadcasts or send broadcasts. This limitation is VERY stupid,
but it is fascist solution of serious security problem.
Now we have no controls limiting access to groups and channels.
It is very bad, but I found no another solution yet.

> One additional thing: I'd like to register NETLINK_AX25, whom should I
> ask? David? Alan? Alexey?

Actually, you might just submit patch 8)
Direct question of this kind reminds, that we have finite number
of channels 8)8)

Alexey

-
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/