From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 1 21:35:37 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A871A16A4CE; Tue, 1 Jun 2004 21:35:37 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A51B943D3F; Tue, 1 Jun 2004 21:35:37 -0700 (PDT) (envelope-from csjp@freebsd.org) Received: from freefall.freebsd.org (csjp@localhost [127.0.0.1]) i524ZbfW047609; Tue, 1 Jun 2004 21:35:37 -0700 (PDT) (envelope-from csjp@freebsd.org) Received: (from csjp@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i524Zb9S047608; Tue, 1 Jun 2004 21:35:37 -0700 (PDT) (envelope-from csjp@freebsd.org) X-Authentication-Warning: freefall.freebsd.org: csjp set sender to csjp@freebsd.org using -f Date: Tue, 1 Jun 2004 21:35:37 -0700 From: "Christian S.J. Peron" To: hackers@freebsd.org Message-ID: <20040602043537.GA42327@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i cc: ipfw@freebsd.org Subject: ipfw cached ucred patch X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2004 04:35:37 -0000 All, Currently, when you have any rules which contain UID/GID constraints, ipfw will lock the pcb hash and do a lookup to find the pcb associated with that packet -- One for each constraint. I have written a patch in attempt to minimize the impact of PCB related lookups for these type of firewall rules. This patch will have the following effects on firewalls which contain UID/GID constraints: o Greatly reduce the locking contention associated with PCB lookups. o Increase the performance of firewall in general by making PCB lookups O(1) rather than O(n) (where n represents number of UID/GID constraints in the ruleset) It would be greatly appriciated if people who are running ipfw rules sets containing UID/GID constraints tested this patch and reported any success or failures. The patch can be downloaded from: http://people.freebsd.org/~csjp/ip_fw2_cached_ucred.patch NOTE: It also appears that ip_output passes a reference to the PCB. Perhaps we can hold a reference to the ucred stored in that entry and do away with lookups on outgoing packets all-together? -- Christian S.J. Peron csjp@FreeBSD.ORG FreeBSD Committer