History

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.

Tim Gardner committed 16 years ago

Commit 0079c5a1 parent 5be4a4f2 files · +31 −1Browse files

Showing the changes to include/linux/netfilter (1 of 2 files). Show all

Unified · Split

include/linux/netfilter/xt_recent.h+4−0
@@ -9,6 +9,7 @@ enum { · 8 unmodified lines
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 { · 1 unmodified line
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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t