From owner-freebsd-net@FreeBSD.ORG Thu Aug 14 15:21:06 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BCAD3BF5; Thu, 14 Aug 2014 15:21:06 +0000 (UTC) Received: from forward-corp1f.mail.yandex.net (forward-corp1f.mail.yandex.net [IPv6:2a02:6b8:0:801::10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Certum Level IV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 61C8F2456; Thu, 14 Aug 2014 15:21:06 +0000 (UTC) Received: from smtpcorp4.mail.yandex.net (smtpcorp4.mail.yandex.net [95.108.252.2]) by forward-corp1f.mail.yandex.net (Yandex) with ESMTP id 2B9442420040; Thu, 14 Aug 2014 19:21:02 +0400 (MSK) Received: from smtpcorp4.mail.yandex.net (localhost [127.0.0.1]) by smtpcorp4.mail.yandex.net (Yandex) with ESMTP id EC9682C05E8; Thu, 14 Aug 2014 19:21:01 +0400 (MSK) Received: from unknown (unknown [2a02:6b8:0:401:222:4dff:fe50:cd2f]) by smtpcorp4.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id h8jc9gbi16-L1IW4HC6; Thu, 14 Aug 2014 19:21:01 +0400 (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: 91582161-a429-4f64-ac2f-2c09a2800245 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1408029661; bh=rpQSF12tsRSa8XZPJqei1gilw40bceJOWEK9tZiTCuw=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=IA6/h/D4rU/JS8Sh9YWCFvNuBcza79FpjUiIRq5P+AbuFDjTdBuxrlFahwKz8mYrm GdWEgMP6ueGODIggrLIYVtsIuf8Ou5tjdKHJcjAxzo8IJQvRjffEWAl3wx4a1b0chN nLS7XxDn8xbLZn15MOq/4mcv3MFH8s4V6lhBqInA= Authentication-Results: smtpcorp4.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Message-ID: <53ECD3DA.6060501@yandex-team.ru> Date: Thu, 14 Aug 2014 19:20:58 +0400 From: "Alexander V. Chernikov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Willem Jan Withagen , Luigi Rizzo Subject: Re: [CFT] new tables for ipfw References: <53EBC687.9050503@yandex-team.ru> <53EC880B.3020903@yandex-team.ru> <53EC960A.1030603@yandex-team.ru> <53ECA6B2.8010003@digiware.nl> In-Reply-To: <53ECA6B2.8010003@digiware.nl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: "freebsd-net@freebsd.org" , Luigi Rizzo , freebsd-ipfw , "Andrey V. Elsukov" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 15:21:06 -0000 On 14.08.2014 16:08, Willem Jan Withagen wrote: > On 2014-08-14 13:15, Luigi Rizzo wrote: >> On Thu, Aug 14, 2014 at 12:57 PM, Alexander V. Chernikov < >> melifaro@yandex-team.ru> wrote: >> >>> On 14.08.2014 14:44, Luigi Rizzo wrote: >>> >>> >>> >>> >>> On Thu, Aug 14, 2014 at 11:57 AM, Alexander V. Chernikov < >>> melifaro@yandex-team.ru> wrote: >>> >>>> On 14.08.2014 13:23, Luigi Rizzo wrote: >>>> >>>> >>>> >>>> >>>> On Wed, Aug 13, 2014 at 10:11 PM, Alexander V. Chernikov < >>>> melifaro@yandex-team.ru> wrote: >>>> >>>>> Hello list. >>>>> >>>>> I've been hacking ipfw for a while and It seems there is something >>>>> ready >>>>> to test/review in projects/ipfw branch. >>>>> >>>> >>>> ​this is a fantastic piece of work, thanks for doing it and for >>>> integrating the feedback. >>>> ​ >>>> I have some detailed feedback that will send you privately, >>>> but just a curiosity: >>>> >>>> ​...​ >>>>> >>>>> Some examples (see ipfw(8) manual page for the description): >>>>> >>>>> >>>>> ​... >>>>> >>>>> >>>>> ipfw table mi_test create type cidr algo "cidr:hash masks=/30,/64" >>>>> >>>> >>>> ​why do we need to specify mask lengths in the above​ ? >>>> >>>> Well, since we're hashing IP we have to know mask to cut host >>>> bits in >>>> advance. >>>> (And the real reason is that I'm too lazy to implement hierarchical >>>> matching (check /32, then /31, then /30) like how, for example, >>>> >>> >>> ​oh well for that we should use cidr:radix >>> >>> Research results have never shown a strong superiority of >>> hierarchical hash tables over good radix implementations, >>> and in those cases one usually adopts partial prefix >>> expansion so you only have, say, masks that are a >>> multiple of 2..8 bits so you only need a small number of >>> hash lookups. >>> >>> Definitely, especially for IPv6. So I was actually thinking about >>> covering >>> some special sparse cases (e.g. someone having a bunch of /32 and a >>> bunch >>> of /30 and that's all). >>> >>> Btw, since we're talking about "good radix implementation": what >>> license >>> does DXR have? :) >>> Is it OK to merge it as another cidr implementation? >>> >> >> "cidr" is a very ugly name, i'd rather use "addr" >> >> DXR has a ​bsd license and of course it is possible to use it. >> You should ask Marko Zec for his latest version of the code >> (and probably make sure we have one copy of the code in the source >> tree). >> >> Speaking of features, one thing that would be nice is the ability >> for tables to reference the in-kernel tables (e.g. fibs, socket >> lists, interface lists...), perhaps in readonly mode. >> How complex do you think that would be ? > > I'm a very happy user of ipfw and I think these are nice improvements > and will make things more flexible... > > I have 2 nits to pick with the current version. > > I've found the notation ipnr:something rather frustrating when using > ipv6 addresses. Sort of like typing a ipv6 address in a browser, the > last :xx is always interpreted as portnumber, UNLESS you wrap it in []'s. > compare > 2001:4cb8:3:1::1 > 2001:4cb8:3:1::1:80 > [2001:4cb8:3:1::1]:80 > The first and the last are the same host but a different port, the > middle one is just a different host. > > Could/should we do the same in ipfw? Well, we should, but I'm unsure if we have host:port notation anywhere in current (or new) syntax: > > And I keep running into the > ipfw add deny all from table(50) to any > notation. the ()'s need to be escaped in most any shell. Where as I > look at the syntax there is little reason to require the ()'s. > the keyword table always needs to be followed by a number (and in the > new version a (word|number) ). We need _some_ discriminator to ensure that the next parameter after "to" or "from" is not hostname. We also have some other places where tables are used: "via interface|table(X)", lookup X, flow table(X) [new]. I agree that parenthesis might not be the best choice. (and something like :tablename:, %tablename%, or even table:tablename might look better). Theoretically, we can support both (old/new) and show rules with new one by default. > > Thanx for the nice work, > --WjW >