From owner-freebsd-ipfw@FreeBSD.ORG Fri Aug 25 11:52:08 2006 Return-Path: X-Original-To: freebsd-ipfw@freebsd.org Delivered-To: freebsd-ipfw@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4E16716A4DD for ; Fri, 25 Aug 2006 11:52:08 +0000 (UTC) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id EB6F143D45 for ; Fri, 25 Aug 2006 11:52:07 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.12.11) with ESMTP id k7PBq7SS004887; Fri, 25 Aug 2006 04:52:07 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id k7PBq7U8004886; Fri, 25 Aug 2006 04:52:07 -0700 (PDT) (envelope-from rizzo) Date: Fri, 25 Aug 2006 04:52:07 -0700 From: Luigi Rizzo To: Ian FREISLICH Message-ID: <20060825045207.A4746@xorpc.icir.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from if@hetzner.co.za on Fri, Aug 25, 2006 at 01:41:03PM +0200 Cc: freebsd-ipfw@freebsd.org Subject: Re: ipfw performance and random musings. X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2006 11:52:08 -0000 trimming the thing... On Fri, Aug 25, 2006 at 01:41:03PM +0200, Ian FREISLICH wrote: ... > > the problem i see above is that the 'delta' is really an attribute > > of the 'vlanA-B' instruction. > > Say you have this rule: > > > > skipto 1000 recv vlan1002-vlan1264 > > > > does it mean 'skip to 1000 plus the interface number' or > > 'skip to 1000 unconditionally' (i suppose the former because > > This means skipto 1000 if the interface is in the range since delta > defaults to zero. which proves my point - this is hidden information which you happen to know but it is not obvious, whereas an explicit difference in the syntax makes it clear. > > otherwise the 'skipto' would have two different meanings > > depending on whether or not there is a subsequent vlanA-B specifier) ? > > No, it is the delta option to skipto that determines whether the > target is calculated or not. Actually it's always calculated from again: the target is calculated using the start-of-range which is in the ifname* option. If you don't pack all the info (base+delta) in the if_name instruction, you have to lookup the 'skipto' instruction in order to do the computation. Conversely, if you just support a generic 'indirect skipto', you do the computation in the if_name (or other instruction), store the result in a well-known place (basically a variable in the function) and then when/if you find the skipto you use the value from there. > So my current thinking is to extend the recv,xmit,via syntax to use > a range, so that you can do: > > deny udp from any to any via re0-re5 > fwd 127.0.0.1:3182 tcp from any to any 80 in recv fxp3-fxp7 i am basically ok with this except, as i said, that there is no point in replicating the interface name i.e. why re0-re5 instead of just re0-5 ? you just open up to possible mistakes and the need for extra code to check what happens when the user types re2-de5 (by mistake or intentionally). > > if you make it a hash table you don't have to worry about static sizes, > > and it also removes the multiple number -> pointer entries that are > > embedded in the rules (mostly important from an update-cost point of view). > > Except that you see how badly the hash affects CPU utilisation in the > case of the vlan driver: hash - 75% CPU, lookup table - 3% CPU at that might depend on a poor match between the hash table size and the actual data set, or an expensive hash function. That's a huge difference that cannot be explained otherwise. > In private mail. ok thanks. luigi