Skip to contentSkip to conversation

: Don't try to do any random dropping

PATCH In review Patrick McHardy 1 participant 1 message Sep 21, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/12 : Don't try to do any random dropping

[email protected], 2004-09-18 23:18:23+02:00, [email protected]
[NETFILTER]: Don't try to do any random dropping since we now use
jenkins hash

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/09/18 23:18:23+02:00 [email protected]
# [NETFILTER]: Don't try to do any random dropping since we now use jenkins hash
#
# Signed-off-by: Rusty Russell <[email protected]>
# Signed-off-by: Patrick McHardy <[email protected]>
#

# net/ipv4/netfilter/ip_conntrack_core.c
#   2004/09/18 23:17:57+02:00 [email protected] +4 -10
#   [NETFILTER]: Don't try to do any random dropping since we now use jenkins hash
#   
#   Signed-off-by: Rusty Russell <[email protected]>
#   Signed-off-by: Patrick McHardy <[email protected]>
# 
diff -Nru a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
--- a/net/ipv4/netfilter/ip_conntrack_core.c	2004-09-20 11:56:46 +02:00
+++ b/net/ipv4/netfilter/ip_conntrack_core.c	2004-09-20 11:56:46 +02:00
@@ -571,7 +571,6 @@
 	size_t hash;
 	struct ip_conntrack_expect *expected;
 	int i;
-	static unsigned int drop_next;

if (!ip_conntrack_hash_rnd_initted) {
get_random_bytes(&ip_conntrack_hash_rnd, 4);
@@ -580,15 +579,10 @@

hash = hash_conntrack(tuple);

- if (ip_conntrack_max &&
- atomic_read(&ip_conntrack_count) >= ip_conntrack_max) {
- /* Try dropping from random chain, or else from the
- chain about to put into (in case they're trying to
- bomb one hash chain). */
- unsigned int next = (drop_next++)%ip_conntrack_htable_size;
-
- if (!early_drop(&ip_conntrack_hash[next])
- && !early_drop(&ip_conntrack_hash[hash])) {
+ if (ip_conntrack_max
+ && atomic_read(&ip_conntrack_count) >= ip_conntrack_max) {
+ /* Try dropping from this hash chain. */
+ if (!early_drop(&ip_conntrack_hash[hash])) {
if (net_ratelimit())
printk(KERN_WARNING
"ip_conntrack: table full, dropping"