From: Sven Wegener <sven.wegener@stealer.net>
To: netfilter-devel@lists.netfilter.org
Subject: [RFC] ipset: New set type iptreemap
Date: Mon, 20 Aug 2007 22:36:45 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.0708202149370.14154@titan.stealer.net> (raw)
Hi all,
based on the feedback from Jan Engelhardt I've converted the fullipmap [1]
set type I announced last week to manage the bitmaps with a tree
structure, instead of a large flat single array. The code is based on
iptree and the name of the new type is iptreemap.
Worst case memory usage has increased slightly over fullipmap, but the
average memory usage should be lower. It also supports adding and deleting
of ranges, so it can be used to match against lists of ranges and
networks. Be aware that the set type doesn't store the range itself, but
it expands the range so that the set contains all addresses within that
range. With a pure network set type like nethash the following is not
possible:
ipset -A foo 172.16.0.0/12
ipset -D foo 172.17.0.0/16
But iptreemap will handle it as expected and after the delete operation
the set will only contain the ranges:
172.16.0.0-172.16.255.255
172.18.0.0-172.31.255.255
(The userspace part uses : as the range separator to not interfere with -
in hostnames)
For ranges that start and end at octet boundaries iptreemap will not use
any memory for the bitmaps as it manages this by reusing global allocated
bitmaps. A garbage collector checks whether a bitmap or a complete subtree
can be replaced by these global bitmaps.
I'm responding with two patches, one for the kernel part and one for the
userspace part. I think the looping code for the add and delete operation
for ranges could need some cleanup. The CHECK[1-3] macro is for checking
whether a complete subtree can be added or deleted. And the GETVALUE[1-3]
is for getting the start and end values for octets when we're inside of a
range.
Sven
[1] https://lists.netfilter.org/pipermail/netfilter-devel/2007-August/029066.html
next reply other threads:[~2007-08-20 20:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-20 20:36 Sven Wegener [this message]
2007-08-20 20:36 ` [RFC] ipset: New set type iptreemap, kernel part Sven Wegener
2007-08-21 5:59 ` Jan Engelhardt
2007-08-21 6:54 ` Sven Wegener
2007-08-21 10:20 ` Jan Engelhardt
2007-08-20 20:37 ` [RFC] ipset: New set type iptreemap, userspace part Sven Wegener
2007-08-21 11:29 ` [RFC] ipset: New set type iptreemap Jozsef Kadlecsik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0708202149370.14154@titan.stealer.net \
--to=sven.wegener@stealer.net \
--cc=netfilter-devel@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).