Skip to contentSkip to conversation

[Fwd: Re: bloom filter in netfilter?]

Fwd: Re: bloom filter in netfilter? Sebastien Tandel 3 participants 6 messages Mar 20, 2007 – Mar 21, 2007 netfilter

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

forgot to CC to the list ... :-/

Quoted 5 lines · Patrick McHardy
Quoted 4 lines · Pablo Neira Ayuso
Quoted 3 lines

I was then wondering if we could not get rid of these two list_for_each_entry in the __nf_conntrack_confirm by using the bloom filters.

Quoted 8 lines
Quoted 3 lines

We can't just get rid of it since bloom filters have false positives, so it could happen that we could miss some new connections that are not actually in the conntrack table.

That wouldn't be a big problem in my opinion, you can freely tune the probability.

In the specific case I was speaking about, you don't expect to find anything. Therefore, as Patrick says, if you tune the probability of false positives, you should not expect ones really often. If one occurs, of course, you have to verify it in the list.

Regards,
Sebastien Tandel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGAA3fw76McB8jGxkRCnGjAJ0diPmS3tmxWs/sqymSuSXS1S/aWgCgm/JO Abrg/mwtbgdUzbnXhqR9GcA=
=LBzy
-----END PGP SIGNATURE-----

#1 lore raw

Re: bloom filter in netfilter?

Quoted 8 lines · Sebastien Tandel
Quoted 2 lines · Patrick McHardy

That wouldn't be a big problem in my opinion, you can freely tune the probability.

In the specific case I was speaking about, you don't expect to find anything. Therefore, as Patrick says, if you tune the probability of false positives, you should not expect ones really often. If one occurs, of course, you have to verify it in the list.

But the case in which we don't expect to find anything is the worst case, eg. someone is generating trash traffic to stress the conntrack system. So this can be considered as a hardening technique. Anyway, we would need to evaluate the impact of such solution in terms of memory consumption (probably something from 4KB to 16KB) and extra CPU cycles due to hashing. Of course, previously we would have to get some numbers to know how bad is currently the worst case.

I have some experimental stuff on bloom filters at my people netfilter place that I needed for some works here at the university, it can't be used for any productive purposes but you could use it as a starting point.

Signature · 1 line
The dawn of the fourth age of Linux firewalling is coming; a time of great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris
#2 lore raw

Re: bloom filter in netfilter?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

That wouldn't be a big problem in my opinion, you can freely tune the probability.

Quoted 6 lines

In the specific case I was speaking about, you don't expect to find anything. Therefore, as Patrick says, if you tune the probability of false positives, you should not expect ones really often. If one occurs, of course, you have to verify it in the list.

Quoted 4 lines
Quoted 4 lines

But the case in which we don't expect to find anything is the worst case, eg. someone is generating trash traffic to stress the conntrack system. So this can be considered as a hardening technique.

In the case of the traversal of the two lists in "nf_conntrack_confirm"? You're not expecting the race from NAT at every call, do you? Or have I missed something in the code?

Quoted 3 lines
Quoted 3 lines

Anyway, we would need to evaluate the impact of such solution in terms of memory consumption (probably something from 4KB to 16KB) and extra CPU cycles due to hashing.

Yes, of course I do not imagine that it will be very useful for people at home with only a few connections at a time.

Quoted 2 lines
Quoted 2 lines

Of course, previously we would have to get some numbers to know how bad is currently the worst case.

Indeed, it would be good.

Quoted 4 lines
Quoted 4 lines

I have some experimental stuff on bloom filters at my people netfilter place that I needed for some works here at the university, it can't be used for any productive purposes but you could use it as a starting point.

Why? what are your deceptions about these bloomy things?

I've looked at your bloom-experiments.tgz. Do you think one sha1 is slower than this implementation of hash in your modulo.c? Do you really think it will be random?
One sha1 computation should suffice to compute what you need. The digest is of 160 bits. If you want 216 buckets, you may generate 10 bits hash. Could the sha1 algorithm from the kernel take advantage of cryptography dedicated chipset?

One another nice property of counting bloom filters is that you have the opportunity to perform some kind of "repartition" in your hash table. But as Patrick has mentioned earlier, the drawback is the memory consumption, if you want to avoid this memory consumption, it will take much more CPU cycles.

Regards,
Sebastien Tandel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGAFURw76McB8jGxkRCimEAJ9UV8Hl0ixV8vz0LvYxO57d7AvO+gCfZ8lm ReyT0HwmqlxIi3oi3iTqFbA=
=SV8r
-----END PGP SIGNATURE-----

#3 lore raw

Re: bloom filter in netfilter?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

one must read 2^16 buckets and not 216 ... of course.

Quoted 51 lines · Sebastien Tandel
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines

That wouldn't be a big problem in my opinion, you can freely tune the probability.

Quoted 5 lines

In the specific case I was speaking about, you don't expect to find anything. Therefore, as Patrick says, if you tune the probability of false positives, you should not expect ones really often. If one occurs, of course, you have to verify it in the list.

But the case in which we don't expect to find anything is the worst case, eg. someone is generating trash traffic to stress the conntrack system. So this can be considered as a hardening technique.

In the case of the traversal of the two lists in "nf_conntrack_confirm"? You're not expecting the race from NAT at every call, do you? Or have I missed something in the code?

Quoted 3 lines
Quoted 3 lines

Anyway, we would need to evaluate the impact of such solution in terms of memory consumption (probably something from 4KB to 16KB) and extra CPU cycles due to hashing.

Yes, of course I do not imagine that it will be very useful for people at home with only a few connections at a time.

Quoted 2 lines
Quoted 2 lines

Of course, previously we would have to get some numbers to know how bad is currently the worst case.

Indeed, it would be good.

Quoted 4 lines
Quoted 4 lines

I have some experimental stuff on bloom filters at my people netfilter place that I needed for some works here at the university, it can't be used for any productive purposes but you could use it as a starting point.

Why? what are your deceptions about these bloomy things?

I've looked at your bloom-experiments.tgz. Do you think one sha1 is slower than this implementation of hash in your modulo.c? Do you really think it will be random?
One sha1 computation should suffice to compute what you need. The digest is of 160 bits. If you want 216 buckets, you may generate 10 bits hash. Could the sha1 algorithm from the kernel take advantage of cryptography dedicated chipset?

One another nice property of counting bloom filters is that you have the opportunity to perform some kind of "repartition" in your hash table. But as Patrick has mentioned earlier, the drawback is the memory consumption, if you want to avoid this memory consumption, it will take much more CPU cycles.

Quoted 3 lines

Regards,
Sebastien Tandel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGASjbw76McB8jGxkRCuMKAJ9cpfePn3/jB5gApIRX5ZXUVdSBlgCeOI4O 7xQUdwQjMfWse1lPG/oKSHs=
=9wZr
-----END PGP SIGNATURE-----

#4 lore raw

Re: bloom filter in netfilter?

In reply to Pablo Neira Ayuso

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

one potential bad news ? :)

http://people.netfilter.org/kadlec/hashtrie/

see the shared node case

Regards,
Sebastien Tandel

Quoted 18 lines · Pablo Neira Ayuso
Quoted 8 lines · Sebastien Tandel
Quoted 2 lines · Patrick McHardy

That wouldn't be a big problem in my opinion, you can freely tune the probability.

In the specific case I was speaking about, you don't expect to find anything. Therefore, as Patrick says, if you tune the probability of false positives, you should not expect ones really often. If one occurs, of course, you have to verify it in the list.

But the case in which we don't expect to find anything is the worst case, eg. someone is generating trash traffic to stress the conntrack system. So this can be considered as a hardening technique. Anyway, we would need to evaluate the impact of such solution in terms of memory consumption (probably something from 4KB to 16KB) and extra CPU cycles due to hashing. Of course, previously we would have to get some numbers to know how bad is currently the worst case.

Quoted 4 lines

I have some experimental stuff on bloom filters at my people netfilter place that I needed for some works here at the university, it can't be used for any productive purposes but you could use it as a starting point.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGASkxw76McB8jGxkRCp46AKCaRRhop9jvHLjKltmq+Q4VzGbQswCfZbVi 2hl1DfEw/vzotcOPMLEFGo8=
=e95M
-----END PGP SIGNATURE-----

#5 lore raw

Re: bloom filter in netfilter?

Quoted 8 lines · Sebastien Tandel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

one potential bad news ? :)

http://people.netfilter.org/kadlec/hashtrie/

see the shared node case

As I wrote there, the bad results might be my fault. Feel free anyone to plug in another bloom filter implementation into the code and test it.

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