From owner-freebsd-net@FreeBSD.ORG Thu Aug 14 12:08:57 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 C38AE4A0; Thu, 14 Aug 2014 12:08:57 +0000 (UTC) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.fer.hr", Issuer "TERENA SSL CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 274362C8A; Thu, 14 Aug 2014 12:08:56 +0000 (UTC) Received: from x23 (31.147.112.155) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server (TLS) id 14.2.342.3; Thu, 14 Aug 2014 14:07:44 +0200 Date: Thu, 14 Aug 2014 14:08:18 +0200 From: Marko Zec To: "Alexander V. Chernikov" Subject: Re: [CFT] new tables for ipfw Message-ID: <20140814140818.3539d9c5@x23> In-Reply-To: <53ECA302.8010100@yandex-team.ru> References: <53EBC687.9050503@yandex-team.ru> <53EC880B.3020903@yandex-team.ru> <53EC960A.1030603@yandex-team.ru> <53ECA302.8010100@yandex-team.ru> Organization: FER X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.19; amd64-portbld-freebsd9.1) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [31.147.112.155] Cc: "freebsd-net@freebsd.org" , Luigi Rizzo , freebsd-ipfw 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 12:08:57 -0000 On Thu, 14 Aug 2014 15:52:34 +0400 "Alexander V. Chernikov" wrote: > On 14.08.2014 15:15, Luigi Rizzo wrote: > > > > > > > > On Thu, Aug 14, 2014 at 12:57 PM, Alexander V. Chernikov=20 > > > wrote: > > > > On 14.08.2014 14:44, Luigi Rizzo wrote: > >> > >> > >> > >> On Thu, Aug 14, 2014 at 11:57 AM, Alexander V. Chernikov > >> > > >> wrote: > >> > >> On 14.08.2014 13:23, Luigi Rizzo wrote: > >>> > >>> > >>> > >>> On Wed, Aug 13, 2014 at 10:11 PM, Alexander V. Chernikov > >>> > > >>> 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. > >>> > >>> > >>> =E2=80=8Bthis is a fantastic piece of work, thanks for doing = it > >>> and for integrating the feedback. > >>> =E2=80=8B > >>> I have some detailed feedback that will send you > >>> privately, but just a curiosity: > >>> > >>> =E2=80=8B...=E2=80=8B > >>> > >>> Some examples (see ipfw(8) manual page for the > >>> description): > >>> > >>> =E2=80=8B... > >>> > >>> > >>> ipfw table mi_test create type cidr algo "cidr:hash > >>> masks=3D/30,/64" > >>> > >>> > >>> =E2=80=8Bwhy do we need to specify mask lengths in the above= =E2=80=8B ? > >> 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, > >> > >> > >> =E2=80=8Boh 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" > Ok, no problem with that. "addr" really sounds better. > > > > DXR has a =E2=80=8Bbsd 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). > Great!. I'll ask him :) The so far cleanest DXR implementation is significantly C++ poluted and wrapped inside Click glue (available here: http://www.nxab.fer.hr/dxr) I'll try to backport the fixes to the original C-only / BSD implementation over the weekend and let you know how it goes... Marko > > > > 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 ? > Implementing algo support for particular provider like > sockets/iflists shouldn't be hard. Most of the algorithms complexity > lies in table modifications. Here we have to support > lookup and dump operations, so it is the question of providing > necessary bindings to existing mechanisms (via some direct binding or > utilizing things like kernel_sysctl for dump support). >=20 > It looks like the following maps well to current table concept: > * such tables are not created by default > * user issues > `ipfw table kfib create type addr algo "addr:kernel fib=3D0"` > or > `ipfw table ktcp create type flow algo "flow:kernel_tcp fib=3D0"` > or > `ipfw table kiface create type iface algo "iface:kernel"` > * tables have special "readonly" type, flush_all requests are ignored > * no state stored internally >=20 > So generic table handling code needs to be modified to support > read-only tables (and making more callbacks optional). > Additionally, we might need to proxy "info" request info algo > callback (optional, "real" algorithms won't implement it) to be able > to show number of items (and some other info) to user. >=20 >=20 >=20 > > > > cheers > > luigi > > >=20 > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"