aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTim Gardner <tim.gardner@canonical.com>2010-03-16 14:53:13 -0400
committerPatrick McHardy <kaber@trash.net>2010-03-17 10:53:12 -0400
commit0079c5aee34880bcee7feee9960f0502c73dc5fa (patch)
treea828b04c52f6650cbd654ca7b7de5ccdab5762c7 /include
parent5be4a4f589841ef06fd79b241de3d5353a6c5efa (diff)
netfilter: xt_recent: add an entry reaper
One of the problems with the way xt_recent is implemented is that there is no efficient way to remove expired entries. Of course, one can write a rule '-m recent --remove', but you have to know beforehand which entry to delete. This commit adds reaper logic which checks the head of the LRU list when a rule is invoked that has a '--seconds' value and XT_RECENT_REAP set. If an entry ceases to accumulate time stamps, then it will eventually bubble to the top of the LRU list where it is then reaped. Signed-off-by: Tim Gardner <tim.gardner@canonical.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/netfilter/xt_recent.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h
index d2c276609925..bba990ecb018 100644
--- a/include/linux/netfilter/xt_recent.h
+++ b/include/linux/netfilter/xt_recent.h
@@ -9,6 +9,7 @@ enum {
9 XT_RECENT_UPDATE = 1 << 2, 9 XT_RECENT_UPDATE = 1 << 2,
10 XT_RECENT_REMOVE = 1 << 3, 10 XT_RECENT_REMOVE = 1 << 3,
11 XT_RECENT_TTL = 1 << 4, 11 XT_RECENT_TTL = 1 << 4,
12 XT_RECENT_REAP = 1 << 5,
12 13
13 XT_RECENT_SOURCE = 0, 14 XT_RECENT_SOURCE = 0,
14 XT_RECENT_DEST = 1, 15 XT_RECENT_DEST = 1,
@@ -16,6 +17,9 @@ enum {
16 XT_RECENT_NAME_LEN = 200, 17 XT_RECENT_NAME_LEN = 200,
17}; 18};
18 19
20/* Only allowed with --rcheck and --update */
21#define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP)
22
19struct xt_recent_mtinfo { 23struct xt_recent_mtinfo {
20 __u32 seconds; 24 __u32 seconds;
21 __u32 hit_count; 25 __u32 hit_count;