Skip to contentSkip to conversation

R:Re: Questions about early_drop()

DISCUSSION Patrick McHardy 2 participants 2 messages Nov 5, 2009 – Nov 7, 2009 1 message not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 7 lines · [email protected] wrote:

Hi Patrick,
thanks for the explanation. The only thing I do not understand is:

Quoted 3 lines

It does greatly improve robustness under DoS since with jhash() and a properly sized
hash table there's likely only a single entry per bucket.

Quoted 6 lines

I understand that this comes from hash tables theory, but I don't get it... When conntrack_core module is loaded, the maximum number of conntrack entries is calculated as (hashsize * 8), so when early_drop() kicks in, the table is full and is containing (hashsize*8) entries... how is it possible that in that situation every bucket contains just one entry? Shouldn't it contain about 8 entries, as a mean value?

The default is not properly sized, its a trade-off between memory use and performance. A good size would be 2 * max_entries since each conntrack is hashed twice.

#2 lore raw
Quoted 4 lines · Patrick McHardy

The default is not properly sized, its a trade-off between memory use and performance. A good size would be 2 * max_entries since each conntrack is hashed twice.

Ok, I seem to understand: since each tuple is hased in the table, actually the real table size is double of the nf_conntrack_max parameter, so to have maximum performance (1 entry per bucket) we should have a table with size = 2*nf_conntrack_max. Am I right? Thank you very much for the explanation.
Luca