From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 17 12:20:48 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23F4A106566B for ; Tue, 17 Mar 2009 12:20:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F3A728FC1B for ; Tue, 17 Mar 2009 12:20:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 8FA1B46B03; Tue, 17 Mar 2009 08:20:47 -0400 (EDT) Date: Tue, 17 Mar 2009 12:20:47 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: srikanth jampala In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: SA add notification to externa module X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2009 12:20:48 -0000 On Tue, 17 Mar 2009, srikanth jampala wrote: > This is my first posting. > > I want the notifications about the SA (security association) add/delete > events, from the kernel to my externel kernel module. > > How can I do this... ? > > Thanks in advance for ur suggestions. I'm not sure if PF_KEY has an async notification event, but in principle you could consume those inside the kernel, not just in a user application. Alternatively, you might reasonably submit a patch to add an EVENTHANDLER(9) event at the right points in the kernel code so that future versions of FreeBSD will allow your code to plug in more easily. We already provide event handler hooks for things like process fork/exit, arrival/departure of network interfaces, etc. The trick is to place them at the right points so that appropriate locks are held, and you'll want to avoid having your handler code change the semantics of the calling site (i.e., don't sleep if that's not allowed). Robert N M Watson Computer Laboratory University of Cambridge