Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290801
b: refs/heads/master
c: 0927a1a
h: refs/heads/master
i:
  290799: c0e65af
v: v3
  • Loading branch information
Jozsef Kadlecsik authored and Pablo Neira Ayuso committed Mar 7, 2012
1 parent de30def commit ae64bcc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae8ded1cb88b9c24f3c9552ca9eefd894b069716
refs/heads/master: 0927a1ac63388271d58e9f7352d71434e1271374
22 changes: 18 additions & 4 deletions trunk/include/linux/netfilter/ipset/ip_set_ahash.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,12 @@ type_pf_resize(struct ip_set *set, bool retried)
htable_bits++;
pr_debug("attempt to resize set %s from %u to %u, t %p\n",
set->name, orig->htable_bits, htable_bits, orig);
if (!htable_bits)
if (!htable_bits) {
/* In case we have plenty of memory :-) */
pr_warning("Cannot increase the hashsize of set %s further\n",
set->name);
return -IPSET_ERR_HASH_FULL;
}
t = ip_set_alloc(sizeof(*t)
+ jhash_size(htable_bits) * sizeof(struct hbucket));
if (!t)
Expand Down Expand Up @@ -407,8 +410,12 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
int i, ret = 0;
u32 key, multi = 0;

if (h->elements >= h->maxelem)
if (h->elements >= h->maxelem) {
if (net_ratelimit())
pr_warning("Set %s is full, maxelem %u reached\n",
set->name, h->maxelem);
return -IPSET_ERR_HASH_FULL;
}

rcu_read_lock_bh();
t = rcu_dereference_bh(h->table);
Expand Down Expand Up @@ -790,9 +797,12 @@ type_pf_tresize(struct ip_set *set, bool retried)
retry:
ret = 0;
htable_bits++;
if (!htable_bits)
if (!htable_bits) {
/* In case we have plenty of memory :-) */
pr_warning("Cannot increase the hashsize of set %s further\n",
set->name);
return -IPSET_ERR_HASH_FULL;
}
t = ip_set_alloc(sizeof(*t)
+ jhash_size(htable_bits) * sizeof(struct hbucket));
if (!t)
Expand Down Expand Up @@ -843,8 +853,12 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
if (h->elements >= h->maxelem)
/* FIXME: when set is full, we slow down here */
type_pf_expire(h);
if (h->elements >= h->maxelem)
if (h->elements >= h->maxelem) {
if (net_ratelimit())
pr_warning("Set %s is full, maxelem %u reached\n",
set->name, h->maxelem);
return -IPSET_ERR_HASH_FULL;
}

rcu_read_lock_bh();
t = rcu_dereference_bh(h->table);
Expand Down

0 comments on commit ae64bcc

Please sign in to comment.