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
99 XT_RECENT_UPDATE = 1 << 2,
1010 XT_RECENT_REMOVE = 1 << 3,
1111 XT_RECENT_TTL = 1 << 4,
12+ XT_RECENT_REAP = 1 << 5,
1213
1314 XT_RECENT_SOURCE = 0,
1415 XT_RECENT_DEST = 1,
@@ -16,6 +17,9 @@ enum { · 1 unmodified line
1617 XT_RECENT_NAME_LEN = 200,
1718 };
1819
20+/* Only allowed with --rcheck and --update */
21+#define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP)
22+
1923 struct xt_recent_mtinfo {
2024 __u32 seconds;
2125 __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