netdev
[Top] [All Lists]

Re: [Lse-tech] Re: A common layer for Accounting packages

To: Kaigai Kohei <kaigai@xxxxxxxxxxxxx>
Subject: Re: [Lse-tech] Re: A common layer for Accounting packages
From: Thomas Graf <tgraf@xxxxxxx>
Date: Mon, 28 Feb 2005 03:32:06 +0100
Cc: Marcelo Tosatti <marcelo.tosatti@xxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxx>, davem@xxxxxxxxxx, jlan@xxxxxxx, lse-tech@xxxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <42227AEA.6050002@xxxxxxxxxxxxx>
References: <421993A2.4020308@xxxxxxxxxxxxx> <421B955A.9060000@xxxxxxx> <421C2B99.2040600@xxxxxxxxxxxxx> <421CEC38.7010008@xxxxxxx> <421EB299.4010906@xxxxxxxxxxxxx> <20050224212839.7953167c.akpm@xxxxxxxx> <20050227094949.GA22439@xxxxxxxxxx> <4221E548.4000008@xxxxxxxxxxxxx> <20050227140355.GA23055@xxxxxxxxxx> <42227AEA.6050002@xxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
First of all, I'm not aware of the whole discussion, ignore this if it
has been brought to attention already.

> > Yep, the netlink people should be able to help - they known what would be
> > required for not sending messages in case there is no listener registered.
> >
> > Maybe its already possible? I have never used netlink myself.

The easiest way is to use netlink_broadcast() and have userspace
register to a netlink multicast group (set .nl_groups before connecting
the socket). The netlink message will be sent to only those netlink
sockets assigned to the group, no message will be send out if no
userspace listeners has registered.

Did you have a look at the syscall enter/exit audit netlink hooks
before trying to invent your own thing?

I can also give you some code if you want, I use it to track the path
of skbs in the net stack. It puts events into a preallocated ring buffer
and a separate kernel thread broadcasts them over netlink. The events
can be enqueued in any context at the cost of a possible ring buffer
overrun resulting in loss of events. It's just a debugging hack though.

<Prev in Thread] Current Thread [Next in Thread>