Skip to content

Commit f4ebd03

Browse files
Phil Sutterummakynes
Phil Sutter
authored andcommitted
netfilter: xt_recent: Lift restrictions on max hitcount value
Support tracking of up to 65535 packets per table entry instead of just 255 to better facilitate longer term tracking or higher throughput scenarios. Note how this aligns sizes of struct recent_entry's 'nstamps' and 'index' fields when 'nstamps' was larger before. This is unnecessary as the value of 'nstamps' grows along with that of 'index' after being initialized to 1 (see recent_entry_update()). Its value will thus never exceed that of 'index' and therefore does not need to provide space for larger values. Requested-by: Fabio <[email protected]> Link: https://bugzilla.netfilter.org/show_bug.cgi?id=1745 Signed-off-by: Phil Sutter <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 742ad97 commit f4ebd03

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/netfilter/xt_recent.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ MODULE_PARM_DESC(ip_list_gid, "default owning group of /proc/net/xt_recent/* fil
5959
/* retained for backwards compatibility */
6060
static unsigned int ip_pkt_list_tot __read_mostly;
6161
module_param(ip_pkt_list_tot, uint, 0400);
62-
MODULE_PARM_DESC(ip_pkt_list_tot, "number of packets per IP address to remember (max. 255)");
62+
MODULE_PARM_DESC(ip_pkt_list_tot, "number of packets per IP address to remember (max. 65535)");
6363

64-
#define XT_RECENT_MAX_NSTAMPS 256
64+
#define XT_RECENT_MAX_NSTAMPS 65536
6565

6666
struct recent_entry {
6767
struct list_head list;
6868
struct list_head lru_list;
6969
union nf_inet_addr addr;
7070
u_int16_t family;
7171
u_int8_t ttl;
72-
u_int8_t index;
72+
u_int16_t index;
7373
u_int16_t nstamps;
7474
unsigned long stamps[];
7575
};
@@ -80,7 +80,7 @@ struct recent_table {
8080
union nf_inet_addr mask;
8181
unsigned int refcnt;
8282
unsigned int entries;
83-
u8 nstamps_max_mask;
83+
u_int16_t nstamps_max_mask;
8484
struct list_head lru_list;
8585
struct list_head iphash[];
8686
};

0 commit comments

Comments
 (0)