Subject: Re: multicasting netlink messages to groups > 31 from userspace

From: Patrick McHardy <[email-masked]>
Date: Wed, 04 Jul 2007 16:48:07 +0200

Johannes Berg wrote:
> On Wed, 2007-07-04 at 16:30 +0200, Patrick McHardy wrote:
> 
>>I wonder if thats really a good idea to use multicast for device
>>configuration. Unicast transmissions from userspace to kernel
>>are reliable when you don't use MSG_DONTWAIT. For multicasts
>>doing the same would mean blocking on each receiver when the
>>receive queue is full.
> 
> 
> That's a good point actually. Are transmissions from userspace to
> userspace also reliable in that case?

Yes, although in both cases you have no guarantee how long its
going to take, someone else could be flooding the receive queue.
For userspace this is more likely to be a real problem though
since the kernel will keep processing the queue as long as packets
are in it, while userspace could be scheduled away.

> In fact, we haven't quite decided yet whether we want all configuration
> to be via netlink. I strongly prefer this, but other people say that
> userspace<->userspace communication is nothing that nl80211 should be
> involved in.

I'm not so sure myself whether netlink is really a good idea for
userspace<->userspace communication because of the above reason.
IIRC Herbert had the same doubts some time ago, I wonder what
made him change his mind.

> What I initially wanted was to publish something like "Device wlan0 is
> managed by netlink pid 12345" (or 0 if the kernel is doing it) and then
> configuration would be "send to <number the kernel told you>". However,
> that got me into problems when trying to determine "is the process
> owning netlink pid 12345 still alive" at which point Herbert suggested
> the use of multicast groups (and doing the exclusion "only one manager
> per netdev" in userspace instead of the kernel).

There is a notifier for userspace unicast socket releases, would adding
another one for multicast groups help?