Skip to contentSkip to conversation

ipset type "expire"

PATCH In review Clifford Wolf 3 participants 5 messages May 19, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipset type "expire"

Hi,

I've already mailed with Jozsef Kadlecsik about this patch in March. It seamed to me as he liked it, but it did not show up in the netfilter subversion repository so far..

http://www.clifford.at/priv/ipset_expire_v2.patch

This patch adds an "expire" ipset type. The entries in such IP sets expire automatically after the specified timeout. This is useful e.g. for portknocking setups or blacklisting IPs for some time without any userland daemons running.

Please apply the patch in the subversion repository or comment on it if you think it should not be included..

yours,
- clifford

Signature · 7 lines
SSSS PPPP L     The SPL Programming Language
S    P  P L     http://www.clifford.at/spl/
SSSS PPPP L     ----------------------------------------------------
   S P    L     An object oriented, stateful, simple, small, c-like,
SSSS P    LLLL  embeddable, feature rich, dynamic scripting language
 
Hardware /nm./: the part of the computer that you can kick.
#1 lore raw

Hi Clifford,

Quoted 6 lines · Clifford Wolf

I've already mailed with Jozsef Kadlecsik about this patch in March. It seamed to me as he liked it, but it did not show up in the netfilter subversion repository so far..

http://www.clifford.at/priv/ipset_expire_v2.patch

Quoted 7 lines

This patch adds an "expire" ipset type. The entries in such IP sets expire automatically after the specified timeout. This is useful e.g. for portknocking setups or blacklisting IPs for some time without any userland daemons running.

Please apply the patch in the subversion repository or comment on it if you think it should not be included..

After rewieving your patch I rejected to add it to ipset due to the linear storage of the addresses/timeouts. But therefore I wrote 'iptree' type, which implements the same functionality avoiding linear storarge and was released at 11 Apr 2005 in ipset 2.2.0:

| A new set type called 'iptree' (inspired and triggered by Clifford
| Wolf) added, which makes possible to store IP addresses which
| automatically time out. Please note, this is an initial new feature with
| some hardcoded parameter (like the frequency of garbage collection) and
| thus may change in the future.

Sorry for not letting you directly about the decision.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary
#2 lore raw

Hi,

Quoted 5 lines · Jozsef Kadlecsik
| A new set type called 'iptree' (inspired and triggered by Clifford
| Wolf) added, which makes possible to store IP addresses which
| automatically time out. Please note, this is an initial new feature with
| some hardcoded parameter (like the frequency of garbage collection) and
| thus may change in the future.

oh, great! so please forget about my prev mail then.. ;-)

yours,
- clifford

--
ocaml graphics.cma <( echo 'open Graphics;;open_graph " 640x480"let complex_mul(a,b)(c,d)=(a*.c-.b*.d,a*.d+.b*.c)let complex_add(a,b)(c ,d)=(a+.c,b+.d);;let rec mandel c n=if n>0 then let z=mandel c(n-1) in complex_add(complex_mul z z)c else (0.0,0.0);; for x=0 to 640 do for y=0 to 480 do let c=((float_of_int(x-450))/.200.0,(float_of_int (y-240))/.200.0) in let cabs2(a,b)=(a*.a)+.(b*.b)in if cabs2(mandel c 50)<4.0 then plot x y done done;;read_line()' )

Press CTRL-ALT-DEL now for an IQ test.

#3 lore raw
In reply to Jozsef Kadlecsik
Quoted 7 lines · * Jozsef Kadlecsik ([email protected]) wrote:
| A new set type called 'iptree' (inspired and triggered by Clifford
| Wolf) added, which makes possible to store IP addresses which
| automatically time out. Please note, this is an initial new feature with
| some hardcoded parameter (like the frequency of garbage collection) and
| thus may change in the future.

Sorry for not letting you directly about the decision.

Stupid question, does this now do everything ipt_recent does but better? I certainly don't mind my module being depreciated in favor of this provided it's better/faster/etc. ipt_recent didn't need to implement garbage collection, but perhaps that means you're able to support a larger number of IP addresses than ipt_recent could? Is it hash-based? Are the set/check/update rules able to do the same thing?

Thanks,

Stephen

#4 lore raw
Quoted 8 lines · Stephen Frost
Quoted 5 lines · * Jozsef Kadlecsik ([email protected]) wrote:
| A new set type called 'iptree' (inspired and triggered by Clifford
| Wolf) added, which makes possible to store IP addresses which
| automatically time out. Please note, this is an initial new feature with
| some hardcoded parameter (like the frequency of garbage collection) and
| thus may change in the future.

Stupid question, does this now do everything ipt_recent does but better?

iptree type of ipset does not have anything equivalent with --seconds, --hitcount or -rttl of recent match. Also, if an address is in the set and there is an attemtp to add it again, it's equivalent with --update. Otherwise one can implement about the same kind of things using either of them.

Quoted 5 lines

I certainly don't mind my module being depreciated in favor of this provided it's better/faster/etc. ipt_recent didn't need to implement garbage collection, but perhaps that means you're able to support a larger number of IP addresses than ipt_recent could? Is it hash-based? Are the set/check/update rules able to do the same thing?

iptree uses a natural tree to store the IP addresses: for example when 168.1.2.3 stored alone from 168.1.2.0/24, it looks like

0. level [0,..,168,...255]
1. level |-> [0,1,....255]
2. leve |-> [0,1,2,...255]
3. level |-> [0,0,0,timeout,0,...0]

At checking the tree is walked and just the timeout value is compared. Therefore in order to get rid of "empty" levels or branches, garbage collection is initiated from time to time.

I think they are like apple and pear :-)

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics

          H-1525 Budapest 114, POB. 49, Hungary