Subject: Re: Alternative approach for interface events
To: Martin Husemann <martin@duskware.de>
From: Pavel Cahyna <pavel.cahyna@st.cuni.cz>
List: tech-net
Date: 09/20/2004 23:23:54
On Mon, 20 Sep 2004 07:24:59 +0000, Martin Husemann wrote:

> On Sun, Sep 19, 2004 at 11:29:30PM +0200, Peter Postma wrote:
>> FreeBSD's eventhandler seems too much code to me for handling interface
>> changes. But if we want a general event handling mechanism then it might
>> be useful.
> 
> Agreed. But I think we need a general event handling mechanism.
> (And then use that for the sysmon events too)

Wouldn't a list of kconts be enough? (see kcont(9) and sys/kcont.h)

Or a list of knotes, which is currently used to implement kqueue (see
knote(9)). This could be used to watch for events which can be
monitored with kqueue. You could then add a new kqueue filter to
inform about interface changes, and voila the functionality you need.
(FreeBSD has already EVFILT_NETDEV to inform about link status
changes.)

(Currently knote(9) can only add events to a kqueue opened from
userspace, but extending this API to be able to run arbitrary kernel
functions instead would probably be possible. I have an (untested)
patch which should do exactly this.)

Bye	Pavel