From owner-freebsd-ipfw@FreeBSD.ORG Fri Aug 25 00:35:49 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 4B0C816A4DE for ; Fri, 25 Aug 2006 00:35:49 +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 BFEFC43D46 for ; Fri, 25 Aug 2006 00:35:48 +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 k7P0Zlda096030; Thu, 24 Aug 2006 17:35:47 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id k7P0Zg13096029; Thu, 24 Aug 2006 17:35:42 -0700 (PDT) (envelope-from rizzo) Date: Thu, 24 Aug 2006 17:35:42 -0700 From: Luigi Rizzo To: Ian FREISLICH Message-ID: <20060824173542.A95870@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 Thu, Aug 24, 2006 at 02:32:04PM +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 00:35:49 -0000 On Thu, Aug 24, 2006 at 02:32:04PM +0200, Ian FREISLICH wrote: > Ian FREISLICH wrote: > > Luigi Rizzo wrote: > > > On Wed, Aug 02, 2006 at 01:42:51PM +0200, Ian FREISLICH wrote: > > > > You're thinking somewhere on the lines of: > > > > > > > > skipto base hash-if from to delta > [offset ] > > This is the syntax I've pretty much settled upon: > > skipto 1000 ip from any to any ifhash vlan[1000-1264] offset -1000 delta 100 > > Which for matching interfaces calculates the skipto target as: > > 1000 + (iface# + offset) * delta > > If you're happy with this format, I'll update the ipfw manual page > and submit a patch for review and commit. I would suggest a modification to the syntax as follows: skipto @ ... recv|xmit|via foo[A-B] base X delta D where @ is a keyword (meaning "the jump target is computed elsewhere") and "foo[A-B] base X delta D" is an extension of the interface-name option already available in ipfw. The motivations are the following: 1. "ifhash" is misleading, as it isn't really hashing anything. The real hashing, if you implemented it, is in the rule_number --> rule_ptr lookup table, which is a general mechanism and not a specific one. 2. the "foo[A-B]" in your example as a double purpose: match interface names within a range, and compute the jump target. - The former part is just an extension of the interface name syntax, so it is nicer if you implement it in a way that can be used wherever the 'foo' or 'fooN' can be. Also this part can be useful even if you add a 'starting rule' to interface descriptors. The "base X delta D" part could be optional, and if not specified it means that @ cannot be used as a jump target (or it just defaults to the next rule, or some other documented behaviour e.g. use D=1 and X = current_rule+1) - For the latter part (computing "X + (iface# - A) * D"), the 'offset' parameter that you propose is completely redundant, and i think the whole rule is a lot more readable if you put all the arguments in one place, rather than spreading them between the 'skipto' and the interface specifier. I have no idea how you wrote your current implementation but i believe that by using the above syntax even the internal implementation could be quite straightforward. cheers luigi