From owner-freebsd-hackers@freebsd.org Mon Jun 17 18:13:28 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3031215C16D9 for ; Mon, 17 Jun 2019 18:13:28 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A41237557E; Mon, 17 Jun 2019 18:13:26 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1hcw86-000Fld-Qh; Mon, 17 Jun 2019 21:13:18 +0300 Date: Mon, 17 Jun 2019 21:13:18 +0300 From: Slawa Olhovchenkov To: Lev Serebryakov Cc: FreeBSD Hackers Subject: Re: Does `sys/net/radix.c` support non-contiguous masks? Message-ID: <20190617181318.GJ47119@zxy.spb.ru> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-Rspamd-Queue-Id: A41237557E X-Spamd-Bar: ++++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [4.77 / 15.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.94)[0.939,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[zxy.spb.ru]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.95)[0.948,0]; RCVD_TLS_LAST(0.00)[]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[zxy.spb.ru]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_SPAM_LONG(0.99)[0.993,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:5495, ipnet:195.70.192.0/19, country:RU]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.00)[country: RU(0.01)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jun 2019 18:13:28 -0000 On Mon, Jun 17, 2019 at 08:41:56PM +0300, Lev Serebryakov wrote: > > I'm trying to use `sys/net/radix.c` to store flow data (proto + src > ip/port + dst ip/port) with non-contiguous masks (like "TCP from any > address/port to 192.168.134.1"). I've written very simple prototype > userland code [1] but it hangs in infinite loop on addition of second > node (!). > > Is it supported? > > Could somebody look at code and say, what do I do wrong? For use non-contiguous masks you need use 'Cecilia' algorithm by Paul Tsuchiya "A Search Algorithm for Table Entries with Non-contiguous Wildcarding" https://pdfs.semanticscholar.org/9426/13f5634855a709bfecca296148bbd28810e7.pdf be careful: not fully correct.