Re: netlink - notify when the socket gets closed

From: Patrick McHardy
Date: Sun Dec 07 2008 - 11:04:41 EST


m m wrote:
On Sat, Dec 6, 2008 at 3:58 PM, Patrick McHardy <kaber@xxxxxxxxx> wrote:
That doesn't make sense. When you use multicast, multiple applications
can be listening to the messages. If you really need state for a single
listener and exchange messages in both directions, it sounds like you
should use unicast.


My user app register in kernel for a data. When there is a first
application request,
kernel module creates an internal record and ask DATA subsystem for a data,
which are then passed to the user application.

The data are then delivered to the application as they are comming from
the DATA subsystem.

When there's another application requesting the same data type, kernel module
just increase reference count in the internal record, and multicast delivers
data to the other app.

Now when one of those applications end, kernel module just decrease
the reference count in the internal record.

When the other application ends, kernel module needs to release the internal
record and ask the DATA subsystem to stop delivering data.

Hope this make sense... I could do some ascii art next time if needed :)

Thats an unusual way to use netlink, but it sounds reasonable.

Adding a notifier for multicast unsubscriptions should be easy.
Nothing in the kernel needs it though, so you need to carry the
patch to do this yourself until you submit your module.
--
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html