Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Aug 2006 17:35:42 -0700
From:      Luigi Rizzo <rizzo@icir.org>
To:        Ian FREISLICH <if@hetzner.co.za>
Cc:        freebsd-ipfw@freebsd.org
Subject:   Re: ipfw performance and random musings.
Message-ID:  <20060824173542.A95870@xorpc.icir.org>
In-Reply-To: <E1GGENQ-0008mi-2A@hetzner.co.za>; from if@hetzner.co.za on Thu, Aug 24, 2006 at 02:32:04PM %2B0200
References:  <if@hetzner.co.za> <E1GGENQ-0008mi-2A@hetzner.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <name pattern> from <number> to <number> delta <delta
> > [offset <number>]
> 
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060824173542.A95870>