summaryrefslogtreecommitdiffstats
path: root/net/netfilter/ipset/ip_set_core.c
diff options
context:
space:
mode:
authorJosh Hunt2014-03-01 04:14:57 +0100
committerJozsef Kadlecsik2014-03-06 09:31:43 +0100
commit07cf8f5ae2657ac495b906c68ff3441ff8ba80ba (patch)
tree1492748285640e3445dfc7c0287836a84db60ffe /net/netfilter/ipset/ip_set_core.c
parentnetfilter: ipset: move registration message to init from net_init (diff)
downloadkernel-qcow2-linux-07cf8f5ae2657ac495b906c68ff3441ff8ba80ba.tar.gz
kernel-qcow2-linux-07cf8f5ae2657ac495b906c68ff3441ff8ba80ba.tar.xz
kernel-qcow2-linux-07cf8f5ae2657ac495b906c68ff3441ff8ba80ba.zip
netfilter: ipset: add forceadd kernel support for hash set types
Adds a new property for hash set types, where if a set is created with the 'forceadd' option and the set becomes full the next addition to the set may succeed and evict a random entry from the set. To keep overhead low eviction is done very simply. It checks to see which bucket the new entry would be added. If the bucket's pos value is non-zero (meaning there's at least one entry in the bucket) it replaces the first entry in the bucket. If pos is zero, then it continues down the normal add process. This property is useful if you have a set for 'ban' lists where it may not matter if you release some entries from the set early. Signed-off-by: Josh Hunt <johunt@akamai.com> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Diffstat (limited to 'net/netfilter/ipset/ip_set_core.c')
-rw-r--r--net/netfilter/ipset/ip_set_core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 636cb8df5354..117208321f16 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -368,6 +368,8 @@ ip_set_elem_len(struct ip_set *set, struct nlattr *tb[], size_t len)
if (tb[IPSET_ATTR_CADT_FLAGS])
cadt_flags = ip_set_get_h32(tb[IPSET_ATTR_CADT_FLAGS]);
+ if (cadt_flags & IPSET_FLAG_WITH_FORCEADD)
+ set->flags |= IPSET_CREATE_FLAG_FORCEADD;
for (id = 0; id < IPSET_EXT_ID_MAX; id++) {
if (!add_extension(id, cadt_flags, tb))
continue;