Subject: Re: [PATCH net-2.6.26] netlink: make socket filters work on netlink

From: Patrick McHardy <[email-masked]>
Date: Wed, 02 Apr 2008 12:00:19 +0200

jamal wrote:
> On Tue, 2008-01-04 at 13:52 +0200, Patrick McHardy wrote:
> 
>> Isn't that what nlmsg_pid already contains?
> 
> would work only on the case of user<->user.
> On kernel->user it is supposed to be owned by the kernel and set to 0.

No, in the case of events its supposed to be set to the pid of the
socket that caused the event. Check out qdisc_notify() or rtmsg_ifa()
for example.

> OTOH, one could use the nlmsg seq as a "cookie" (since that is untouched
> by the kernel) with the hope that no other process will use that same
> cookie - then you can filter events based on the cookie. Note this is
> only useful if you can guarantee that all processes running on a system
> guarantee such uniqueness of such cookies amongst each other; which is
> typically a bad assumption for a generic solution but would work.

nlmsg_seq is already used by userspace to match responses to requests,
so that probably wouldn't work very well.