Skip to contentSkip to conversation

hashlimit bucket

DISCUSSION woger151 2 participants 2 messages Nov 3, 2006

lore
Share & tools
lore

woger151

author
#0 lore raw

Can one have multiple iptables rules with hashlimit statements, with the same --hashlimit-name? And would that means there's actually just one bucket for all those rules? Can one have multiple hashlimit rules, period? What about different chains feeding into one chain with a hashlimit statement? Is that OK?

TIA

#1 lore raw
Quoted 9 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of woger151
Sent: Friday, November 03, 2006 7:20 AM
To: [email protected]
Subject: hashlimit bucket

Quoted 3 lines

Can one have multiple iptables rules with hashlimit statements, with the
same --hashlimit-name?

Yes.

Quoted 3 lines

And would that means there's actually
just one bucket
for all those rules?

Not one bucket but one hash table. You probably already know this but a hash table is simple an array with a 'function' to map a value to an index in the array. Each cell in the array is a 'bucket' in hash terminology. When there are more than one value which map to the same 'bucket', a 'chain' is created. Ideally with the correct hash function, the chains are small as the function is random enough.

I haven't looked at the hashlimit code but I imagine the hash function is based on the tuple specified: dstip, dstport, etc.

Quoted 2 lines

Can one have multiple hashlimit rules,
period?

I'm not sure what you mean by this ... would you please elaborate?

Quoted 4 lines

What
about different chains feeding into one chain with a hashlimit statement? Is
that OK?

Recall that hashlimit stores all hash tables in /proc/net/ipt_hashlimit A file is created per --hashlimit-name With that in mind, any iptables rule can manipulate a given --hashlimit-name. If you don't specify a --hashlimit-name, DEFAULT will be used.

I hope that helps.

Cheers,