Commit 5f3d1af0 authored by David S. Miller's avatar David S. Miller

[NETFILTER]: Fix ipt_hashlimit build with NETFILTER_DEBUG enabled.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a48d7328
...@@ -121,7 +121,6 @@ __dsthash_find(const struct ipt_hashlimit_htable *ht, struct dsthash_dst *dst) ...@@ -121,7 +121,6 @@ __dsthash_find(const struct ipt_hashlimit_htable *ht, struct dsthash_dst *dst)
{ {
struct dsthash_ent *ent; struct dsthash_ent *ent;
u_int32_t hash = hash_dst(ht, dst); u_int32_t hash = hash_dst(ht, dst);
MUST_BE_LOCKED(&ht->lock);
ent = LIST_FIND(&ht->hash[hash], dst_cmp, struct dsthash_ent *, dst); ent = LIST_FIND(&ht->hash[hash], dst_cmp, struct dsthash_ent *, dst);
return ent; return ent;
} }
...@@ -170,8 +169,6 @@ __dsthash_alloc_init(struct ipt_hashlimit_htable *ht, struct dsthash_dst *dst) ...@@ -170,8 +169,6 @@ __dsthash_alloc_init(struct ipt_hashlimit_htable *ht, struct dsthash_dst *dst)
static inline void static inline void
__dsthash_free(struct ipt_hashlimit_htable *ht, struct dsthash_ent *ent) __dsthash_free(struct ipt_hashlimit_htable *ht, struct dsthash_ent *ent)
{ {
MUST_BE_LOCKED(&ht->lock);
list_del(&ent->list); list_del(&ent->list);
kmem_cache_free(hashlimit_cachep, ent); kmem_cache_free(hashlimit_cachep, ent);
atomic_dec(&ht->count); atomic_dec(&ht->count);
...@@ -258,7 +255,7 @@ static void htable_selective_cleanup(struct ipt_hashlimit_htable *ht, ...@@ -258,7 +255,7 @@ static void htable_selective_cleanup(struct ipt_hashlimit_htable *ht,
IP_NF_ASSERT(ht->cfg.size && ht->cfg.max); IP_NF_ASSERT(ht->cfg.size && ht->cfg.max);
/* lock hash table and iterate over it */ /* lock hash table and iterate over it */
LOCK_BH(&ht->lock); spin_lock_bh(&ht->lock);
for (i = 0; i < ht->cfg.size; i++) { for (i = 0; i < ht->cfg.size; i++) {
struct dsthash_ent *dh, *n; struct dsthash_ent *dh, *n;
list_for_each_entry_safe(dh, n, &ht->hash[i], list) { list_for_each_entry_safe(dh, n, &ht->hash[i], list) {
...@@ -266,7 +263,7 @@ static void htable_selective_cleanup(struct ipt_hashlimit_htable *ht, ...@@ -266,7 +263,7 @@ static void htable_selective_cleanup(struct ipt_hashlimit_htable *ht,
__dsthash_free(ht, dh); __dsthash_free(ht, dh);
} }
} }
UNLOCK_BH(&ht->lock); spin_unlock_bh(&ht->lock);
} }
/* hash table garbage collector, run by timer */ /* hash table garbage collector, run by timer */
...@@ -457,7 +454,7 @@ hashlimit_match(const struct sk_buff *skb, ...@@ -457,7 +454,7 @@ hashlimit_match(const struct sk_buff *skb,
dst.dst_port = ports[1]; dst.dst_port = ports[1];
} }
LOCK_BH(&hinfo->lock); spin_lock_bh(&hinfo->lock);
dh = __dsthash_find(hinfo, &dst); dh = __dsthash_find(hinfo, &dst);
if (!dh) { if (!dh) {
dh = __dsthash_alloc_init(hinfo, &dst); dh = __dsthash_alloc_init(hinfo, &dst);
...@@ -466,7 +463,7 @@ hashlimit_match(const struct sk_buff *skb, ...@@ -466,7 +463,7 @@ hashlimit_match(const struct sk_buff *skb,
/* enomem... don't match == DROP */ /* enomem... don't match == DROP */
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR "%s: ENOMEM\n", __FUNCTION__); printk(KERN_ERR "%s: ENOMEM\n", __FUNCTION__);
UNLOCK_BH(&hinfo->lock); spin_unlock_bh(&hinfo->lock);
return 0; return 0;
} }
...@@ -479,7 +476,7 @@ hashlimit_match(const struct sk_buff *skb, ...@@ -479,7 +476,7 @@ hashlimit_match(const struct sk_buff *skb,
hinfo->cfg.burst); hinfo->cfg.burst);
dh->rateinfo.cost = user2credits(hinfo->cfg.avg); dh->rateinfo.cost = user2credits(hinfo->cfg.avg);
UNLOCK_BH(&hinfo->lock); spin_unlock_bh(&hinfo->lock);
return 1; return 1;
} }
...@@ -490,11 +487,11 @@ hashlimit_match(const struct sk_buff *skb, ...@@ -490,11 +487,11 @@ hashlimit_match(const struct sk_buff *skb,
if (dh->rateinfo.credit >= dh->rateinfo.cost) { if (dh->rateinfo.credit >= dh->rateinfo.cost) {
/* We're underlimit. */ /* We're underlimit. */
dh->rateinfo.credit -= dh->rateinfo.cost; dh->rateinfo.credit -= dh->rateinfo.cost;
UNLOCK_BH(&hinfo->lock); spin_unlock_bh(&hinfo->lock);
return 1; return 1;
} }
UNLOCK_BH(&hinfo->lock); spin_unlock_bh(&hinfo->lock);
/* default case: we're overlimit, thus don't match */ /* default case: we're overlimit, thus don't match */
return 0; return 0;
...@@ -569,7 +566,7 @@ static void *dl_seq_start(struct seq_file *s, loff_t *pos) ...@@ -569,7 +566,7 @@ static void *dl_seq_start(struct seq_file *s, loff_t *pos)
struct ipt_hashlimit_htable *htable = pde->data; struct ipt_hashlimit_htable *htable = pde->data;
unsigned int *bucket; unsigned int *bucket;
LOCK_BH(&htable->lock); spin_lock_bh(&htable->lock);
if (*pos >= htable->cfg.size) if (*pos >= htable->cfg.size)
return NULL; return NULL;
...@@ -603,7 +600,7 @@ static void dl_seq_stop(struct seq_file *s, void *v) ...@@ -603,7 +600,7 @@ static void dl_seq_stop(struct seq_file *s, void *v)
kfree(bucket); kfree(bucket);
UNLOCK_BH(&htable->lock); spin_unlock_bh(&htable->lock);
} }
static inline int dl_seq_real_show(struct dsthash_ent *ent, struct seq_file *s) static inline int dl_seq_real_show(struct dsthash_ent *ent, struct seq_file *s)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment