From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 1 18:31:06 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 6C5C2106564A for ; Thu, 1 Jan 2009 18:31:06 +0000 (UTC) (envelope-from patfbsd@davenulle.org) Received: from smtp.lamaiziere.net (net.lamaiziere.net [91.121.44.19]) by mx1.freebsd.org (Postfix) with ESMTP id 326FD8FC18 for ; Thu, 1 Jan 2009 18:31:06 +0000 (UTC) (envelope-from patfbsd@davenulle.org) Received: from baby-jane.lamaiziere.net (81-65-128-47.rev.numericable.fr [81.65.128.47]) by smtp.lamaiziere.net (Postfix) with ESMTPA id A9F6263366E for ; Thu, 1 Jan 2009 19:31:04 +0100 (CET) Received: from baby-jane-lamaiziere-net.local (localhost [127.0.0.1]) by baby-jane.lamaiziere.net (Postfix) with ESMTP id 792F268FFC4 for ; Thu, 1 Jan 2009 19:31:03 +0100 (CET) Date: Thu, 1 Jan 2009 19:31:02 +0100 From: Patrick =?ISO-8859-15?Q?Lamaizi=E8re?= To: freebsd-hackers@freebsd.org Message-ID: <20090101193102.2ebbbd53@baby-jane-lamaiziere-net.local> Organization: /dave/nulle X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.9; i386-apple-darwin9.3.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: hifn(4) few small changes 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: Thu, 01 Jan 2009 18:31:06 -0000 Hello and happy new year, I would like to suggest few changes in the hifn driver: diff between CURRENT: http://user.lamaiziere.net/patrick/hifn-010109/hifn-patch.txt hifn_attach() - Useless bzero of softc hifn_detach() - Return EBUSY if there is active session - Free the sessions - Use callout_drain() instead callout_stop() hifn_rng() - Remove the unused macro RANDOM_BITS hifn_newsession() - Add and use a rwlock to lock the sessions (sc->sc_sessions_lock). - Remove useless bzero of the sessions (use malloc with M_ZERO) - Use arc4rand() instead read_random() hifn_freesession() - Use a rwlock to lock the sessions hifn_process() - Use a rwlock to lock the sessions. In the current driver there is no lock to protect the sessions in hifn_process() but the sessions can be reallocated in hifn_newsession(). I think this is the cause of PR kern/91407 http://www.FreeBSD.org/cgi/query-pr.cgi?pr=kern/91407 hifn_callback() - Use a rwlock to lock the sessions. I've tested on a Soekris vpn 1411 (hifn 7955) with ipsec and openssl. Regards. (With big thanks to Mike Tancsa)